mooonpy.molspace.molspace module
- class mooonpy.molspace.molspace.Molspace(filename='', **kwargs)[source]
Bases:
object
Initializes a Molspace instance
- This class can be called via:
Full namespace syntax :
mooonpy.molspace.molspace.Molspace()
Aliased namespace syntax :
mooonpy.Molspace()
Initialization Parameters
- filenamestr, optional
An optional filename to read and initialize a Molspace() instance with molecular system information (e.g. atoms, bonds, force field parameters …). Supported file extensions:
LAMMPS datafile
.data
Tripos mol2 file
.mol2
SYBL mol file
.mol
If no filename is provided the Molspace instance will be generated with no molecular system information.
Attributes
- Nint
The order of the filter. For ‘bandpass’ and ‘bandstop’ filters, the resulting order of the final second-order sections (‘sos’) matrix is
2*N
, with N the number of biquad sections of the desired system.- Wnarray_like
The critical frequency or frequencies. For lowpass and highpass filters, Wn is a scalar; for bandpass and bandstop filters, Wn is a length-2 sequence.
Methods
- Nint
The order of the filter. For ‘bandpass’ and ‘bandstop’ filters, the resulting order of the final second-order sections (‘sos’) matrix is
2*N
, with N the number of biquad sections of the desired system.
- add_type_labels(labels)[source]
Adds type labels for atom types and use 1st instance for each BADI type label
could refactor the composition to a function somewhere
- bonds_from_distances(periodicity: str = 'ppp')[source]
Resets the bonds in a molecular system, based in interatomic distances and valences of atoms. The cutoff distances are set based on the summation of vdw radii per element involved in the bond. Each atom’s valence is respected (e.g. the maximum number of allowable bonded atoms to a carbon atom is 4).
- Example:
>>> import mooonpy >>> my_molecule = mooonpy.molspace('detda.data') >>> my_molecule.bonds_from_distances(periodicity='fff')
Note
Before using this command the element per-atom info and element per-mass info need to be updated by running “my_molecule.update_elements()”.
- Parameters:
periodicity (str) – Optional for setting the periodicity of the model, where f=fixed and p=periodic. Each position is a face (e.g. periodicity=’fpp’ is fixed on X-faces and periodic in Y- and Z-faces)
- Returns:
None
- Return type:
None
- compute_BADI_by_type(periodicity='ppp', comp_bond=True, comp_angle=True, comp_dihedral=True, comp_improper=True)[source]
- compute_pairs(cutoff, whitelist=None, blacklist=None, algorithm='DD_13', periodicity='ppp')[source]
Compute pairwise distances within cutoff between atoms
- find_rings(ring_sizes: tuple[int] = (3, 4, 5, 6, 7))[source]
Finds all rings in the current Molspace instance. The size of rings searched for is set in the in the ring_sizes parameter.
- Example:
>>> import mooonpy >>> my_molecule = mooonpy.molspace('detda.mol2') >>> rings = my_molecule.find_rings(ring_sizes=(3,4,5,6,7)) >>> print(rings) [(1, 2, 3, 4, 5, 6)]
Note
Each ring will be sorted in the order it was traversed in the graph and will be in the canonical form (e.g., canonical=(1,2,3) vs non_canonical=(2,3,1)).
- Parameters:
ring_sizes (tuple[int]) – Tuple containing ring sizes to search for in graph
- Returns:
rings
- Return type:
list[tuple[int]]
- update_elements(type2mass=None, type2element=None)[source]
Updates every per-atom .element attribute with the element type for that atom.
- Example:
>>> import mooonpy >>> my_molecule = mooonpy.molspace('detda.data') >>> my_molecule.update_elements()
Note
This will also update the per-mass .element attribute in ff.masses dictionary as well.
- Parameters:
type2mass (dict[int, float]) – Optional for setting the atom type to mass map (e.g. type2mass={1: 12.01115, 2: 1.008}). If not provided this will be generated from the masses section.
type2element (dict[int, str]) – Optional for setting the atom type to mass map (e.g. type2element={1: ‘C’, 2: ‘H’}). If not provided this will be generated from the masses section and interally defined periodic table.
- Returns:
None
- Return type:
None