TIP4P forcefield with fexible molecules and group based cutoff. More...
#include <tip4p_ccl.hpp>
Public Member Functions | |
| Tip4p () | |
| Tip4p (double cutoff, double switchingWidth) | |
| ~Tip4p () | |
| void | computeHH_O_ (const int nAtoms, const double R[], double F[], double &U, const double b[]) |
| Compute the forces and the energy. | |
| void | computeHH_O_ (const int nAtoms, const double R[], double F[], double &U, const double b[], const bool fixed[]) |
| Compute the forces and the energy (with fixed atom optimisation). | |
| Public Member Functions inherited from forcefields::Ccl | |
| Ccl () | |
| void | computeHH_O_ (const int nAtoms, const double R[], double F[], double &U, const double b[]) |
| Compute the forces and the energy. | |
| void | computeHH_O_ (const int nAtoms, const double R[], double F[], double &U, const double b[], const bool fixed[]) |
| Compute the forces and the energy (with fixed atom optimisation). | |
| char const * | getName () const |
| Name of the potential. | |
| Public Member Functions inherited from forcefields::PotentialBase | |
| PotentialBase () | |
| Non bond interaction cutoff. | |
| PotentialBase (double cutoff, double switchingWidth) | |
| virtual | ~PotentialBase () |
| double | getCutoff () const |
| void | setCutoff (double cutoff) |
| double | getSwitchingWidth () const |
| Width of the switching zone. | |
| void | setSwitchingWidth (double width) |
Static Public Member Functions | |
| static char const * | getName () |
| Name of the potential. | |
| static double | applyPeriodicity0 (double r, double const period) |
| Minimum image representation. | |
| static void | applyPeriodicity0 (double r[], double const periods[]) |
| Minimum image representation. | |
Private Member Functions | |
| template<int H, int O> | |
| void | computeTemplate (const int nMolecules, const double(*const rh1)[H *3], const double(*const rh2)[H *3], const double(*const ro)[O *3], double(*const fh1)[H *3], double(*const fh2)[H *3], double(*const fo)[O *3], double &energy, double const b[], bool const (*const xh1)[H]=0, bool const (*const xh2)[H]=0, bool const (*const xo)[O]=0) |
| Compute forces and energy. | |
| void | coulombWithCutoff (Water &w1, Water &w2, double &U) |
| Interactions between two molecules. | |
| void | coulombFull (Water &w1, Water &w2, double &U) |
| Interactions between two molecules. | |
| void | lennardJonesWithCutoff (Water &w1, Water &w2, double &U) |
| Interactions between two molecules. | |
Additional Inherited Members | |
| Protected Member Functions inherited from forcefields::Ccl | |
| Ccl (double cutoff, double switchingWidth) | |
| Constructor with cutoff for derived classes. | |
| void | intramolecular (double const rh1[], double const rh2[], double const ro[], double fh1[], double fh2[], double fo[], double &energy) |
| Interactions inside one molecules. | |
| void | initialiseRho (Vector3 const &v, Rho &r) |
| Initialise Rho. | |
| void | initialiseDtheta (Vector3 const &v1, Vector3 const &v2, Dtheta &dth, double const thetaEquilibrium) |
| Initialise Dtheta. | |
| void | intramolecular (Rho const &ro1, Rho const &ro2, Dtheta const &dth, double &energy, double fh1[], double fh2[], double fo[]) |
| Compute intramolecular energy and forces. | |
| Protected Member Functions inherited from forcefields::PotentialBase | |
| void | restrainAngle (double const r1[], double const r2[], double const r3[], double f1[], double f2[], double f3[], double &u, const double k, const double aeq) |
| Angular quadratic restraints. | |
| void | calculateCentre (double const r1[], double const r2[], double rc[]) |
| Calculate centre of two points. | |
| void | calculateCentre (double const r1[], double const r2[], double const r3[], double rc[]) |
| Calculate centre of three points. | |
| void | calculateWeightedCentre (double const w1, double const w2, double const w3, double const r1[], double const r2[], double const r3[], double rc[]) |
| Calculate barycentre. | |
| void | coulombWithCutoff (const double r1[], const double r2[], double f1[], double f2[], double &u, double const qq) |
| Coulomb interaction with single charge based cutoff. | |
| void | coulomb (const double r1[], const double r2[], double f1[], double f2[], double &u, double const qq) |
| Compute Coulomb interaction between two charges. | |
| void | coulomb (double distance, double &force, double &energy, double const qq) |
| Compute Coulomb interaction between two charges. | |
| void | spreadForce (double f1[], double f2[], double const fc[]) |
| Spread force on centre to other points. | |
| void | spreadForce (double f1[], double f2[], double f3[], double const fc[]) |
| Spread force on centre to other points. | |
| void | spreadWeightedForce (double const w1, double const w2, double const w3, double f1[], double f2[], double f3[], double const fc[]) |
| Spread force on barycentre to atoms. | |
| template<int N, class R, class F> | |
| void | addForces (ChargeGroup< N, R, F > const &g1, ChargeGroup< N, R, F > &g2) |
| Increment forces. | |
| template<int N, class R, class F> | |
| void | switching (ChargeGroup< N, R, F > &g1, ChargeGroup< N, R, F > &g2, double &energy, double cutoff, double switchingWidth) |
| void | computePt (int const nAtoms, double positions[], double forces[], double &energy, double const periods[], bool const fixed[]) |
| Potential for Platinum. | |
| void | restrainLength (const double R1[], const double R2[], double F1[], double F2[], double &u, const double k, const double r0) |
| Compute quadratic restraints between two atoms. | |
| void | lennardJones (double const distance, double &force, double &energy, double const epsilon, double const sigma) |
| Lennard-Jones 12-6 between two atoms. | |
| void | lennardJones (const double R1[], const double R2[], double F1[], double F2[], double &E, double const epsilon, double const sigma) |
| Lennard-Jones 12-6 between two atoms. | |
| void | lennardJonesWithCutoff (double const r1[], double const r2[], double f1[], double f2[], double &energy, double const epsilon, double const sigma) |
| Lennard Jones 12-6 Potential with cutoff. | |
| void | switching (double const distance, double &force, double &energy) |
| Smooth cutoff switch off. | |
| void | switching (double const r1[], double const r2[], double f1[], double f2[], double &energy) |
| Smooth cutoff switch off. | |
| double | applyPeriodicity1 (double r, int const axis) |
| Minimum image representation. | |
| void | applyPeriodicity1 (double r[]) |
| Minimum image representation. | |
| void | distance (const double x[], const double y[], double z[], double &z1, double &z2) |
| Distance vector, norm and norm square. | |
| void | distance (const double x[], const double y[], double z[], double &z1) |
| Distance. | |
| void | distance (const double x[], const double y[], double z[]) |
| Distance vector, norm. | |
| void | distance (const double x[], const double y[], double &z1) |
| Distance. | |
| void | distance (const double x[], const double y[], Vector3 &z) |
| Distance vector, norm and norm square. | |
| void | setPeriodicity (const double periods[]) |
| Set periodicity. | |
| double | unBreak1 (double const r, double const ref, int const axis) |
| Undo the separation of two atoms created by the periodic boundaries. | |
| void | unBreak1 (double r[], double const ref[]) |
| Undo the separation of two atoms created by the periodic boundaries. | |
| Static Protected Member Functions inherited from forcefields::PotentialBase | |
| static void | divide (double v[], double const divisor) |
| Divide vector. | |
| static double * | crossProduct (const double v[], const double w[], double e[]) |
| Cross product. | |
| static double | dotProduct (double const v[], double const w[]) |
| Dot product. | |
| static void | multiply (double v[], double const factor) |
| Multiply vector. | |
| static double | norm (double const v[]) |
| Norm of 3D vector. | |
| static void | normalise (double v[]) |
| Normalise 3D vector \( \frac{\mathbf v}{ |\mathbf v|} \). | |
| static double | isoscelesBase (double length, double angle) |
| Calculate the base of an isosceles triangle. | |
| static double | epsilon (double const A, double const B) |
| Conversion for Lennard-Jones. | |
| static double | sigma (double const A, double const B) |
| Conversion for Lennard-Jones. | |
| static double | smithKongEpsilon (double sigma1, double epsilon1, double sigma2, double epsilon2) |
| Smith and Kong combination rules. | |
| static double | smithKongSigma (double sigma1, double epsilon1, double sigma2, double epsilon2) |
| Smith and Kong combination rules. | |
| static double | unBreak0 (double const r, double const ref, double const period) |
| Undo the separation of two atoms created by the periodic boundaries. | |
| static void | unBreak0 (double r[], double const ref[], double const periods[]) |
| Undo the separation of two atoms created by the periodic boundaries. | |
| Protected Attributes inherited from forcefields::PotentialBase | |
| double | cutoff_ |
| double | periods_ [3] |
| double | switchingWidth_ |
| Static Protected Attributes inherited from forcefields::Ccl | |
| static double const | re_ = ::re_ |
| Distance OH at equilibrium. | |
| static double const | thetae_ = ::thetae_ |
| Distance OH at equilibrium. | |
| static const double | ONE_OVER_4_PI_EPSILON0 |
| static const double | EPSILON_PT = 0.68165797577788501 |
| Platinum Lennard-Jones. | |
| static const double | SIGMA_PT = 2.54 |
TIP4P forcefield with fexible molecules and group based cutoff.
The function computing the forces and energy is compute(). Parameters for the forcefield were taken from Abascal et al.. The parameters are those of TIP4P (original version). TIP4P is a potential for constrained molecules of water. In this implementation quadratic restraints were added to bonds OH and HH inside molecules of water. So the potential can be used without constraints. The potential has a cutoff for long range interaction. The cutoff can be changed by setCutoff(). There is also and switching zone at the edge of the cutoff to cut off the interactions smoothly. The width of this switching zone is controlled by setSwitchingWidth().
The unit system for this potential is eV (electron volt), Angstrom, e (e charge).
A general purpose model for the condensed phases of water: TIP4P/2005, J.L.F. Abascal and C. Vega, J. Chem. Phys. (2005) vol. 123, p. 234505.
Definition at line 23 of file tip4p_ccl.hpp.
| Tip4p::Tip4p | ( | ) |
Definition at line 67 of file tip4p_ccl.cpp.
| Tip4p::Tip4p | ( | double | cutoff, |
| double | switchingWidth ) |
Definition at line 70 of file tip4p_ccl.cpp.
|
inline |
Definition at line 27 of file tip4p_ccl.hpp.
| void Tip4p::computeHH_O_ | ( | const int | nAtoms, |
| const double | R[], | ||
| double | F[], | ||
| double & | U, | ||
| const double | b[] ) |
Compute the forces and the energy.
The order of the atoms is very important. For this function the order is H1, H1, H2, H2, etc ... , O1, O2, etc ... The numbers are for the molecules. The suffix HH_O_ is to reminds the ordering of the atoms. It indicates the position of the atoms of the first molecule, while the underscore marks the locations of other atoms.
| [in] | nAtoms | Number of Atoms. |
| [in] | R | coordinates. |
| [out] | F | Forces. |
| [out] | U | Potential energy. |
| [in] | b | Periodic boundaries. |
Definition at line 85 of file tip4p_ccl.cpp.
| void Tip4p::computeHH_O_ | ( | const int | nAtoms, |
| const double | R[], | ||
| double | F[], | ||
| double & | U, | ||
| const double | b[], | ||
| const bool | fixed[] ) |
Compute the forces and the energy (with fixed atom optimisation).
In a simulation, some atoms may be fixed (not allowed to move). Computing the interaction between two fixed atoms is useless. When the potential knows which atoms are fixed, it can avoid these useless computations.
| [in] | nAtoms | Number of Atoms. |
| [in] | R | coordinates. |
| [out] | F | Forces. |
| [out] | U | Potential energy. |
| [in] | b | Periodic boundaries. |
| [in] | fixed | The length of the array must be equal to nAtoms in compute(). True when atom is fixed, false otherwise. |
Definition at line 103 of file tip4p_ccl.cpp.
|
private |
Compute forces and energy.
The function calculates and returns the energy and forces applied on each atom. The function has preconditions with which the user must comply before calling this function. The periodic boundaries must set with (setPeriodicity()). The content of and arrays fh1 , fh2 , fo must be zero for all elements.
Arrays ending in h1 are for the hydrogen one of the molecules and those ending in h2 for hydrogen 2.
| [in] | nMolecules | Number of molecules. |
| [in] | rh1, rh2, ro | Positions of hydrogens and oxygens. |
| [in,out] | fh1, fh2, fo | Forces on hydrogens and oxygens. |
| [in,out] | energy | Potential energy. |
| [in] | b | Periodic boundaries. |
| [in] | xh1, xh2, xo | Tell which atoms are fixed and which are movable. This parameter are optional. When provided, interaction between fixed atoms are skipped. The three arrays xh1, xh2, xo must be provided for the optimisation to work. |
Definition at line 157 of file tip4p_ccl.cpp.
|
private |
Interactions between two molecules.
Coulomb interaction between two molecules. Full interaction (i.e. no cutoff).
| [in,out] | w1 | Molecule 1. |
| [in,out] | w2 | Molecule 2. |
| [in,out] | U | Add the potential energy to U. |
Definition at line 252 of file tip4p_ccl.cpp.
|
private |
Interactions between two molecules.
Coulomb interaction between two molecules of water with molecules-based cutoff
| [in,out] | w1 | Molecule 1. |
| [in,out] | w2 | Molecule 2. |
| [in,out] | U | Add the potential energy to U. |
Definition at line 210 of file tip4p_ccl.cpp.
|
static |
|
private |
Interactions between two molecules.
Lennard Jones between oxygen only with cutoff
| [in,out] | w1 | Molecule of water 1. |
| [in,out] | w2 | Molecule of water 2. |
| [in,out] | U | Add the potential energy to U. |
Definition at line 274 of file tip4p_ccl.cpp.