Molecular Dynamics Extension#
The molecular_dynamics extension provides a set of tools to help with various tasks related to running molecular dynamics simulations from BuildAMol Molecules. Currently, it provides the following sub-packages:
The solvate package provides the solvate function that can be used to create a solvation box around a molecule. It can use the following backend softwares to create the solvation box (requires the respective software to be installed):
Backend Settings
Biobb Amber Backend
PDBFixer Backend
The atom_typing package provides a base-class AtomTyper class that can be used to assign atom types to a molecule. It also implements a CHARMMTyper class as an example class.
Base Atom Typer
- class buildamol.extensions.molecular_dynamics.atom_typing.atom_typer.AtomTyper(_dict=None)[source]#
Bases:
objectA base class to assign atom types to atoms in a molecule based on reference data
- assign_attribute(atom_or_higher, attribute: str)[source]#
Assign an attribute on one or more atoms based on the atom type data
- assign_charges(atom_or_higher)[source]#
Assign the “pqr_charge” attribute on one or more atoms based on the atom type data
- assign_types(atom_or_higher)[source]#
Assign a “type” attribute on one or more atoms based on the atom type data
- atom_key(atom: Atom)[source]#
The atom key to locate the reference data for a given atom in the dictionary Each subclass should implement this method to return an appropriate key for the dictionary
- get_data(atom: Atom) dict[source]#
Get the atom type data for a given atom
- Parameters:
atom (Atom) – The atom for which the type data is requested
- Returns:
The atom type data
- Return type:
dict
- get_type(atom: Atom) str[source]#
Get the atom type for a given atom
- Parameters:
atom (Atom) – The atom for which the type is requested
- Returns:
The atom type
- Return type:
str
- prepare_dict_for(atom_or_higher) dict[source]#
Prepare a dictionary with atom types for one or more atoms which can be added to the atom typer dictionary
- Return type:
dict
- set_data(atom: Atom, data: dict)[source]#
Set the atom type data for a given atom
- Parameters:
atom (Atom) – The atom for which the type data is set
data (dict) – The atom type data
CHARMM Typer
- class buildamol.extensions.molecular_dynamics.atom_typing.charmm_typer.CHARMMTyper(_dict=None)[source]#
Bases:
AtomTyperA class to assign CHARMM atom types to atoms in a molecule based on a CHARMM Topology file This requires that the molecule has residue names and atom names match with those in the CHARMM Topology file
- atom_key(atom)[source]#
The atom key to locate the reference data for a given atom in the dictionary Each subclass should implement this method to return an appropriate key for the dictionary
- classmethod from_file(filename: str)[source]#
Create a CHARMMTyper object from a CHARMM Topology file
- Parameters:
filename (str) – The filename of the CHARMM Topology file
- Returns:
The CHARMMTyper object
- Return type:
- property residue_names: list#
Get the residue names in the CHARMM Topology file
- Returns:
The residue names
- Return type:
list
The psf module works with the atom_typing package to generate a PSF file for a molecule.
- class buildamol.extensions.molecular_dynamics.psf.PSFMaker(atom_typer=None)[source]#
Bases:
objectA class to generate a PSF file from a molecule
- Parameters:
atom_typer (AtomTyper, optional) – The atom typer, by default None. If None, the atom type, mass, and charge must all be set as attributes of the atoms in the molecule.
- encode_psf(molecule, angles: bool = False, dihedrals: bool = False) str[source]#
Encode a the content for a PSF file from a molecule
- Parameters:
molecule (Molecule) – The molecule
angles (bool, optional) – Whether to include angle information, by default False
dihedrals (bool, optional) – Whether to include dihedral information, by default False
- Returns:
The PSF content
- Return type:
str
- write_psf(molecule, filename: str, angles: bool = False, dihedrals: bool = False)[source]#
Write a PSF file from a molecule
- Parameters:
molecule (Molecule) – The molecule
filename (str) – The filename of the PSF file
angles (bool, optional) – Whether to include angle information, by default False
dihedrals (bool, optional) – Whether to include dihedral information, by default False
- buildamol.extensions.molecular_dynamics.psf.write_psf(molecule, filename: str, angles=False, dihedrals=False, _atom_typer=None)[source]#
Write a PSF file from a molecule
- Parameters:
molecule (Molecule) – The molecule
filename (str) – The filename of the PSF file
angles (bool, optional) – Whether to include angle information, by default False
dihedrals (bool, optional) – Whether to include dihedral information, by default False
_atom_typer (AtomTyper, optional) – The atom typer, by default None. If None, the atom type, mass, and charge must all be set as attributes of the atoms in the molecule.