ASE interface¶
“The Atomic Simulation Environment (ASE) is a set of tools and Python modules for setting up, manipulating, running, visualizing and analyzing atomistic simulations.
The PLAMS interface to ASE is limited to handling Molecule objects.
It features access to the ase.io module for reading/writing Molecule objects and two functions that translate PLAMS Molecule objects into ASE Atoms objects and vice versa.
Please refer to the ASE documentation to see what can be done with ASE Atoms and its I/O module.
-
toASE(molecule, set_atomic_charges=False)[source]¶ Convert a PLAMS
Moleculeto an ASE molecule (ase.Atomsinstance). Translate coordinates, atomic numbers, and lattice vectors (if present). The order of atoms is preserved.- set_atomic_charges: bool
If True, set_initial_charges() will be called with the average atomic charge (taken from molecule.properties.charge). The purpose is to preserve the total charge, not to set any reasonable initial charges.
-
fromASE(molecule, properties=None, set_charge=False)[source]¶ Convert an ASE molecule to a PLAMS
Molecule. Translate coordinates, atomic numbers, and lattice vectors (if present). The order of atoms is preserved.Pass a
Settingsinstance through thepropertiesoption to inherit them to the returned molecule.
-
class
Molecule[source]¶ Additional reader and writer for
Moleculeclass:-
readase(f, **other)¶ Read Molecule using ASE engine
The
readfunction of theMoleculeclass passes a file descriptor into here, so in this case you must specify the format to be read by ASE:mol = Molecule('file.cif', inputformat='ase', format='cif')
The ASE Atoms object then gets converted to a PLAMS Molecule and returned. All other options are passed to
ASE.io.read(). See https://wiki.fysik.dtu.dk/ase/ase/io/io.html on how to use it.Note
The nomenclature of PLAMS and ASE is incompatible for reading multiple geometries, make sure that you only read single geometries with ASE! Reading multiple geometries is not supported, each geometry needs to be read individually.
-
writease(f, **other)¶ Write molecular coordinates using ASE engine.
The
writefunction of theMoleculeclass passes a file descriptor into here, so in this case you must specify the format to be written by ASE. All other options are passed toASE.io.write(). See https://wiki.fysik.dtu.dk/ase/ase/io/io.html on how to use it.These two write the same content to the respective files:
molecule.write('filename.anyextension', outputformat='ase', format='gen') molecule.writease('filename.anyextension', format='gen')
-