pq_setup

The PQ force-field setup produced by parm2pq() and its writers.

All atom indices stored here are zero-based positions in the PQ atom order; the writers convert them to the one-based indices of the PQ setup files.

Summary

Classes:

PQForceFieldSetup

A complete PQ force-field setup.

PQMolType

One PQ moltype: the per-atom data of the moldescriptor file and the intramolecular non-bonded pairs.

Reference

class PQForceFieldSetup(moltypes: list[~PQAnalysis.io.force_field.pq_setup.PQMolType], atom_moltypes: ~numpy.ndarray, elements: list[str], positions: ~numpy.ndarray, velocities: ~numpy.ndarray | None, box: ~numpy.ndarray, atom_order: ~numpy.ndarray, scale_14_coulomb: ~numbers.Real, scale_14_vdw: ~numbers.Real, bond_types: list = <factory>, angle_types: list = <factory>, dihedral_types: list = <factory>, improper_types: list = <factory>, lj_pairs: list = <factory>, bonds: list = <factory>, angles: list = <factory>, dihedrals: list = <factory>, impropers: list = <factory>, shake: list = <factory>, mshake: dict = <factory>, source: str = '', periodic: bool = False)[source]

Bases: object

A complete PQ force-field setup. Atom indices are zero-based positions in the PQ atom order; the writers add one.

input_lines(
file_names: dict[str, str],
rcoulomb: Real,
long_range: str | None = None,
) → list[str][source]

Returns the lines of the PQ input snippet.

Parameters:
  • file_names (dict[str, str]) – The names of the written setup files.

  • rcoulomb (float) – The Coulomb cutoff in Angstrom.

  • long_range (str | None, optional) – The long-range Coulomb method, by default wolf for a periodic box and none for a vacuum box.

Returns:

The lines without line breaks.

Return type:

list[str]

intra_nonbonded_lines() → list[str][source]

Returns the lines of the intra non-bonded file.

Returns:

The lines without line breaks.

Return type:

list[str]

long_range(
method: str | None = None,
) → tuple[str, str][source]

Returns the long-range Coulomb method and the reason for it.

Parameters:

method (str | None, optional) – A method from LONG_RANGE_METHODS that overrides the choice by box, by default None.

Returns:

The method and a one-line reason.

Return type:

tuple[str, str]

moldescriptor_lines() → list[str][source]

Returns the lines of the moldescriptor file.

Returns:

The lines without line breaks.

Return type:

list[str]

mshake_lines() → list[str][source]

Returns the lines of the M-SHAKE file: one reference geometry per rigid moltype. PQ reads no comment or empty lines in this file.

Returns:

The lines without line breaks.

Return type:

list[str]

parameter_lines() → list[str][source]

Returns the lines of the parameter file.

Returns:

The lines without line breaks.

Return type:

list[str]

restart_lines() → list[str][source]

Returns the lines of the PQ restart (start) file.

Returns:

The lines without line breaks.

Return type:

list[str]

topology_lines() → list[str][source]

Returns the lines of the topology file.

Returns:

The lines without line breaks.

Return type:

list[str]

write(
output_dir: str | Path,
rcoulomb: Real,
overwrite: bool = False,
long_range: str | None = None,
) → dict[str, Path][source]

Writes all PQ setup files into a directory.

Parameters:
  • output_dir (str | Path) – The directory; it is created if needed.

  • rcoulomb (float) – The Coulomb cutoff in Angstrom written to the input snippet.

  • overwrite (bool, optional) – Whether existing files may be replaced, by default False.

  • long_range (str | None, optional) – The long-range Coulomb method of the input snippet, by default chosen by the box.

Returns:

The written files by kind.

Return type:

dict[str, Path]

Raises:

FileExistsError – If a file exists and overwrite is False.

angle_types: list

equilibrium angle in degrees and PQ force constant (1/2 k)

angles: list

atom indices, type index and linker flag

atom_moltypes: ndarray

the one-based moltype of each atom

atom_order: ndarray

the index in the source structure of each PQ atom

bond_types: list

equilibrium distance in Angstrom and PQ force constant (1/2 k)

bonds: list

atom indices, type index and linker flag

box: ndarray

the box lengths in Angstrom and angles in degrees

dihedral_types: list

force constant, periodicity and PQ phase in degrees

dihedrals: list

atom indices, type index and linker flag

elements: list[str]

the element symbol of each atom

improper_types: list

force constant, periodicity and PQ phase in degrees

impropers: list

atom indices and type index

lj_pairs: list

global van der Waals indices, c6 and c12

moltypes: list[PQMolType]

the moltypes; moltype k in PQ is moltypes[k - 1]

mshake: dict

M-SHAKE reference positions in Angstrom by one-based moltype

property n_atoms: int

The number of atoms.

Type:

int

periodic: bool = False

whether the box comes from the input (periodic) or is a vacuum box

positions: ndarray

the positions in Angstrom, shape (n_atoms, 3)

scale_14_coulomb: Real

the 1-4 Coulomb scaling factor

scale_14_vdw: Real

the 1-4 van der Waals scaling factor

shake: list

constrained atom pair and distance in Angstrom

source: str = ''

a description of the source force field for the file headers

velocities: ndarray | None

the velocities in Angstrom/s, shape (n_atoms, 3), or None

class PQMolType(
name: str,
elements: list[str],
atom_types: list[int],
charges: list[float],
vdw_types: list[int],
intra_pairs: list[list[int]],
)[source]

Bases: object

One PQ moltype: the per-atom data of the moldescriptor file and the intramolecular non-bonded pairs.

atom_types: list[int]

the atom type index of each atom within the moltype

charges: list[float]

the partial charge of each atom in e

elements: list[str]

the element symbol of each atom; PQ derives the masses from it

intra_pairs: list[list[int]]

for each atom (zero-based) the interacting partners (one-based) with a larger index; negative partners are scaled 1-4 pairs

property n_atoms: int

The number of atoms of the moltype.

Type:

int

name: str

the moltype name

vdw_types: list[int]

the global van der Waals index of each atom

DEFAULT_FILE_NAMES = {'input': 'pq_input.in', 'intra_nonbonded': 'intra_nonbonded.dat', 'moldescriptor': 'moldescriptor.dat', 'mshake': 'mshake.dat', 'parameter': 'parameter.prm', 'start': 'start.rst', 'topology': 'topology.top'}

default file names of the written PQ setup files

LONG_RANGE_METHODS = ('none', 'wolf', 'reaction-field')

the long-range Coulomb methods of PQ that parm2pq can write