pmmoto.particles package

Initialize the particles subpackage for PMMoTo.

pmmoto.particles.convert_atoms_elements_to_ids(atom_elements: list[str]) ndarray[Any, dtype[integer[Any]]]

Convert a list of atom names (C, H, N, O, etc.) to atomic IDs.

Parameters:

atom_elements (List[str]) – List of atom element names.

Returns:

Array of atomic numbers.

Return type:

np.ndarray

pmmoto.particles.initialize_atoms(subdomain: Subdomain | PaddedSubdomain | VerletSubdomain, atom_coordinates: NDArray[np.floating[Any]], atom_radii: NDArray[np.floating[Any]], atom_ids: NDArray[np.integer[Any]], atom_masses: None | NDArray[np.integer[Any]] = None, by_type: bool = False, add_periodic: bool = False, set_own: bool = True, trim_intersecting: bool = False, trim_within: bool = False) AtomMap

Initialize a list of particles efficiently with memory management.

Parameters:
  • subdomain – Domain subdivision object.

  • atom_coordinates (np.ndarray) – Array of shape (n_atoms, 3) with xyz coordinates.

  • atom_radii (dict or np.ndarray) – Dictionary of atom types to radii or array.

  • atom_ids (np.ndarray) – Array of atom type IDs.

  • atom_masses (dict, optional) – Dictionary of atom masses.

  • by_type (bool, optional) – Whether to organize atoms by type.

  • add_periodic (bool, optional) – Add periodic images at boundaries.

  • set_own (bool, optional) – Mark particles owned by this subdomain.

  • trim_intersecting (bool, optional) – Remove particles intersecting boundary.

  • trim_within (bool, optional) – Remove particles fully within boundary.

Returns:

Python Class that wraps atoms. See _particles.pyx.

Return type:

object

pmmoto.particles.initialize_spheres(subdomain: Subdomain | PaddedSubdomain | VerletSubdomain, spheres: NDArray[np.floating[Any]], radii: None | NDArray[np.floating[Any]] = None, add_periodic: bool = False, set_own: bool = True, trim_intersecting: bool = False, trim_within: bool = False) PySphereList

Initialize a list of spheres.

Particles that do not cross the subdomain boundary are deleted. If add_periodic: particles that cross the domain boundary will be added. If set_own: particles owned by a subdomain will be identified.

Parameters:
  • subdomain – Domain subdivision object.

  • spheres (np.ndarray) – Array of sphere positions and radii.

  • radii (np.ndarray, optional) – Array of radii if not included in spheres.

  • add_periodic (bool, optional) – Add periodic images at boundaries.

  • set_own (bool, optional) – Mark particles owned by this subdomain.

  • trim_intersecting (bool, optional) – Remove particles intersecting boundary.

  • trim_within (bool, optional) – Remove particles fully within boundary.

Returns:

Python Class that wraps spheres. See _particles.pyx.

Return type:

AtomMap

pmmoto.particles.uff_radius(atom_names: None | list[str] = None, atomic_numbers: None | list[int] = None) dict[int, float]

Collect the radius by Atom Name or Atomic Number, but not both.

Units of radii are Angstroms!

Parameters:
  • atom_names (List[str], optional) – List of element names.

  • atomic_numbers (List[int], optional) – List of atomic numbers.

Returns:

Dictionary mapping atomic numbers to their radii.

Return type:

Dict[int, float]

Raises:

ValueError – If both or neither atom_names and atomic_numbers are provided.

Submodules

pmmoto.particles.atom_universal_force_field module

Universal force field atom radii data for PMMoTo.

Provides a dictionary mapping element names or atomic numbers to (atomic_number, radius) pairs, where radius is sigma/2 in Angstroms.

pmmoto.particles.atom_universal_force_field.atom_universal_force_field() dict[str | int, tuple[int, float]]

Return universal force field data for atom radii.

Provides a dictionary mapping element names or atomic numbers to (atomic_number, sigma/2) pairs, sigma is in Angstroms

and divided by 2 to yield radius.

Data source: https://github.com/SarkisovGitHub/PoreBlazer/blob/main/src/UFF.atoms

Returns:

Mapping of element names or atomic numbers to (atomic_number, radius).

Return type:

dict

pmmoto.particles.particles module

particles.py

Particle initialization and utility functions for PMMoTo.

pmmoto.particles.particles.convert_atoms_elements_to_ids(atom_elements: list[str]) ndarray[Any, dtype[integer[Any]]]

Convert a list of atom names (C, H, N, O, etc.) to atomic IDs.

Parameters:

atom_elements (List[str]) – List of atom element names.

Returns:

Array of atomic numbers.

Return type:

np.ndarray

pmmoto.particles.particles.initialize_atoms(subdomain: Subdomain | PaddedSubdomain | VerletSubdomain, atom_coordinates: NDArray[np.floating[Any]], atom_radii: NDArray[np.floating[Any]], atom_ids: NDArray[np.integer[Any]], atom_masses: None | NDArray[np.integer[Any]] = None, by_type: bool = False, add_periodic: bool = False, set_own: bool = True, trim_intersecting: bool = False, trim_within: bool = False) AtomMap

Initialize a list of particles efficiently with memory management.

Parameters:
  • subdomain – Domain subdivision object.

  • atom_coordinates (np.ndarray) – Array of shape (n_atoms, 3) with xyz coordinates.

  • atom_radii (dict or np.ndarray) – Dictionary of atom types to radii or array.

  • atom_ids (np.ndarray) – Array of atom type IDs.

  • atom_masses (dict, optional) – Dictionary of atom masses.

  • by_type (bool, optional) – Whether to organize atoms by type.

  • add_periodic (bool, optional) – Add periodic images at boundaries.

  • set_own (bool, optional) – Mark particles owned by this subdomain.

  • trim_intersecting (bool, optional) – Remove particles intersecting boundary.

  • trim_within (bool, optional) – Remove particles fully within boundary.

Returns:

Python Class that wraps atoms. See _particles.pyx.

Return type:

object

pmmoto.particles.particles.initialize_cylinders(subdomain: Subdomain | PaddedSubdomain | VerletSubdomain, cylinders: NDArray[np.floating[Any]]) PyCylinderList

Initialize a list of cylindersd

Parameters:
Returns:

_description_

Return type:

PyCylinderList

pmmoto.particles.particles.initialize_spheres(subdomain: Subdomain | PaddedSubdomain | VerletSubdomain, spheres: NDArray[np.floating[Any]], radii: None | NDArray[np.floating[Any]] = None, add_periodic: bool = False, set_own: bool = True, trim_intersecting: bool = False, trim_within: bool = False) PySphereList

Initialize a list of spheres.

Particles that do not cross the subdomain boundary are deleted. If add_periodic: particles that cross the domain boundary will be added. If set_own: particles owned by a subdomain will be identified.

Parameters:
  • subdomain – Domain subdivision object.

  • spheres (np.ndarray) – Array of sphere positions and radii.

  • radii (np.ndarray, optional) – Array of radii if not included in spheres.

  • add_periodic (bool, optional) – Add periodic images at boundaries.

  • set_own (bool, optional) – Mark particles owned by this subdomain.

  • trim_intersecting (bool, optional) – Remove particles intersecting boundary.

  • trim_within (bool, optional) – Remove particles fully within boundary.

Returns:

Python Class that wraps spheres. See _particles.pyx.

Return type:

AtomMap

pmmoto.particles.particles.uff_radius(atom_names: None | list[str] = None, atomic_numbers: None | list[int] = None) dict[int, float]

Collect the radius by Atom Name or Atomic Number, but not both.

Units of radii are Angstroms!

Parameters:
  • atom_names (List[str], optional) – List of element names.

  • atomic_numbers (List[int], optional) – List of atomic numbers.

Returns:

Dictionary mapping atomic numbers to their radii.

Return type:

Dict[int, float]

Raises:

ValueError – If both or neither atom_names and atomic_numbers are provided.