atompack.ase_bridge¶
ASE conversion helpers for atompack.
Functions¶
|
Convert an atompack molecule to |
|
Convert many atompack molecules to ASE Atoms efficiently. |
|
Convert one ASE Atoms object to an atompack Molecule. |
|
Write many ASE Atoms objects efficiently, preserving supported metadata. |
Module Contents¶
- atompack.ase_bridge.to_ase(molecule, *, attach_calc=True, calc_mode='singlepoint', copy_info=True, copy_arrays=True)[source]¶
Convert an atompack molecule to
ase.Atoms.The conversion reads directly from the molecule getters, so it works for both owned and view-backed molecules without going through
molecule.atoms(). That keeps the path compatible with lazy SOA-backed molecules, although ASE object creation still requires Python/NumPy allocations.Mapping rules:
positionsandatomic_numbersalways become the ASE geometry.cellandpbcare copied when present.velocitiesare attached withatoms.set_velocities(...).energy,forces,stress, andchargesare attached through an ASE calculator whenattach_calc=True.calc_mode="singlepoint"preserves ASE’s snapshot semantics, whilecalc_mode="nocopy"is faster but does not snapshot the atoms state.Custom properties shaped like per-atom arrays are stored in
atoms.arrayswhencopy_arrays=True.Remaining custom properties are stored in
atoms.infowhencopy_info=True.
Parameters¶
- moleculeatompack.Molecule
Molecule to convert.
- attach_calcbool, default=True
Attach supported builtin results through an ASE calculator.
- calc_mode{“singlepoint”, “nocopy”, “none”}, default=”singlepoint”
Calculator attachment mode.
"singlepoint"uses ASE’s standard snapshotting calculator,"nocopy"skips the internal atoms copy for higher throughput, and"none"suppresses calculator attachment.- copy_infobool, default=True
Copy non-array custom properties into
atoms.info.- copy_arraysbool, default=True
Copy per-atom custom arrays into
atoms.arrays.
Returns¶
- ase.Atoms
Converted ASE object.
- atompack.ase_bridge.to_ase_batch(source, indices=None, *, attach_calc=True, calc_mode='singlepoint', copy_info=True, copy_arrays=True)[source]¶
Convert many atompack molecules to ASE Atoms efficiently.
- atompack.ase_bridge.from_ase(atoms, energy=None, forces=None, charges=None, velocities=None, cell=None, stress=None, copy_info=True, copy_arrays=True, info=None)[source]¶
Convert one ASE Atoms object to an atompack Molecule.
Custom values from
atoms.info,atoms.arrays, calculator results, and explicitinfo=overrides are stored as molecule-scope properties. Array shape is not used to infer atom-property scope during ingestion.