.. _05_input_output: .. include:: ../../examples/05_input_output/README.rst ---- .. code-block:: python from eminus import Atoms, read, SCF from eminus.units import bohr2ang Some file standards are supported to be read from .. code-block:: python atom, pos = read("CH4.xyz") To immediately create an :code:`Atoms` object you can do the following .. code-block:: python atoms = Atoms(*read("CH4.xyz")) CUBE files are supported as well Here, lattice information and field information are given as well .. code-block:: python atom, pos, Z, a, s, field = read("CH4.cube") Create an :code:`Atoms` object with it and start a DFT calculation .. code-block:: python atoms = Atoms(atom=atom, pos=pos, a=a) atoms.s = s scf = SCF(atoms) scf.run() Write the total density to a CUBE file, e.g., to visualize it .. code-block:: python scf.write("CH4_density.cube", scf.n) Please note that XYZ files will use Angstrom as length units CUBE files have no standard, but atomic units will be assumed Units can always be converted using the unit conversion functionality .. code-block:: python print(f"\nMethane coordinates in Bohr:\n{pos}") print(f"\nMethane coordinates in Angstrom:\n{bohr2ang(pos)}") You can also save the :code:`Atoms` or :code:`SCF` object directly to load them later :code:`read` and :code:`write` are unified functions that determine the corresponding function using the file ending .. code-block:: python atoms.write("CH4") atoms = read("CH4.json") Download :download:`05_input_output.py <../../examples/05_input_output/05_input_output.py>` :download:`CH4.cube <../../examples/05_input_output/CH4.cube>` :download:`CH4.xyz <../../examples/05_input_output/CH4.xyz>`