Esempio n. 1
0
void 
IStepped::operator<<(const magnet::xml::Node& XML)
{
  if (strcmp(XML.getAttribute("Type"),"Stepped"))
    M_throw() << "Attempting to load Stepped from non Stepped entry";
  
  range.set_ptr(C2Range::getClass(XML,Sim));
  
  try {
    intName = XML.getAttribute("Name");

    if (!XML.hasNode("Step"))
      M_throw() << "No steppings defined for stepped potential " 
		<< intName;

    for (magnet::xml::Node node = XML.fastGetNode("Step"); node.valid(); ++node)
      steps.push_back(steppair(node.getAttribute("R").as<double>(),
			       node.getAttribute("E").as<double>()));
    
    std::sort(steps.rbegin(), steps.rend());

    IMultiCapture::loadCaptureMap(XML);
  }
  catch (boost::bad_lexical_cast &)
    {
      M_throw() << "Failed a lexical cast in CIStepped";
    }

  if (steps.empty())
    M_throw() << "No steps defined in SteppedPotential Interaction with name " 
	      << getName();
}
Esempio n. 2
0
  void 
  Topology::operator<<(const magnet::xml::Node& XML)
  {
    try { spName = XML.getAttribute("Name"); } 
    catch (boost::bad_lexical_cast &)
      {
	M_throw() << "Failed a lexical cast in CTopology";
      }
    
    for (magnet::xml::Node node = XML.fastGetNode("Molecule"); node.valid(); ++node)
      ranges.push_back(shared_ptr<Range>(Range::getClass(node, Sim)));
  }
Esempio n. 3
0
  void 
  Topology::operator<<(const magnet::xml::Node& XML)
  {
    try { spName = XML.getAttribute("Name"); } 
    catch (boost::bad_lexical_cast &)
      {
	M_throw() << "Failed a lexical cast in CTopology";
      }
    
    if (!XML.hasNode("Molecule"))
      M_throw() << "Cannot load a Topology which has no molecules!";

    for (magnet::xml::Node node = XML.fastGetNode("Molecule"); node.valid(); ++node)
      ranges.push_back(shared_ptr<IDRange>(IDRange::getClass(node.getNode("IDRange"), Sim)));
  }
Esempio n. 4
0
void 
C2RRangeList::operator<<(const magnet::xml::Node& XML)
{
  if (strcmp(XML.getAttribute("Range"),"RangeList"))
    M_throw() << "Attempting to load a List from a non List";    
  
  try 
    {
      for (magnet::xml::Node node = XML.fastGetNode("RangeListItem"); node.valid(); ++node)
	ranges.push_back(magnet::ClonePtr<C2Range>(C2Range::getClass(node, Sim)));
    }
  catch (boost::bad_lexical_cast &)
    {
      M_throw() << "Failed a lexical cast in C2RRangeList";
    }
}
Esempio n. 5
0
  void 
  PotentialStepped::operator<<(const magnet::xml::Node& XML) {
    if (XML.getAttribute("Direction").as<std::string>() == "Left")
      _direction = false;
    else if (XML.getAttribute("Direction").as<std::string>() == "Right")
      _direction = true;
    else
      M_throw() << "Could not parse Direction, should be either \"Left\" or \"Right\"\nXML path:"
		<< XML.getPath();

    std::vector<std::pair<double, double> > steps;
    for (magnet::xml::Node node = XML.fastGetNode("Step"); node.valid(); ++node)
      steps.push_back(std::pair<double, double>(node.getAttribute("R").as<double>(),
						node.getAttribute("E").as<double>()));
    
    if (steps.empty())
      M_throw() << "You cannot load a stepped potential with no steps.\nXML path: " << XML.getPath();
    
    *this = PotentialStepped(steps, _direction);
  }