computers

class atomsmm.computers.PressureComputer(system, topology, platform, properties={}, temperature=None)[source]

Bases: simtk.openmm.openmm.Context

An OpenMM Context extension aimed at computing properties of a system related to isotropic volume variations.

Parameters
  • system (openmm.System) – The system…

  • topology (openmm.app.Topology) – The topology…

  • platform (openmm.Platform) – The platform…

  • properties (dict(), optional, default=dict()) – The properties…

  • temperature (unit.Quantity, optional, default=None) – The bath temperature used to compute pressures using the equipartition expectations of kinetic energies. It this is None, then the instantaneous kinetic energies will be employed.

get_atomic_pressure()[source]

Returns the unconstrained atomic pressure of a system:

\[P = \frac{2 K + W}{3 V},\]

where \(W\) is the unconstrained atomic virial (see get_atomic_virial()), \(K\) is the total kinetic energy of all atoms, and \(V\) is the box volume. If keyword temperature was employed in the PressureComputer creation, then the instantaneous kinetic energy is replaced by its equipartition-theorem average \(\left\langle K \right\rangle = 3 N_\mathrm{atoms} k_B T/2\), where \(T\) is the heat-bath temperature, thus making \(P\) independent of the atomic velocities.

Warning

The resulting pressure should not be used to compute the thermodynamic pressure of a system with constraints. For this, one can use get_molecular_pressure() instead.

get_atomic_virial()[source]

Returns the unconstrained atomic virial of the system.

Considering full scaling of atomic coordinates in a box volume change (i.e. without any distance constraints), the internal virial of the system is given by

\[W = -\sum_{i,j} r_{ij} E^\prime(r_{ij}),\]

where \(E^\prime(r)\) is the derivative of the interaction potential as a function of the distance between two atoms. Such interaction includes van der Waals, Coulomb, and bond-stretching contributions. Angles and dihedrals are not considered because they are invariant to full atomic coordinate scaling.

Warning

The resulting virial should not be used to compute the thermodynamic pressure of a system with constraints. For this, one can use get_molecular_virial() instead.

get_bond_virial()[source]

Returns the bond-stretching contribution to the atomic virial.

get_coulomb_virial()[source]

Returns the electrostatic (Coulomb) contribution to the atomic virial.

get_dispersion_virial()[source]

Returns the dispersion (van der Waals) contribution to the atomic virial.

get_molecular_pressure(forces)[source]

Returns the molecular pressure of a system:

\[P = \frac{2 K_\mathrm{mol} + W_\mathrm{mol}}{3 V},\]

where \(W_\mathrm{mol}\) is the molecular virial of the system (see get_molecular_virial()), \(K_\mathrm{mol}\) is the center-of-mass kinetic energy summed for all molecules, and \(V\) is the box volume. If keyword temperature is was employed in the PressureComputer creation, then the moleculer kinetic energy is replaced by its equipartition-theorem average \(\left\langle K_\mathrm{mol} \right\rangle = 3 N_\mathrm{mols} k_B T/2\), where \(T\) is the heat-bath temperature.

forcesvector<openmm.Vec3>

A vector whose length equals the number of particles in the System. The i-th element contains the force on the i-th particle.

get_molecular_virial(forces)[source]

Returns the molecular virial of a system.

To compute the molecular virial, only the center-of-mass coordinates of the molecules are considered to scale in a box volume change, while the internal molecular structure keeps rigid. The molecular virial is computed from the nonbonded part of the atomic virial by using the formulation of Ref. [1]:

\[W_\mathrm{mol} = W - \sum_{i} (\mathbf{r}_i -\mathbf{r}_i^\mathrm{cm}) \cdot \mathbf{F}_i,\]

where \(\mathbf{r}_i\) is the coordinate of atom i, \(\mathbf{F}_i\) is the resultant pairwise force acting on it, and \(\mathbf{r}_i^\mathrm{cm}\) is the center-of-mass coordinate of the molecule to which it belongs.

forcesvector<openmm.Vec3>

A vector whose length equals the number of particles in the System. The i-th element contains the force on the i-th particle.