atomistics.calculators.lammps.helpers.lammps_get_structure#
- atomistics.calculators.lammps.helpers.lammps_get_structure(structure: Atoms, lmp_instance: LammpsASELibrary, set_velocities: bool = True, scale_atoms: bool = True, set_cell: bool = True) Atoms[source]#
Capture the current cell, positions, and velocities of a live LAMMPS session as a standalone
ase.Atomssnapshot.The returned snapshot can be passed back into
lammps_run(with an input template that does not re-initialise velocities, e.g. omitting theLAMMPS_VELOCITYcommand) to resume the session state later – there is nopylammpsmpiAPI to set velocities on an existing session directly, so a full session rebuild from such a snapshot is the only way to restore them.Chemical symbols are copied unchanged from
structure; callers that need to change species (e.g. after a Monte Carlo swap) should callstructure.set_chemical_symbols(...)before passingstructurein.- Parameters:
structure (Atoms) – Template structure to copy (species, constraints, etc.); its cell, positions, and velocities are overwritten from
lmp_instance.lmp_instance (LammpsASELibrary) – An active LAMMPS library instance.
set_velocities (bool) – Whether to copy velocities from the LAMMPS session. Set to
Falseif the caller intends to re-initialise velocities later.scale_atoms (bool) – Whether to scale atomic positions when setting the cell. Defaults to
Trueto preserve fractional coordinates; set toFalseset_cell (bool) – Whether to copy the cell from the LAMMPS session. Defaults to
True.
- Returns:
A new
Atomssnapshot of the current session state.- Return type:
Atoms