porereax.bond_length

Module for sampling bond lengths and bond orders.

The module provides BondLengthSampler to sample bond length histograms (in Angstroms) or ReaxFF bond order histograms for specified bonds.

Classes

BondLengthSampler(name_out, bonds, ...)

Sampler class for bond lengths and bond orders.

class porereax.bond_length.BondLengthSampler(name_out, bonds, dimension, region, process_id, atom_lib, masses, num_frames, box, system_properties, num_bins, range)[source]

Bases: BondSampler

Sampler class for bond lengths and bond orders.

Parameters:
  • name_out (str) – Name of the output file of the sampler data

  • bonds (list) –

    List of bonds to sample, each specified as a dictionary with keys:

    • ”bond”: str, the bond in format “A-B”

    • ”bonds_A”: list, optional, list of bonded atom types for atom A. Each entry may be a plain atom type string or a nested dictionary describing a required bonding environment for that neighbour, see “bonds” in AtomSampler, including “X” as a wildcard atom type.

    • ”bonds_B”: list, optional, list of bonded atom types for atom B, with the same nested-dictionary support as “bonds_A”.

  • dimension (str) – Dimension along which to sample.

  • region (Region) – Region specification for sampling. Can be a string defining a geometric region or a function that takes coordinates and returns a boolean mask.

  • process_id (int) – Process ID for parallel processing.

  • atom_lib (dict) – Dictionary mapping atom type strings to their type IDs.

  • masses (dict) – Dictionary mapping atom type strings to their masses.

  • num_frames (int) – Total number of frames to sample.

  • box (ndarray) – Simulation box dimensions.

  • system_properties (dict | None) – System properties for sampling, if applicable.

  • num_bins (int) – Number of bins for histogram sampling.

  • range (tuple) – Range (min, max) for histogram sampling.

sample(frame_id, molecule_mask, molecule_bond_atoms, bond_mask, frame, bond_enum, positions_transformed)[source]

Sample data for the current frame.

Parameters:
  • frame_id (int) – Frame index in perspective of the subprocess (starts from 0 for each subprocess).

  • molecule_mask (dict) – Dictionary mapping molecule identifiers to boolean masks indicating which atoms belong to that molecule in the frame.

  • molecule_bond_atoms (dict) – Dictionary mapping molecule identifiers to their bonded atom indices in the frame.

  • bond_mask (dict) – Dictionary mapping bond identifiers to boolean masks indicating which bonds belong to that identifier in the frame.

  • frame (object) – Current frame object from OVITO containing atomic data.

  • bond_enum (object) – OVITO BondsEnumerator object for enumerating bonds in the frame.

  • positions_transformed (ndarray) – Transformed positions of atoms in the current frame.