api

Public functions of the ParmEd-based force-field import.

Summary

Functions:

import_parmed

Imports ParmEd, which is an optional dependency.

load_structure

Loads a parametrized structure with ParmEd.

parm2pq

Converts an AMBER, CHARMM or GROMACS force field into PQ setup files.

Reference

import_parmed() → Any[source]

Imports ParmEd, which is an optional dependency.

Returns:

The parmed module.

Return type:

module

Raises:

ImportError – If ParmEd is not installed.

load_structure(
topology_file: str | Path,
coordinate_file: str | Path | None = None,
parameter_files: Sequence[str | Path] = (),
) → Any[source]

Loads a parametrized structure with ParmEd.

Parameters:
  • topology_file (str | Path) – AMBER prmtop, GROMACS top or CHARMM psf file.

  • coordinate_file (str | Path | None, optional) – Coordinates (inpcrd/rst7, gro, crd, pdb, …), by default None.

  • parameter_files (Sequence[str | Path], optional) – CHARMM parameter and stream files (prm, rtf, str), needed for a psf topology, by default ().

Returns:

The structure with parameters and, if given, coordinates.

Return type:

parmed.Structure

Raises:

Parm2PQError – If a psf topology is given without parameter files.

parm2pq(
topology_file: str | Path,
coordinate_file: str | Path | None = None,
parameter_files: Sequence[str | Path] = (),
output_dir: str | Path = '.',
shake_h: bool = False,
rcoulomb: Real = 12.0,
overwrite: bool = False,
long_range: str | None = None,
) → PQForceFieldSetup[source]

Converts an AMBER, CHARMM or GROMACS force field into PQ setup files.

The function writes moldescriptor.dat, topology.top, parameter.prm, intra_nonbonded.dat, start.rst and the input snippet pq_input.in into output_dir, and mshake.dat if shake_h keeps rigid water rigid with M-SHAKE.

Parameters:
  • topology_file (str | Path) – AMBER prmtop, GROMACS top or CHARMM psf file.

  • coordinate_file (str | Path | None, optional) – The coordinates; required unless the topology contains them.

  • parameter_files (Sequence[str | Path], optional) – CHARMM parameter and stream files for a psf topology.

  • output_dir (str | Path, optional) – The output directory, by default the working directory.

  • shake_h (bool, optional) – Constrain bonds to hydrogen with SHAKE, by default False. Rigid three-site water (with an H-H bond) gets M-SHAKE instead.

  • rcoulomb (float, optional) – The Coulomb cutoff in Angstrom for the input snippet and the vacuum box of a structure without box, by default 12.0.

  • overwrite (bool, optional) – Replace existing output files, by default False.

  • long_range (str | None, optional) – The long-range Coulomb method for the input snippet (none, wolf or reaction-field), by default wolf for a box from the input and none for a vacuum box.

Returns:

The converted setup.

Return type:

PQForceFieldSetup

Raises:
  • UnsupportedForceFieldTermError – If the force field contains a term PQ cannot evaluate.

  • Parm2PQError – If the input cannot be converted or long_range is unknown.

  • FileExistsError – If an output file exists and overwrite is False.