ASE and PLAMS

ASE Atoms

ChemicalSystem instances can be convert to and from the ase.Atoms class that is part of the Atomic Simulation Environment:

ChemicalSystem.to_ase_atoms() Atoms

Converts a ChemicalSystem to an ase.Atoms instance.

Calling this method may throw an ImportError if the ase package can not be found in your Python environment.

Handles coordinates, atomic numbers, and lattice vectors (if present). The order of atoms is preserved. The systems total charge is saved as the charge entry in the info dictionary of the returned instance. All other molecular and atomic attributes, bonds, regions and the atom selection is lost in the conversion.

classmethod ChemicalSystem.from_ase_atoms(ase_atoms: Atoms) ChemicalSystem

Converts an ase.Atoms instance to a ChemicalSystem.

Calling this method may throw an ImportError if the ase package can not be found in your Python environment.

Handles coordinates, atomic numbers, and lattice vectors (if present). The order of atoms is preserved. If the info dictionary of the Atoms instance contains an entry charge, it is used as the ChemicalSystem’s total charge. All other molecular or atomic attributes, as well as the ASE calculator derived properties, such as forces or calculated charges are lost in the conversion.

Note that the used lattice vectors from the ase.Atoms object are those for which get_pbc is set to True. Those should already conform to the AMS convention of having the first lattice vector along the x-axis and the second vector in the xy-plane. A ChemicalSystemError will be thrown if that is not the case.

PLAMS Molecule

ChemicalSystems can PLAMS’ molecules can be converted into each other using the following conversion functions: scm.utils.conversions.plams_molecule_to_chemsys and scm.utils.conversions.chemsys_to_plams_molecule.

Example:

from scm.libbase import ChemicalSystem
from scm.plams import from_smiles, Molecule
from scm.utils.conversions import plams_molecule_to_chemsys, chemsys_to_plams_molecule

# Create a PLAMS molecule from a SMILES string:
plams_molecule = from_smiles('CCO')

# Convert from a PLAMS molecule to a ChemicalSystem:
chemical_system = plams_molecule_to_chemsys(plams_molecule)

# Convert back from ChemicalSystem to a PLAMS molecule:
plams_molecule = chemsys_to_plams_molecule(chemical_system)