MDX Tutorial
Molecular Representation
Several of the libraries depend on the data types defined in mdapi/mdtypes.h. Arrays of these types are used to describe the molecular representation of the system.
One set of arrays describes the force field parameters. Another set of arrays describes the topology of the system. Particular topology arrays index a corresponding force field array in order to associate a set of parameters with a given atom or bond. By separating the force field parameters from the topology, the storage of redundant information is avoided and space is saved.
There are also trajectory arrays that store position, velocity, and force data.
Note that int32
indicates a 4-byte (32-bit) integer type.
Force field parameter types:
There is an array of MD_AtomPrm
containing each type of atom.
typedef struct MD_AtomPrm_tag { double emin; /* Lennard-Jones energy min (kcal/mol) */ double rmin; /* Lennard-Jones distance for emin (A) */ double emin14; /* modified 1-4 energy min (kcal/mol) */ double rmin14; /* modified 1-4 distance for emin14 (A) */ MD_Name type; /* string to identify atom type */ } MD_AtomPrm;
There is an array of MD_BondPrm
containing each type of bond.
typedef struct MD_BondPrm_tag { double k; /* spring coefficient (kcal/mol/A^2) */ double r0; /* equilibrium length (A) */ MD_Name type[2]; /* strings to identify atom types */ } MD_BondPrm;
There is an array of MD_AnglePrm
containing each type of angle.
typedef struct MD_AnglePrm_tag { double k_theta; /* coefficient for theta (kcal/mol/rad^2) */ double theta0; /* equilibrium angle (radians) */ double k_ub; /* coef for Urey-Bradley term (kcal/mol/A^2) */ double r_ub; /* equil length for Urey-Bradley term (A) */ MD_Name type[3]; /* strings to identify atom types */ } MD_AnglePrm;
There is an array of MD_TorsPrm
containing each type of dihedral
and a second array of MD_TorsPrm
containing each type of improper.
typedef struct MD_TorsPrm_tag { double k_tor; /* torsion coef (kcal/mol for n>0 OR kcal/mol/rad^2) */ double phi; /* phase shift (radians) */ int32 n; /* periodicity */ int32 mult; /* multiplicity of torsion */ MD_Name type[4]; /* strings to identify atom types */ } MD_TorsPrm;
There is an array of MD_NbfixPrm
containing altered Lennard-Jones constants for pairs
of atom types from the MD_AtomPrm
array.
typedef struct MD_NbfixPrm_tag { double emin; /* Lennard-Jones energy min (kcal/mol) */ double rmin; /* Lennard-Jones distance for emin (A) */ double emin14; /* modified 1-4 energy min (kcal/mol) */ double rmin14; /* modified 1-4 distance for emin14 (A) */ int32 prm[2]; /* index MD_AtomPrm array */ MD_Name type[2]; /* strings to identify atom types */ } MD_NbfixPrm;
Topology:
An array of MD_Atom
describes
each atom in the system,
with length equal to the number of atoms.
It indexes into a corresponding MD_AtomPrm
array.
typedef struct MD_Atom_tag { double m; /* mass (AMU) */ double q; /* charge (e) */ int32 prm; /* index MD_AtomPrm array */ int32 notused; /* padding */ MD_Name name; /* string to identify atom name */ MD_Name type; /* string to identify atom type name */ } MD_Atom;
An array of MD_Bond
describes
each bond in the system.
It indexes into a corresponding MD_BondPrm
array.
typedef struct MD_Bond_tag { int32 atom[2]; /* index MD_Atom array */ int32 prm; /* index MD_BondPrm array */ } MD_Bond;
An array of MD_Angle
describes
each angle in the system.
It indexes into a corresponding MD_AnglePrm
array.
typedef struct MD_Angle_tag { int32 atom[3]; /* index MD_Atom array */ int32 prm; /* index MD_AnglePrm array */ } MD_Angle;
An array of MD_Tors
describes
each dihedral in the system,
and a second array of MD_Tors
describes
each improper in the system.
These index into their respective
corresponding MD_TorsPrm
arrays.
typedef struct MD_Tors_tag { int32 atom[4]; /* index MD_Atom array */ int32 prm; /* index MD_TorsPrm array */ } MD_Tors;
An array of MD_Excl
indicates atomic pairs
that are to be excluded from nonbonded interactions.
typedef struct MD_Excl_tag { int32 atom[2]; /* index MD_Atom array */ } MD_Excl;
Trajectory:
Atomic trajectories are represented by arrays of 3-vectors (where "D" stands for "double").
typedef struct MD_Dvec_tag { double x, y, z; } MD_Dvec;