mooonpy.molspace.topology module

..note:: the keys usef for all of these classes use the ordering rules below,
so only 1 permutation is saved or searched for, and the original order is saved in the ‘ordered’ attribute,
  • Bonds: key = (id1, id2) # id1 < id2

  • Angles: key = (id1, id2, id3) # id1 < id3

  • Dihedrals: key = (id1, id2, id3, id4) # id1 < id4

  • Impropers: key = (id1, id2, id3, id4) # id1 < id3 < id4 # center atom is always id2, sort others

..TODO:: methods for safe lookup and __set__ with autocorrected order - 7-Jul-25

class mooonpy.molspace.topology.Angles(**kwargs)[source]

Bases: dict

angle_factory()[source]
copy(deepcopy=False)[source]

Return a fully independent copy of this topology container (independence verified in tests/test_molspace_copy.py).

The factory class and defaults are frozen, so the copy references the SAME factory instance by design; value objects are rebuilt fresh.

Parameters:

deepcopy – if True, use the copy.deepcopy fallback (same result, ~7-8x slower; for cross-checking only).

id_get(id1, id2, id3)[source]
id_set(value, id1, id2, id3)[source]
key_rule(id1, id2, id3)[source]
class mooonpy.molspace.topology.Bonds(**kwargs)[source]

Bases: dict

bond_factory()[source]
copy(deepcopy=False)[source]

Return a fully independent copy of this topology container (independence verified in tests/test_molspace_copy.py).

The factory class and defaults are frozen, so the copy references the SAME factory instance by design; value objects are rebuilt fresh.

Parameters:

deepcopy – if True, use the copy.deepcopy fallback (same result, ~7-8x slower; for cross-checking only).

id_get(id1, id2)[source]
id_set(value, id1, id2)[source]
key_rule(id1, id2)[source]
new(id1, id2, **kwargs)[source]
class mooonpy.molspace.topology.Dihedrals(**kwargs)[source]

Bases: dict

copy(deepcopy=False)[source]

Return a fully independent copy of this topology container (independence verified in tests/test_molspace_copy.py).

The factory class and defaults are frozen, so the copy references the SAME factory instance by design; value objects are rebuilt fresh.

Parameters:

deepcopy – if True, use the copy.deepcopy fallback (same result, ~7-8x slower; for cross-checking only).

dihedral_factory()[source]
id_get(id1, id2, id3, id4)[source]
id_set(value, id1, id2, id3, id4)[source]
key_rule(id1, id2, id3, id4)[source]
class mooonpy.molspace.topology.Impropers(**kwargs)[source]

Bases: dict

copy(deepcopy=False)[source]

Return a fully independent copy of this topology container (independence verified in tests/test_molspace_copy.py).

The factory class and defaults are frozen, so the copy references the SAME factory instance by design; value objects are rebuilt fresh.

Parameters:

deepcopy – if True, use the copy.deepcopy fallback (same result, ~7-8x slower; for cross-checking only).

id_get(id1, id2, id3, id4)[source]
id_set(value, id1, id2, id3, id4)[source]
improper_factory()[source]
key_rule(id1, id2, id3, id4)[source]