pycgtool.bondset
¶
Module containing classes to calculate bonded properties from a Frame.
BondSet contains a dictionary of lists of Bonds. Each list corresponds to a single molecule.
Module Contents¶
Classes¶
Class holding the properties of a single bonded term. |
|
Class used to perform bond measurements in a Frame. |
Attributes¶
-
pycgtool.bondset.
logger
¶
-
pycgtool.bondset.
PathLike
¶
-
class
pycgtool.bondset.
Bond
(atoms: Iterable[str], atom_numbers: Optional[Iterable[int]] = None, func_form=None)[source]¶ Class holding the properties of a single bonded term.
Bond lengths, angles and dihedrals are all equivalent, distinguished by the number of atoms present.
-
class
pycgtool.bondset.
BondSet
(filename: PathLike, options)[source]¶ Class used to perform bond measurements in a Frame.
BondSet contains a dictionary of lists of Bonds. Each list corresponds to a single molecule.
-
static
_create_angles
(mol_bonds)[source]¶ Create angles and dihedrals from bonded topology.
- Parameters
mol_bonds – List of bonds within a molecule to generate angles for
- Returns
List of angle and dihedral bond name tuples
-
get_bonds
(self, mol: str, natoms: int, select: Callable[[Bond], bool] = lambda x: ...) → List[Bond][source]¶ Return list of bonds from molecule containing natoms atoms.
- Parameters
mol (str) – Molecule name
natoms (int) – Number of atoms in bond, i.e. 2 for bond length, 3 for angle, 4 for dihedral
select (function) – Optional lambda, return only bonds for which this is True
- Return List[Bond]
List of bonds
-
get_bond_lengths
(self, mol, with_constr=False)[source]¶ Return list of all bond lengths in molecule. May include constraints.
- Parameters
mol – Molecule name to return bonds for
with_constr – Include constraints?
- Returns
List of bonds
-
get_bond_length_constraints
(self, mol)[source]¶ Return list of all bond length constraints in molecule.
- Parameters
mol – Molecule name to return bonds for
- Returns
List of bonds
-
get_bond_angles
(self, mol, exclude_triangle=True)[source]¶ Return list of all bond angles in molecule.
- Parameters
mol – Molecule name to return bonds for
exclude_triangle – Exclude angles that are part of a triangle?
- Returns
List of bonds
-
get_bond_dihedrals
(self, mol)[source]¶ Return list of all bond dihedrals in molecule.
- Parameters
mol – Molecule name to return bonds for
- Returns
List of bonds
-
get_virtual_beads
(self, mapping)[source]¶ Return list of all virtual beads in molecule :param mapping: :return: list of virtual beads
-
_populate_atom_numbers
(self, mapping)[source]¶ Add atom numbers to all bonds.
Uses previously defined atom names.
- Parameters
mapping – AA->CG mapping used to collect atom/bead numbers
-
write_itp
(self, filename, mapping)[source]¶ Output a GROMACS .itp file containing atoms/beads and bonded terms.
- Parameters
filename – Name of output file
mapping – AA->CG Mapping from which to collect bead properties
-
apply
(self, frame)[source]¶ Calculate bond lengths/angles for all trajectory frames with a Frame instance and store into Bonds.
- Parameters
frame – Frame from which to calculate values
-
boltzmann_invert
(self) → None[source]¶ Perform Boltzmann Inversion of all bonds to calculate equilibrium value and force constant.
-
static
_get_lines_for_bond_dump
(bonds, target_number: Optional[int] = None, rad2deg: bool = False) → List[str][source]¶ Return a dump of bond measurements as a list of lines of text.
- Parameters
bonds – Iterable of bonds
target_number (int) – Sample size of bonds to dump - None will dump all bonds
rad2deg (bool) – Should bond measurements be converted from radians to degrees?
- Return List[str]
Lines of bond measurements dump
-
dump_values
(self, target_number: int = 10000, output_dir: Optional[Union[pathlib.Path, str]] = None) → None[source]¶ Output measured bond values to files for length, angles and dihedrals.
- Parameters
target_number (int) – Approx number of sample measurements to output. If None, all samples will be output.
output_dir – Directory to write output files to.
-
static