pygen_structures.mol_containers.molecule module¶
Module containing the Molecule class.
This class is used to create CHARMM structures from a list of RESI names, a CHARMMResidueTopologyFile and a dict mapping PRES names to indices of the residues they are to be applied to (or “FIRST”/”LAST”).
Manipulation of 3D coordinates is performed in the Structure class so that 3D functionality can be applied to residue objects.
-
class
pygen_structures.mol_containers.molecule.
Molecule
(name: str = 'Unset', residues: (<class 'list'>, None) = None, topology: (<class 'pygen_structures.charmm_containers.CHARMMResidueTopologyFile'>, None) = None, patches: (typing.Dict[str, typing.List[int]], None) = None, segment: (<class 'str'>, None) = None, fixed_atoms: (typing.Dict[typing.Tuple[int, str], typing.Tuple[float, float, float]], None) = None, use_etkdg: bool = True)¶ Bases:
object
A complete CHARMM molecule. This can be written to PSF and/or PDB
- Parameters
name – The name of the molecule, used in the PSF and PDB.
residues – a list of
CHARMMResidue
topology – the
CHARMMResidueTopologyFile
to provide the patches.patches – a dict of patch names to a list of the residue indices the patch is to be applied to (or “FIRST”/”LAST”) magic strings.
segment – the segment ID to be used when the
Atom
records are created. This must be less than four characters.fixed_atoms – a mapping of
atom_id
to the fixed coordsuse_etkdg – In the structure, when generating coords, use empirical distance generation (if
True
) or a traditional distance generation approach.
The following attributes are set during finalization:
- Parameters
atoms – a list of
Atom
impropers – a list of tuples with
Atom
indices for the PSFcross_maps – a list of tuples with
Atom
indices for the PSFtopology_files – a set of paths to the .rtf/.str files
These are private attributes:
- Parameters
_structure – the underlying
Structure
object_id_to_index – a mapping of
atom_id
to index._finalized –
True
ifMolecule.finalize()
has been called.
-
check_parameters
(parameter_set: pygen_structures.charmm_containers.CHARMMParameterFile) → bool¶ Check if parameters needed by the molecule are present in a parameter set. Returns True if all parameters are present, otherwise false.
- Parameters
parameter_set –
CHARMMParameterFile
- Returns
True
if all parameters are matched
-
finalize
() → None¶ Finalize the molecule, getting it to a state where it can be represented directly as a PDB file or PSF file.
-
classmethod
from_sequence
(sequence: List[str], topology: pygen_structures.charmm_containers.CHARMMResidueTopologyFile, patches: (typing.Dict[str, typing.List[int]], None) = None, name: (<class 'str'>, None) = None, segid: (<class 'str'>, None) = None)¶ Create the Molecule instance from a list of residues, a CHARMM topology file and a list containing patches to be applied.
- Parameters
sequence – a list of CHARMM residues
topology – a
CHARMMResidueTopologyFile
patches – a dict of
CHARMMPatchResidueDefinition
names fromtopology
to the indices of the residue the patch is to be applied to.name – the name of the
Molecule
segid – the segment for the PDB/PDB. Must contain four characters or fewer.
-
get_adjacency_matrix
() → numpy.ndarray¶
-
get_conect_records
() → List[str]¶ Build the PDB CONECT records from the adjacency matrix.
-
to_mol
()¶
-
to_pdb_block
() → str¶ Build the PDB records and return the PDB as a string.
- Returns
PDB block as string
-
to_pdb_file
(pdb_path: str) → None¶ Write the molecule to a PDB file.
- Parameters
pdb_path – path to PDB file.
-
to_psf_block
() → str¶ Build the PSF records and return the PSF as a string.
- Returns
PSF block as string
-
to_psf_file
(psf_path) → None¶ Write the molecule to a PSF file.
- Parameters
psf_path – Path to PSF file.
-
to_structure
() → pygen_structures.mol_containers.structure.Structure¶ Create a
Structure
using information fromatoms
andbonds
- Returns
the generated Structure