Module for reading cif files
- class MDMC.readers.configurations.cif.CIF(file_name: str)
A class for reading CIF configuration files
To use a CIF reader to read a file called ‘paracetamol.cif’ and create a
Moleculefrom it (assuming
Moleculehas been imported from
file = 'paracetamol.cif' cif = CIF() cif.open(file) # See parse docstring for description of ``names`` parameter # Lines are oxygen, nitrogen, carbon and hydrogen atoms cif.parse(names=['109', '177', # Oxygens '207', # Nitrogen '208', '108', '90', '178', '90', '90', '90', '185', '85', '85', '85', '91', '91', '91', '91', '183', '110'] ) # Hydrogens) paracetamol = Molecule(atoms=cif.atoms)
- property atoms: list[Atom]
All subclasses must implement atoms, which returns a list of
Atomobjects from the data read from the file
- parse(**settings: dict) None
Reads a configuration file and returns a list of
These Atom objects can optionally have
Coulombicinteractions and also
BondedInteractionobjects if bonded interactions are defined in the CIF file.
atom_typesis passed, then equivalent interactions (
BondedInteraction, if bonded interactions are defined in the CIF file) will be initialized as a single object. For instance if the CIF file includes a benzene ring, then as long as the correct
atom_typesare passed, then there will only be a single C-C
Bondobject, which will include all 6 of the atom pairs. If both
atom_typeswill be used to group
Atomobjects. If neither
atom_typesis passed then each interaction will become a separate object.
Not all CIF files contain bonded interactions (it is only common for biomolecules).
improper dihedrals are not explicitly defined in CIF, so these must be set after initialization of
CIF reader cannot parse CIF files with user defined text sections, so these must be stripped out before reading.
file (file, str) – A
file, or the absolute file name of the configuration file
The index of the configuration in the CIF file. Only a single configuration can be read from a CIF file, with the default being the first (
names(list of str)
A list of
namesfor the atoms in the CIF file. These
namesmust have the same order as the order the atoms in the file. A
namemust be be provided for each atom in the CIF file.
atom_types(list of int)
A list of int for atom types of the atoms in the CIF file. These names must have the same order as the order the atoms in the file. An
atom_typemust be provided for each atom in the CIF file.
A distance (in Ang) at which the
Coulombicinteractions are cutoff. If this is not passed, the
cutoffwill be set to 10.
Whether or not any bonded interactions defined in the CIF file will be included. By default this is True.
Whether or not each atom in the CIF file will be assigned a
Coulombicinteraction with a
Coulombfunction. CIF files do not contain charge information, so the charge of the
Coulombicinteraction will be set to 0. This enables the charges to be set by the application of a
ForceFieldobject. By default this is True.
Atomobjects corresponding to the data in the CIF file
- Return type