Simpatico  v1.10
Bond Interaction Class Interface

Bond interaction classes are used in bond potential class templates to implement bond potential classes both the McMd and DdMd namespaces, in the templates McMd::BondPotentialImpl and DdMd::BondPotentialImpl. These templates call specific functions by name, and thus define an implicit interface that must be implemented by all bond interaction classes.

Here is a prototype class definition that shows the signatures for all of the required functions, for a hypothetical interaction class called Bond:

class Bond : public ParamComposite
{
public:
// Mutators
// Set nBondType value.
//
// \param nBondType number of bond types.
//
void setNBondType(int nBondType);
// Read parameters for this bond interaction function.
//
// \pre nBondType must have been set, by calling setNBondType().
//
// \param in input stream
//
virtual void readParameters(std::istream &in);
// Load internal state from an archive.
//
// \param ar input/loading archive
//
virtual void loadParameters(Serializable::IArchive &ar);
// Save internal state to an archive.
//
// \param ar output/saving archive
//
virtual void save(Serializable::OArchive &ar);
// Modify a parameter, identified by a name string.
//
// \param name parameter name
// \param typeId integer bond type id
// \param value new value of parameter
//
void set(std::string name, int typeId, double value);
// Accessors
// Return interaction energy for a single bond of particles.
//
// \param rsq square of distance between particles
// \param typeId integer bond type id
// \return bond interaction energy
//
double energy(double rsq, int typeId) const;
// Returns ratio of scalar bond interaction force to bond separation.
//
// Multiply this quantity by the components of the separation vector
// to obtain the force vector. A positive value for the return value
// represents a repulsive force between a bond of particles.
//
// \param rsq square of distance between particles
// \param typeId integer bond type id
// \return force divided by distance
//
double forceOverR(double rsq, int i) const;
// Get a parameter value, identified by a string.
//
// \param name parameter name
// \param typeId integer bond type id
//
double get(std::string name, int typeId) const;
};