maxwelllink.matter.md.force_fields.qtip4pf module

q-TIP4P/F flexible-water force field from Habershon, Markland, and Manolopoulos [J. Chem. Phys. 131, 024501 (2009)].

class maxwelllink.matter.md.force_fields.qtip4pf.QTIP4PFForceField[source]

Bases: DummyForceField

q-TIP4P/F flexible-water force field.

Implements the q-TIP4P/F water model of Habershon, Markland, and Manolopoulos [J. Chem. Phys. 131, 024501 (2009)].

Atoms are stored in the canonical order [O, H, H, O, H, H, ...].

Notes

Electrostatics use a direct sum for an isolated molecule or cluster (box is None) and an Ewald sum for a periodic box. With no arguments the force field loads the bundled 32-molecule bulk-water box. Explicit n_molecules=216 selects the original 216-water box, and replicate tiles either box into a larger one at the same density. Equilibrate at the target temperature before production.

__init__(n_molecules=32, positions=None, box=None, replicate=None, rcut=None, ewald_wrcut=None)[source]

Initialize the q-TIP4P/F force field and build the initial geometry.

Parameters:
  • n_molecules (int, default: 32) – Number of water molecules. Ignored when positions is given. With the default value 32 and no positions/box, load water_32.xyz (Bohr). Explicit 216 loads the original water_216.xyz box.

  • positions (array-like of float, shape (3 * n_molecules, 3), optional) – Initial atomic positions in Bohr, ordered [O, H, H, ...]. If None a default geometry is built with a single equilibrium molecule for n_molecules == 1, otherwise a cubic lattice inside box.

  • box (float or array-like of float, shape (3,), optional) – Periodic box lengths in Bohr. None treats the system as a finite cluster.

  • replicate (int or array-like of int, shape (3,), optional) – Replicate the periodic cell. The molecules and the box lengths grow together, so the density is unchanged.

  • rcut (float, optional) – Real-space cutoff in Bohr for the periodic LJ and Coulomb sums. Defaults to 9 Angstrom, clamped to half the shortest box side (9.3 Bohr in the bundled 32-water box; a replicated cell lifts the clamp, so pass rcut=9.315 to keep a size ladder comparable with the unit cell).

  • ewald_wrcut (float, optional) – Real-space cutoff in Bohr for the Ewald sum (also sets \(\alpha = \pi / \mathrm{wrcut}\) and kmax = int(alpha * max(box))). Defaults to rshort * min(0.5, 1.2 * n_atoms**(-1/6)).

build_force_kernels(xp, threads_per_block=128)[source]

Return this force field’s compiled kernels from kernels_qtip4pf.

Parameters:
  • xp (module) – Array module: numpy for the CPU path, cupy for the GPU path.

  • threads_per_block (int, default: 128) – CUDA block size, ignored on the CPU path.

Returns:

The compiled force evaluator.

Return type:

kernels_qtip4pf.QTIP4PFForceKernels

compute(x, efield, terms=None)[source]

Evaluate the total q-TIP4P/F force and potential energy.

The force combines the intramolecular stretch/bend, the oxygen-oxygen Lennard-Jones term, the intermolecular Coulomb term, and the external light-matter force \(q_i \mathbf{E}\) on each charge site; the virtual M-site force is redistributed onto O, H, H by the chain rule.

Parameters:
  • x (numpy.ndarray of float, shape (na, 3)) – Atomic positions in atomic units (Bohr).

  • efield (numpy.ndarray of float, shape (3,)) – Effective electric field [E_x, E_y, E_z] in atomic units.

  • terms (numpy.ndarray of float, shape (2,), optional) – Filled with the stretch and the bend energy when given.

Returns:

  • forces (numpy.ndarray of float, shape (na, 3)) – Total force on each atom in atomic units.

  • potential (float) – Mechanical potential energy in atomic units (Hartree).

compute_fast(x, efield, terms=None)

Evaluate the force and potential with the compiled (numba) kernels.

Physically identical to compute() but several times faster. The kernels and the output buffer are built once and reused.

Parameters:
  • x (numpy.ndarray of float, shape (na, 3)) – Atomic positions in atomic units (Bohr).

  • efield (numpy.ndarray of float, shape (3,)) – Effective electric field [E_x, E_y, E_z] in atomic units.

  • terms (numpy.ndarray of float, shape (len(reported_term_names),), optional) – Filled with the energy terms of reported_term_names when given.

Returns:

  • forces (numpy.ndarray of float, shape (na, 3)) – Total force on each atom in atomic units.

  • potential (float) – Mechanical potential energy in atomic units (Hartree).

dipole(x)[source]

Compute the molecular dipole moment from the charge-site positions.

Parameters:

x (numpy.ndarray of float, shape (na, 3)) – Atomic positions in atomic units (Bohr).

Returns:

The total dipole \(\boldsymbol{\mu} = \sum_i q_i \mathbf{r}_i\) over the M-site and hydrogen charges, in atomic units.

Return type:

numpy.ndarray of float, shape (3,)

dipole_velocity(v)[source]

Compute the time derivative of the molecular dipole moment.

Parameters:

v (numpy.ndarray of float, shape (na, 3)) – Atomic velocities in atomic units.

Returns:

The dipole velocity \(\mathrm{d}\boldsymbol{\mu}/\mathrm{d}t = \sum_i q_i \mathbf{v}_i\) over the charge sites, in atomic units.

Return type:

numpy.ndarray of float, shape (3,)

has_compiled_kernels = True
molecule_symbols = ('O', 'H', 'H')
name = 'qtip4pf'
reported_term_names = ('stretch_au', 'bend_au')