예제 #1
0
  void
  CSRingDSMC::operator<<(const magnet::xml::Node& XML)
  {
    if (strcmp(XML.getAttribute("Type"),"RingDSMC"))
      M_throw() << "Attempting to load RingDSMC from a " 
		<< XML.getAttribute("Type") <<  " entry"; 
  
    try {
      tstep = XML.getAttribute("tStep").as<double>() * Sim->dynamics.units().unitTime();    
      chi12 = XML.getAttribute("Chi12").as<double>();
      chi13 = XML.getAttribute("Chi13").as<double>();
      sysName = XML.getAttribute("Name");
      diameter = XML.getAttribute("Diameter").as<double>() * Sim->dynamics.units().unitLength();
      e = XML.getAttribute("Inelasticity").as<double>();
      d2 = diameter * diameter;
      range1 = std::tr1::shared_ptr<CRange>(CRange::getClass(XML.getNode("Range1"), Sim));

      if (XML.hasAttribute("MaxProbability12"))
	maxprob12 = XML.getAttribute("MaxProbability12").as<double>();
	
      if (XML.hasAttribute("MaxProbability13"))
	maxprob13 = XML.getAttribute("MaxProbability13").as<double>();
    }
    catch (boost::bad_lexical_cast &)
      {
	M_throw() << "Failed a lexical cast in CGGlobal";
      }
  }
예제 #2
0
  void 
  SysRescale::operator<<(const magnet::xml::Node& XML)
  {
    if (strcmp(XML.getAttribute("Type"),"Rescale"))
      M_throw() << "Attempting to load Rescale from " 
		<< XML.getAttribute("Type") << " entry"; 
  
    try {
      if (XML.hasAttribute("Freq"))
	_frequency = XML.getAttribute("Freq").as<size_t>();
    
      if (XML.hasAttribute("kT"))
	_kT = XML.getAttribute("kT").as<double>();
    
      _kT *= Sim->dynamics.units().unitEnergy();

      if (XML.hasAttribute("TimeStep"))
	_timestep = XML.getAttribute("TimeStep").as<double>();

      _timestep *= Sim->dynamics.units().unitTime();

      sysName = XML.getAttribute("Name");
    }
    catch (boost::bad_lexical_cast &)
      {
	M_throw() << "Failed a lexical cast in SysRescale";
      }
  }
예제 #3
0
void 
OPThermalDiffusionE::operator<<(const magnet::xml::Node& XML)
{
  try 
    {
      try {
	species1name = std::string(XML.getAttribute("Species"));
	
      } catch (std::exception& nex)
	{
	  M_throw() << "The name of the Species must be specified"
		    << nex.what();
	}

      if (XML.hasAttribute("Length"))
	CorrelatorLength = XML.getAttribute("Length").as<size_t>();
      
      if (XML.hasAttribute("dt"))
	dt = Sim->dynamics.units().unitTime() * 
	  XML.getAttribute("dt").as<double>();
      
      if (XML.hasAttribute("t"))
	dt = Sim->dynamics.units().unitTime() * 
	  XML.getAttribute("t").as<double>() / CorrelatorLength;
    }
  catch (boost::bad_lexical_cast &)
    {
      M_throw() << "Failed a lexical cast in OPMutualDiffusion";
    }
}
예제 #4
0
  void 
  CSysGhost::operator<<(const magnet::xml::Node& XML)
  {
    if (strcmp(XML.getAttribute("Type"),"Andersen"))
      M_throw() << "Attempting to load Andersen from non Andersen entry"; 
  
    try {
      meanFreeTime = XML.getAttribute("MFT").as<double>() * Sim->dynamics.units().unitTime();
      Temp = XML.getAttribute("Temperature").as<double>() * Sim->dynamics.units().unitEnergy();
      sysName = XML.getAttribute("Name");

      if (XML.hasAttribute("SetFrequency") && XML.hasAttribute("SetPoint"))
	{
	  tune = true;
	  setFrequency = XML.getAttribute("SetFrequency").as<unsigned long long>();
	  setPoint = boost::lexical_cast<double>(XML.getAttribute("SetPoint"));
	}

      range = std::tr1::shared_ptr<CRange>(CRange::getClass(XML,Sim));
    }
    catch (boost::bad_lexical_cast &)
      {
	M_throw() << "Failed a lexical cast in CGGlobal";
      }
  }
예제 #5
0
  void 
  OPRGyration::operator<<(const magnet::xml::Node& XML)
  {
    if (XML.hasAttribute("BinWidthGyration"))
      _binWidthGyration = XML.getAttribute("BinWidthGyration").as<double>();

    if (XML.hasAttribute("BinWidthGyration"))
      _binWidthNematic = XML.getAttribute("BinWidthGyration").as<double>();
  }
예제 #6
0
파일: LEBC.cpp 프로젝트: luyao1986/DynamO
 void 
 BCLeesEdwards::operator<<(const magnet::xml::Node& XML)
 { 
   if (XML.hasAttribute("DXD"))
     _dxd = XML.getAttribute("DXD").as<double>();
   _dxd *= Sim->units.unitLength();
   
   if (XML.hasAttribute("Rate"))
     _shearRate = XML.getAttribute("Rate").as<double>();      
   _shearRate /= Sim->units.unitTime();
 }
예제 #7
0
 void 
 OPStructureImaging::operator<<(const magnet::xml::Node& XML)
 {
   if (!XML.hasAttribute("Structure"))
     M_throw() << "You must specify the name of the structure to monitor for StructureImaging";
   
   structureName = XML.getAttribute("Structure");
   
   if (XML.hasAttribute("MaxImages"))
     imageCount = XML.getAttribute("MaxImages").as<size_t>();
 }
예제 #8
0
  void 
  IHardSphere::operator<<(const magnet::xml::Node& XML)
  { 
    Interaction::operator<<(XML);
    _diameter = Sim->_properties.getProperty(XML.getAttribute("Diameter"), Property::Units::Length());

    if (XML.hasAttribute("Elasticity"))
      _e = Sim->_properties.getProperty(XML.getAttribute("Elasticity"), Property::Units::Dimensionless());
    
    if (XML.hasAttribute("TangentialElasticity"))
      _et = Sim->_properties.getProperty(XML.getAttribute("TangentialElasticity"), Property::Units::Dimensionless());
  }
예제 #9
0
  void 
  OPRGyration::operator<<(const magnet::xml::Node& XML)
  {
    if (XML.hasAttribute("binwidth1"))
      binwidth1 = XML.getAttribute("binwidth1").as<double>();

    if (XML.hasAttribute("binwidth2"))
      binwidth2 = XML.getAttribute("binwidth2").as<double>();

    if (XML.hasAttribute("binwidth3"))
      binwidth3 = XML.getAttribute("binwidth3").as<double>();
  }
예제 #10
0
파일: rescale.cpp 프로젝트: MChudak/DynamO
 void 
 SysRescale::operator<<(const magnet::xml::Node& XML)
 {
   if (XML.hasAttribute("Freq"))
     _frequency = XML.getAttribute("Freq").as<size_t>();
   if (XML.hasAttribute("kT"))
     _kT = XML.getAttribute("kT").as<double>();
   _kT *= Sim->units.unitEnergy();
   if (XML.hasAttribute("TimeStep"))
     _timestep = XML.getAttribute("TimeStep").as<double>();
   _timestep *= Sim->units.unitTime();
   sysName = XML.getAttribute("Name");
 }
예제 #11
0
  void 
  LOscillatingPlate::operator<<(const magnet::xml::Node& XML)
  {
    range = shared_ptr<Range>(Range::getClass(XML,Sim));
  
    try {
      e = XML.getAttribute("Elasticity").as<double>();
      nhat << XML.getNode("Norm");
      nhat /= nhat.nrm();

      rw0 << XML.getNode("Origin");
      rw0 *= Sim->dynamics.units().unitLength();

      if (XML.hasAttribute("StrongPlate"))
	strongPlate = XML.getAttribute("StrongPlate").as<double>();

      omega0 = XML.getAttribute("Omega0").as<double>() / Sim->dynamics.units().unitTime();
      sigma = XML.getAttribute("Sigma").as<double>() * Sim->dynamics.units().unitLength();
      delta = XML.getAttribute("Delta").as<double>() * Sim->dynamics.units().unitLength();
      mass = XML.getAttribute("Mass").as<double>()  * Sim->dynamics.units().unitMass();
      timeshift = XML.getAttribute("TimeShift").as<double>() * Sim->dynamics.units().unitTime();

      localName = XML.getAttribute("Name");
    } 
    catch (boost::bad_lexical_cast &)
      {
	M_throw() << "Failed a lexical cast in LOscillatingPlate";
      }
  }
예제 #12
0
파일: MFT.cpp 프로젝트: pviswanathan/DynamO
  void 
  OPMFT::operator<<(const magnet::xml::Node& XML)
  {
    try 
      {
	if (XML.hasAttribute("binwidth"))
	  binwidth = XML.getAttribute("binwidth").as<double>();

	if (XML.hasAttribute("length"))
	  collisionHistoryLength = XML.getAttribute("length").as<size_t>();
      }
    catch (boost::bad_lexical_cast&)
      {
	M_throw() << "Failed a lexical cast in OPMFL";
      }
  }
예제 #13
0
파일: lwall.cpp 프로젝트: MChudak/DynamO
  void 
  LWall::operator<<(const magnet::xml::Node& XML)
  {
    range = shared_ptr<IDRange>(IDRange::getClass(XML.getNode("IDRange"),Sim));
    _diameter = Sim->_properties.getProperty(XML.getAttribute("Diameter"), Property::Units::Length());

    if (_diameter->getMaxValue() == 0)
      M_throw() << "Cannot have a wall with a diameter of zero";
      
    _e = Sim->_properties.getProperty(XML.getAttribute("Elasticity"), Property::Units::Dimensionless());
    
    sqrtT = 0;
    if (XML.hasAttribute("Temperature"))
      sqrtT = sqrt(XML.getAttribute("Temperature").as<double>()
		   * Sim->units.unitEnergy());

    if (sqrtT < 0)
      M_throw() << "Cannot use negative temperatures on a Wall";

    magnet::xml::Node xBrowseNode = XML.getNode("Norm");
    localName = XML.getAttribute("Name");
    vNorm << xBrowseNode;
    if (vNorm.nrm() == 0)
      M_throw() << "The normal for the Local Wall named \"" << getName() << "\" has a length of 0. Cannot load";
    vNorm /= vNorm.nrm();
    xBrowseNode = XML.getNode("Origin");
    vPosition << xBrowseNode;
    vPosition *= Sim->units.unitLength();
  }
예제 #14
0
  void 
  ISquareWell::operator<<(const magnet::xml::Node& XML)
  {
    Interaction::operator<<(XML);
  
    try {
      _diameter = Sim->_properties.getProperty(XML.getAttribute("Diameter"),
					       Property::Units::Length());
      _lambda = Sim->_properties.getProperty(XML.getAttribute("Lambda"),
					     Property::Units::Dimensionless());
      _wellDepth = Sim->_properties.getProperty(XML.getAttribute("WellDepth"),
						Property::Units::Energy());

      if (XML.hasAttribute("Elasticity"))
	_e = Sim->_properties.getProperty(XML.getAttribute("Elasticity"),
					  Property::Units::Dimensionless());
      else
	_e = Sim->_properties.getProperty(1.0, Property::Units::Dimensionless());
      intName = XML.getAttribute("Name");
      ISingleCapture::loadCaptureMap(XML);   
    }
    catch (boost::bad_lexical_cast &)
      {
	M_throw() << "Failed a lexical cast in ISquareWell";
      }
  }
예제 #15
0
void
CSUmbrella::operator<<(const magnet::xml::Node& XML)
{
  if (strcmp(XML.getAttribute("Type"),"Umbrella"))
    M_throw() << "Attempting to load Umbrella from a " 
	      << XML.getAttribute("Type") <<  " entry"; 
  
  try {
    sysName = XML.getAttribute("Name");

    a = XML.getAttribute("a").as<double>()
      * Sim->dynamics.units().unitEnergy() 
      / Sim->dynamics.units().unitArea();

    b = XML.getAttribute("b").as<double>()
      * Sim->dynamics.units().unitLength();

    delU = XML.getAttribute("delU").as<double>() * Sim->dynamics.units().unitEnergy();
    range1.set_ptr(CRange::getClass(XML.getNode("Range1"), Sim));
    range2.set_ptr(CRange::getClass(XML.getNode("Range2"), Sim));
    
    if (XML.hasAttribute("currentulevel"))
      {
	ulevel = XML.getAttribute("currentulevel").as<size_t>();
	ulevelset = true;
      }
    
  }
  catch (boost::bad_lexical_cast &)
    { M_throw() << "Failed a lexical cast in CSUmbrella"; }
}
예제 #16
0
  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();
  }
예제 #17
0
Particle::Particle(const magnet::xml::Node& XML, unsigned long nID):
  _ID(nID),
  _peculiarTime(0.0),
  _state(DEFAULT)
{
  if (XML.hasAttribute("Static")) clearState(DYNAMIC);

  _pos << XML.getNode("P");
  _vel << XML.getNode("V");
}
예제 #18
0
  void 
  SysAndersen::operator<<(const magnet::xml::Node& XML)
  {
    meanFreeTime = XML.getAttribute("MFT").as<double>() * Sim->units.unitTime() / Sim->N();
    Temp = XML.getAttribute("Temperature").as<double>() * Sim->units.unitEnergy();
    sysName = XML.getAttribute("Name");

    if (XML.hasAttribute("Dimensions"))
      dimensions = XML.getAttribute("Dimensions").as<size_t>();

    if (XML.hasAttribute("SetFrequency") && XML.hasAttribute("SetPoint"))
      {
	tune = true;
	setFrequency = XML.getAttribute("SetFrequency").as<size_t>();
	setPoint = XML.getAttribute("SetPoint").as<double>();
      }

    range = shared_ptr<IDRange>(IDRange::getClass(XML.getNode("IDRange"),Sim));
  }
예제 #19
0
  void 
  OPVACF::operator<<(const magnet::xml::Node& XML)
  {
    try 
      {
	if (XML.hasAttribute("Length"))
	  CorrelatorLength = XML.getAttribute("Length").as<size_t>();

	if (XML.hasAttribute("dt"))
	  dt = XML.getAttribute("dt").as<double>() * Sim->dynamics.units().unitTime();

	if (XML.hasAttribute("t"))
	  dt = XML.getAttribute("t").as<double>() * Sim->dynamics.units().unitTime()
	    / CorrelatorLength;
      }
    catch (boost::bad_lexical_cast &)
      {
	M_throw() << "Failed a lexical cast in OPVACF";
      }  
  }
예제 #20
0
  void 
  ISWSequence::operator<<(const magnet::xml::Node& XML)
  {
    Interaction::operator<<(XML);

    _diameter = Sim->_properties.getProperty(XML.getAttribute("Diameter"),
					     Property::Units::Length());
    _lambda = Sim->_properties.getProperty(XML.getAttribute("Lambda"),
					   Property::Units::Dimensionless());
    
    if (XML.hasAttribute("Elasticity"))
      _e = Sim->_properties.getProperty(XML.getAttribute("Elasticity"),
					Property::Units::Dimensionless());
    else
      _e = Sim->_properties.getProperty(1.0, Property::Units::Dimensionless());
    
    intName = XML.getAttribute("Name");
    ICapture::loadCaptureMap(XML);
    
    //Load the sequence
    sequence.clear();
    std::set<size_t> letters;
    
    for (magnet::xml::Node node = XML.getNode("Sequence").fastGetNode("Element");
	 node.valid(); ++node)
      {
	if (node.getAttribute("seqID").as<size_t>() != sequence.size())
	  M_throw() << "Sequence of letters not in order, missing element " << sequence.size();
	
	size_t letter = node.getAttribute("Letter").as<size_t>();
	letters.insert(letter);
	sequence.push_back(letter);
      }
    
    //Initialise all the well depths to 1.0
    alphabet.resize(letters.size());
    
    for (std::vector<double>& vec : alphabet)
      vec.resize(letters.size(), 0.0);
    
    for (magnet::xml::Node node = XML.getNode("Alphabet").fastGetNode("Word");
	 node.valid(); ++node)
      {
	alphabet
	  .at(node.getAttribute("Letter1").as<size_t>())
	  .at(node.getAttribute("Letter2").as<size_t>())
	  = node.getAttribute("Depth").as<double>();
	
	alphabet
	  .at(node.getAttribute("Letter2").as<size_t>())
	  .at(node.getAttribute("Letter1").as<size_t>())
	  = node.getAttribute("Depth").as<double>();
      }
  }
예제 #21
0
void
OPMSDOrientationalCorrelator::operator<<(const magnet::xml::Node& XML)
{
  try {
    if (XML.hasAttribute("Length"))
      length = XML.getAttribute("Length").as<size_t>();
  }
  catch (boost::bad_lexical_cast &)
  {
    M_throw() << "Failed a lexical cast in OPMSDCorrelator";
  }
}
예제 #22
0
파일: vtk.cpp 프로젝트: herbsolo/DynamO
void 
OPVTK::operator<<(const magnet::xml::Node& XML)
{
  try {
    float bw = 1;
    if (XML.hasAttribute("binwidth"))
      bw = XML.getAttribute("binwidth").as<double>();

    binWidth = Vector(bw, bw, bw);
    
    if (XML.hasAttribute("Snapshots")) snapshots = true;
    if (XML.hasAttribute("Fields")) fields = true;
    if (XML.hasAttribute("CollisionStats")) CollisionStats = true;
    
  }
  catch (std::exception& excep)
    {
      M_throw() << "Error while parsing " << name << "options\n"
		<< excep.what();
    }
}
예제 #23
0
  DynGravity::DynGravity(dynamo::Simulation* tmp, const magnet::xml::Node& XML):
    DynNewtonian(tmp),
    elasticV(0),
    g({0, -1, 0}),
    _tc(-std::numeric_limits<float>::infinity())
  {
    if (XML.hasAttribute("ElasticV"))
      elasticV = XML.getAttribute("ElasticV").as<double>()
	* Sim->units.unitVelocity();
    
    if (XML.hasAttribute("tc"))
      {
	_tc = XML.getAttribute("tc").as<double>() * Sim->units.unitTime();
	
	if (_tc <= 0) 
	  M_throw() << "tc must be positive! (tc = " 
		    << _tc/ Sim->units.unitTime() << ")";
      }    
    g << XML.getNode("g");

    g *= Sim->units.unitAcceleration();
  }
예제 #24
0
 void 
 IThinThread::operator<<(const magnet::xml::Node& XML)
 {
   Interaction::operator<<(XML);
   _diameter = Sim->_properties.getProperty(XML.getAttribute("Diameter"), Property::Units::Length());
   _lambda = Sim->_properties.getProperty(XML.getAttribute("Lambda"), Property::Units::Dimensionless());
   _wellDepth = Sim->_properties.getProperty(XML.getAttribute("WellDepth"), Property::Units::Energy());
   if (XML.hasAttribute("Elasticity"))
     _e = Sim->_properties.getProperty(XML.getAttribute("Elasticity"), Property::Units::Dimensionless());
   else
     _e = Sim->_properties.getProperty(1.0, Property::Units::Dimensionless());
   ICapture::loadCaptureMap(XML);   
 }
예제 #25
0
  void
  SysUmbrella::operator<<(const magnet::xml::Node& XML)
  {
    sysName = XML.getAttribute("Name");
    magnet::xml::Node rangeNode = XML.getNode("IDRange");
    range1 = shared_ptr<IDRange>(IDRange::getClass(rangeNode, Sim));
    ++rangeNode;
    range2 = shared_ptr<IDRange>(IDRange::getClass(rangeNode, Sim));
    _potential = Potential::getClass(XML.getNode("Potential"));

    _lengthScale = XML.getAttribute("LengthScale").as<double>() * Sim->units.unitLength();
    _energyScale = XML.getAttribute("EnergyScale").as<double>() * Sim->units.unitEnergy();

    if (XML.hasAttribute("CurrentStep"))
      _stepID = XML.getAttribute("CurrentStep").as<size_t>();
  }
예제 #26
0
 void 
 LOscillatingPlate::operator<<(const magnet::xml::Node& XML)
 {
   range = shared_ptr<IDRange>(IDRange::getClass(XML.getNode("IDRange"),Sim));
   e = XML.getAttribute("Elasticity").as<double>();
   nhat << XML.getNode("Norm");
   nhat /= nhat.nrm();
   rw0 << XML.getNode("Origin");
   rw0 *= Sim->units.unitLength();
   if (XML.hasAttribute("StrongPlate"))
     strongPlate = XML.getAttribute("StrongPlate").as<double>();
   omega0 = XML.getAttribute("Omega0").as<double>() / Sim->units.unitTime();
   sigma = XML.getAttribute("Sigma").as<double>() * Sim->units.unitLength();
   delta = XML.getAttribute("Delta").as<double>() * Sim->units.unitLength();
   mass = XML.getAttribute("Mass").as<double>()  * Sim->units.unitMass();
   timeshift = XML.getAttribute("TimeShift").as<double>() * Sim->units.unitTime();
   localName = XML.getAttribute("Name");
 }
예제 #27
0
void 
CVector<T>::operator<<(const magnet::xml::Node& XML)
{
  for (int iDim = 0; iDim < NDIM; iDim++) 
    {
      char name[2] = "x";
      name[0] = 'x' + iDim; //Write the name
      if (!XML.hasAttribute(name))
	name[0] = '0'+iDim;
      
      try {
	data[iDim] = XML.getAttribute(name).as<T>();
      }
      catch (boost::bad_lexical_cast &)
	{
	  M_throw() << "Failed a lexical cast in CVector";
	}
    }
}
예제 #28
0
  void 
  GSOCells::operator<<(const magnet::xml::Node& XML)
  {
    globName = XML.getAttribute("Name");
    
    if (XML.hasNode("CellOrigins")) {
      Vector pos;
      for (magnet::xml::Node node = XML.getNode("CellOrigins").findNode("Origin"); node.valid(); ++node) {
	pos << node;
	pos *= Sim->units.unitLength();
	cell_origins.push_back(pos);
      }

      if (cell_origins.size() != Sim->N())
	M_throw() << "Number of CellOrigins (" << cell_origins.size() << ") does not match number of particles (" << Sim->N() << ")\n" << XML.getPath();
    }

    if (XML.hasAttribute("Diameter"))
      _cellD = XML.getAttribute("Diameter").as<double>() * Sim->units.unitLength();
  }
예제 #29
0
파일: vacf.cpp 프로젝트: BigMacchia/DynamO
 void 
 OPVACF::operator<<(const magnet::xml::Node& XML)
 {
   if (XML.hasAttribute("Length"))
     length = XML.getAttribute("Length").as<size_t>();
 }
예제 #30
0
  void 
  ISWSequence::operator<<(const magnet::xml::Node& XML)
  {
    if (strcmp(XML.getAttribute("Type"),"SquareWellSeq"))
      M_throw() << "Attempting to load SquareWell from non SquareWell entry";
  
    Interaction::operator<<(XML);

    try { 
      _diameter = Sim->_properties.getProperty(XML.getAttribute("Diameter"),
					       Property::Units::Length());
      _lambda = Sim->_properties.getProperty(XML.getAttribute("Lambda"),
					     Property::Units::Dimensionless());

      if (XML.hasAttribute("Elasticity"))
	_e = Sim->_properties.getProperty(XML.getAttribute("Elasticity"),
					  Property::Units::Dimensionless());
      else
	_e = Sim->_properties.getProperty(1.0, Property::Units::Dimensionless());

      intName = XML.getAttribute("Name");
      ISingleCapture::loadCaptureMap(XML);

      //Load the sequence
      sequence.clear();
      std::set<size_t> letters;
    
      for (magnet::xml::Node node = XML.getNode("Sequence").fastGetNode("Element");
	   node.valid(); ++node)
	{
	  if (node.getAttribute("seqID").as<size_t>() != sequence.size())
	    M_throw() << "Sequence of letters not in order, missing element " << sequence.size();

	  size_t letter = node.getAttribute("Letter").as<size_t>();
	  letters.insert(letter);
	  sequence.push_back(letter);
	}

      //Initialise all the well depths to 1.0
      alphabet.resize(letters.size());

      BOOST_FOREACH(std::vector<double>& vec, alphabet)
	vec.resize(letters.size(), 0.0);

      for (magnet::xml::Node node = XML.getNode("Alphabet").fastGetNode("Word");
	   node.valid(); ++node)
	{
	  alphabet
	    .at(node.getAttribute("Letter1").as<size_t>())
	    .at(node.getAttribute("Letter2").as<size_t>())
	    = node.getAttribute("Depth").as<double>();

	  alphabet
	    .at(node.getAttribute("Letter2").as<size_t>())
	    .at(node.getAttribute("Letter1").as<size_t>())
	    = node.getAttribute("Depth").as<double>();
	}
    }
    catch (boost::bad_lexical_cast &)
      {
	M_throw() << "Failed a lexical cast in CISWSequence";
      }
  }