void TChain::operator<<(const magnet::xml::Node& XML) { Topology::operator<<(XML); for (magnet::xml::Node node = XML.findNode("Molecule"); node.valid(); ++node) ranges.push_back(shared_ptr<IDRange>(IDRange::getClass(node.getNode("IDRange"), Sim))); size_t Clength = (*ranges.begin())->size(); for (const shared_ptr<IDRange>& nRange : ranges) if (nRange->size() != Clength) M_throw() << "Size mismatch in loading one of the ranges in Chain topology \"" << _name << "\""; }
void LBoundary::operator<<(const magnet::xml::Node& XML) { range = shared_ptr<IDRange>(IDRange::getClass(XML.getNode("IDRange"),Sim)); localName = XML.getAttribute("Name"); _oscillationData._origin << XML.getNode("Origin"); _oscillationData._origin *= Sim->units.unitLength(); _diameter = Sim->_properties.getProperty(XML.getAttribute("Diameter"), Property::Units::Length()); if (_diameter->getMaxValue() == 0) M_throw() << "Cannot have a boundary with a diameter of zero"; _oscillationData._amplitude = Vector(); _oscillationData._freq = 0; _oscillationData._t_shift = 0; const size_t data_count = XML.hasNode("Amplitude") + XML.hasAttribute("Frequency") + XML.hasAttribute("Phase"); if ((data_count != 3) && (data_count != 0)) M_throw() << "For oscillating walls you must have an Amplitude, Frequency, and Phase specified." << XML.getPath(); if (data_count == 3) { _oscillationData._freq = XML.getAttribute("Frequency").as<double>() / Sim->units.unitTime(); _oscillationData._t_shift = XML.getAttribute("Phase").as<double>() * Sim->units.unitTime(); _oscillationData._amplitude << XML.getNode("Amplitude"); _oscillationData._amplitude *= Sim->units.unitLength(); } _kT = 0; if (XML.hasAttribute("kT")) { if (data_count == 3) M_throw() << "Cannot have both a thermalised wall and a oscillating wall" << XML.getPath(); _kT = XML.getAttribute("kT").as<double>() * Sim->units.unitEnergy(); } if (_kT < 0) M_throw() << "Temperature is less than zero" << XML.getPath(); for (magnet::xml::Node node = XML.findNode("Object"); node.valid(); ++node) _objects.push_back(boundary::Object::getClass(node, Sim, _oscillationData)); if (_objects.empty()) M_throw() << "Boundary Locals must have at least one Object.\n" << XML.getPath(); }