pycgtool.mapping
¶
This module contains classes required to perform an atomistic to coarse-grain mapping.
The Mapping class contains a dictionary of lists of BeadMaps. Each list corresponds to a single molecule.
Module Contents¶
Classes¶
Class holding values relating to the AA->CG transformation for a single bead. |
|
Class holding values relating to the AA->CG transformation for a single bead. |
|
Class used to perform the AA->CG mapping. |
Functions¶
|
Calculate the coordinates of a single CG bead from weighted component atom coordinates. |
Attributes¶
-
pycgtool.mapping.
logger
¶
-
pycgtool.mapping.
PathLike
¶
-
class
pycgtool.mapping.
BeadMap
(name: str, num: int, type: str = None, atoms=None, charge: float = 0, mass: float = 0)[source]¶ Class holding values relating to the AA->CG transformation for a single bead.
-
class
pycgtool.mapping.
VirtualMap
(name, num, type=None, atoms=None, charge=0)[source]¶ Bases:
BeadMap
Class holding values relating to the AA->CG transformation for a single bead.
-
class
pycgtool.mapping.
Mapping
(filename: PathLike, options, itp_filename: Optional[PathLike] = None)[source]¶ Class used to perform the AA->CG mapping.
Contains a dictionary of lists of BeadMaps. Each list corresponds to a single molecule.
-
_load_itp
(self, itp_filename: str) → None[source]¶ Load mass and charge of atoms in mapping from a GROMACS itp topology file.
- Parameters
itp_filename – ITP file to read
-
static
_itp_section_into_mol_map
(mol_map: List[BeadMap], itp_mol_entry, manual_charges: bool) → None[source]¶
-
_rename_atoms
(self) → None[source]¶ Rename residues and atoms in mapping according to MDTraj conventions.
This means that users can create mappings using the same names as are in the input topology file and not have this broken by MDTraj renaming the residues and atoms.
-
_cg_frame_setup
(self, aa_residues: Iterable[mdtraj.core.topology.Residue])[source]¶ Create a new CG Frame and populate beads :param aa_residues: Iterable of atomistic residues to map from :return: New CG Frame instance
-
apply
(self, frame: pycgtool.frame.Frame, cg_frame: Optional[pycgtool.frame.Frame] = None)[source]¶ Apply the AA->CG mapping to an atomistic Frame.
- Parameters
frame – Frame to which mapping will be applied
cgframe – CG Frame to remap - optional
- Returns
Frame instance containing the CG frame
-
-
pycgtool.mapping.
calc_coords_weight
(ref_coords, coords, weights, box=None)[source]¶ Calculate the coordinates of a single CG bead from weighted component atom coordinates.
- Parameters
ref_coords – Coordinates of reference atom, usually first atom in bead
coords – Array of coordinates of component atoms
weights – Array of atom weights, must sum to 1
box – PBC box vectors
- Returns
Coordinates of CG bead