topo_metrics.io.lmp#

Attributes#

RingLocalLink

Ring-local link:

GlobalLink

Global link:

Classes#

Functions#

cycle_edges(→ list[tuple[int, int]])

set_types_by_ring_and_element(→ dict[tuple[int, str], int])

Assign LAMMPS atom types so that each (ring_index, element_symbol) is a

adjacency_to_ase_bonds_array(→ numpy.ndarray)

pack_rings_to_ase(→ PackedRings)

Packs a sequence of RingGeometry into a single ASE Atoms object.

add_ring_bonds_for_lammps_full(, links_global, ...)

Mutates packed.atoms in-place and returns it.

write_rings_lammps_full(, links_global, masses)

Returns PackedRings for debugging (atom ordering, ring index ranges).

Module Contents#

Ring-local link:

(ri, li, rj, lj, bond_type)

where ri, rj are ring indices (0-based), li, lj are local indices within the rings (0-based), and bond_type is the LAMMPS bond type integer.

Global link:

(gi, gj, bond_type)

where gi, gj are global atom indices (0-based), and bond_type is the LAMMPS bond type integer.

class topo_metrics.io.lmp.PackedRings[source]#
atoms: ase.Atoms[source]#
ring_ranges: list[range][source]#
ring_species: list[str][source]#
topo_metrics.io.lmp.cycle_edges(indices_0based: Sequence[int]) list[tuple[int, int]][source]#
topo_metrics.io.lmp.set_types_by_ring_and_element(packed: PackedRings) dict[tuple[int, str], int][source]#

Assign LAMMPS atom types so that each (ring_index, element_symbol) is a unique type.

Returns:

mapping[(ring_idx, symbol)] = type_id (type_id is 1-based)

topo_metrics.io.lmp.adjacency_to_ase_bonds_array(neigh: list[list[tuple[int, int]]]) numpy.ndarray[source]#
topo_metrics.io.lmp.pack_rings_to_ase(rings: Sequence, *, cell: numpy.ndarray | None = None, pbc: bool | tuple[bool, bool, bool] = False, images: numpy.ndarray | None = None, image_convention: str = 'subtract') PackedRings[source]#

Packs a sequence of RingGeometry into a single ASE Atoms object.

topo_metrics.io.lmp.add_ring_bonds_for_lammps_full(packed: PackedRings, *, ring_bond_type: int | Sequence[int] = 1, links_ring_local: Iterable[RingLocalLink] = (), links_global: Iterable[GlobalLink] = (), mol_ids: Sequence[int] | None = None, charges: Sequence[float] | None = None) ase.Atoms[source]#

Mutates packed.atoms in-place and returns it.

topo_metrics.io.lmp.write_rings_lammps_full(rings: Sequence, filepath: str, *, cell: numpy.ndarray | None = None, pbc: bool | tuple[bool, bool, bool] = False, images: numpy.ndarray | None = None, image_convention: str = 'subtract', ring_bond_type: int | Sequence[int] = 1, links_ring_local: Iterable[RingLocalLink] = (), links_global: Iterable[GlobalLink] = (), masses: bool = True) PackedRings[source]#

Returns PackedRings for debugging (atom ordering, ring index ranges).