mooonpy.molspace.force_field module

class mooonpy.molspace.force_field.Coefficients(keyword, *args, **kwargs)[source]

Bases: dict

class mooonpy.molspace.force_field.ForceField(**kwargs)[source]

Bases: object

coeffs_factory(coeffs=None)[source]
condense_element(atoms, ele_list=None)[source]

Collapse masses to one entry per element and remap every atom.type accordingly.

After Molspace.combine has stitched two systems together, the masses dict typically has duplicate elements at different type ids (e.g. {1: C, 2: H, 3: N, 4: C, 5: H, 6: O}). This method rewrites the table to one entry per element with the new type ids assigned in ele_list order.

Parameters:
  • atoms (Atoms) – Molspace.atoms (or any dict of atom objects with a type attribute) whose type ids will be remapped in place.

  • ele_list (list[str] or None) – Element-symbol order for the output type ids (ele_list[0] becomes type 1, etc.). If None, the elements present in masses are collected and sorted by the mooonpy.molspace.periodic_table ordering.

Raises:

ValueError – If a mass entry’s element is not in ele_list.

Element resolution per existing mass entry: params.element first, then params.comment, then a periodic-table lookup by mass.

Example:

>>> # After combining DETDA (C, H, N) with DGEBF (C, H, O):
>>> mol.ff.condense_element(mol.atoms)
>>> sorted(mol.ff.masses)  # one entry per element, in ptable order
[1, 2, 3, 4]   # C, H, O, N
copy()[source]
elements2mass(atoms, elements=None, change_types=False)[source]

Update masses Coefficients using per-atom element labels :param Atoms: Input Atoms object to loop through :param elements: list of elements to be used (1 indexed in dict output), if None, will loop through atoms and use periodic_table.py ordering :param change_types: Bool, will update each Atom.type with the new type for each element

get_per_line_styles(coeff)[source]
reax(elements=None, dummybond=False)[source]
class mooonpy.molspace.force_field.Parameters(coeffs)[source]

Bases: object

mooonpy.molspace.force_field.class2_dihedral(coeffs, angles)[source]