Simpatico  v1.10
Angle Interaction Class Interface

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

An angle is an interaction between two three atoms numbered 0,1, and 2 Let ${\bf r}_{i}$ be the position vector for atom i, with $0 \leq i < 3$. We define two bond vectors

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

class Angle : public ParamComposite
{
public:
// Mutators
// Set the number of angle types.
//
// \param nAngleType number of angle types
//
void setNAngleType(int nAngleType);
// Read parameters for this angle interaction function.
//
// \pre nAngleType must have been set, by calling setNAngleType().
//
// \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 angle type id
// \param value new value of parameter
//
void set(std::string name, int typeId, double value);
// Accessors
// Returns potential energy for one angle.
//
// \param cosTheta cosine of the bend angle.
// \param type type of bend angle.
//
double energy(double cosTheta, int type) const;
// Returns angle forces.
//
// Upon return, elements of the vectors f1 and f2
// contain derivatives of the energy with respect
// to corresponding elements of b1 and b2:
//
// f1[i] = d(energy)/d(b1[i])
// f2[i] = d(energy)/d(b2[i])
//
// for each 0 <= i < 3.
//
// \param b1 bond vector r1 - r0 from atom 0 to 1
// \param b2 bond vector r2 - r1 from atom 1 to 2
// \param f1 return force along b1 direction (output)
// \param f2 return force along b2 direction (output)
// \param type integer index for type of angle
//
void force(const Vector& b1, const Vector& b2,
Vector& f1, Vector& f2, int type) const;
// Return class name of this interaction class.
//
std::string className() const;
// Get a parameter value, identified by a string.
//
// \param name parameter name
// \param typeId integer angle type id
//
double get(std::string name, int typeId) const;
};