Format Specific Options

abinit

ase.io.abinit.read_abinit(filename='abinit.in')[source]

Import ABINIT input file.

Reads cell, atom positions, etc. from abinit input file

ase.io.abinit.write_abinit(filename, atoms, cartesian=False, long_format=True)[source]

Method to write abinit input files.

acemolecule-input

ase.io.acemolecule.read_acemolecule_input(filename)[source]

Reads a ACE-Molecule input file :param filename: :type filename: ACE-Molecule input file name

Returns

Return type

ASE atoms object containing geometry only.

acemolecule-out

ase.io.acemolecule.read_acemolecule_out(filename)[source]

Interface to ACEMoleculeReader and return values for corresponding quantity :param filename: :type filename: ACE-Molecule log file. :param quantity: :type quantity: One of atoms, energy, forces, excitation-energy.

Returns

  • - quantity = ‘excitation-energy’ – returns None. This is placeholder function to run TDDFT calculations without IndexError.

  • - quantity = ‘energy’ – returns energy as float value.

  • - quantity = ‘forces’ – returns force of each atoms as numpy array of shape (natoms, 3).

  • - quantity = ‘atoms’ – returns ASE atoms object.

aims

ase.io.aims.read_aims(filename, apply_constraints=True)[source]

Import FHI-aims geometry type files.

Reads unitcell, atom positions and constraints from a geometry.in file.

If geometric constraint (symmetry parameters) are in the file include that information in atoms.info[“symmetry_block”]

ase.io.aims.write_aims(filename, atoms, scaled=False, geo_constrain=False, velocities=False, ghosts=None, info_str=None)[source]

Method to write FHI-aims geometry files.

Writes the atoms positions and constraints (only FixAtoms is supported at the moment).

Parameters
  • filename – str Name of file to output structure to

  • atoms – ase.atoms.Atoms structure to output to the file

  • scaled – bool If True use fractional coordinates instead of Cartesian coordinates

  • symmetry_block – list of str List of geometric constraints as defined in: https://arxiv.org/abs/1908.01610

  • velocities – bool If True add the atomic velocity vectors to the file

  • ghosts – list of Atoms A list of ghost atoms for the system

  • info_str – str A string to be added to the header of the file

aims-output

ase.io.aims.read_aims_output(filename, index=-1)[source]

Import FHI-aims output files with all data available, i.e. relaxations, MD information, force information etc etc etc.

bundletrajectory

ase.io.bundletrajectory.read_bundletrajectory(filename, index=-1)[source]

Reads one or more atoms objects from a BundleTrajectory.

Arguments:

filename: str

The name of the bundle (really a directory!)

index: int

An integer specifying which frame to read, or an index object for reading multiple frames. Default: -1 (reads the last frame).

ase.io.bundletrajectory.write_bundletrajectory(filename, images)[source]

Write image(s) to a BundleTrajectory.

Write also energy, forces, and stress if they are already calculated.

castep-castep

ase.io.castep.read_castep_castep(fd, index=None)[source]

Reads a .castep file and returns an atoms object. The calculator information will be stored in the calc attribute.

There is no use of the “index” argument as of now, it is just inserted for convenience to comply with the generic “read()” in ase.io

Please note that this routine will return an atom ordering as found within the castep file. This means that the species will be ordered by ascending atomic numbers. The atoms witin a species are ordered as given in the original cell file.

Note: This routine returns a single atoms_object only, the last configuration in the file. Yet, if you want to parse an MD run, use the novel function \(read_md()\)

castep-cell

ase.io.castep.read_castep_cell(fd, index=None, calculator_args={}, find_spg=False, units={'Eh': 27.2113845, 'Pascal': 160217653000.0, 'a0': 0.5291772108, 'c': 299792458, 'e': 1.60217653e-19, 'hbar': 6.58211915e-16, 'kB': 8.617343e-05, 'me': 0.00054857990945, 't0': 2.4188843276239763e-17})[source]

Read a .cell file and return an atoms object. Any value found that does not fit the atoms API will be stored in the atoms.calc attribute.

By default, the Castep calculator will be tolerant and in the absence of a castep_keywords.json file it will just accept all keywords that aren’t automatically parsed.

ase.io.castep.write_castep_cell(fd, atoms, positions_frac=False, force_write=False, precision=6, magnetic_moments=None, castep_cell=None)[source]

This CASTEP export function write minimal information to a .cell file. If the atoms object is a trajectory, it will take the last image.

Note that function has been altered in order to require a filedescriptor rather than a filename. This allows to use the more generic write() function from formats.py

Note that the “force_write” keywords has no effect currently.

Parameters
  • positions_frac – boolean. If true, positions are printed as fractional rather than absolute. Default is false.

  • castep_cell – if provided, overrides the existing CastepCell object in the Atoms calculator

  • precision – number of digits to which lattice and positions are printed

  • magnetic_moments – if None, no SPIN values are initialised. If ‘initial’, the values from get_initial_magnetic_moments() are used. If ‘calculated’, the values from get_magnetic_moments() are used. If an array of the same length as the atoms object, its contents will be used as magnetic moments.

castep-geom

ase.io.castep.read_castep_geom(fd, index=None, units={'Eh': 27.2113845, 'Pascal': 160217653000.0, 'a0': 0.5291772108, 'c': 299792458, 'e': 1.60217653e-19, 'hbar': 6.58211915e-16, 'kB': 8.617343e-05, 'me': 0.00054857990945, 't0': 2.4188843276239763e-17})[source]

Reads a .geom file produced by the CASTEP GeometryOptimization task and returns an atoms object. The information about total free energy and forces of each atom for every relaxation step will be stored for further analysis especially in a single-point calculator. Note that everything in the .geom file is in atomic units, which has been conversed to commonly used unit angstrom(length) and eV (energy).

Note that the index argument has no effect as of now.

Contribution by Wei-Bing Zhang. Thanks!

Routine now accepts a filedescriptor in order to out-source the gz and bz2 handling to formats.py. Note that there is a fallback routine read_geom() that behaves like previous versions did.

castep-md

ase.io.castep.read_castep_md(fd, index=None, return_scalars=False, units={'Eh': 27.2113845, 'Pascal': 160217653000.0, 'a0': 0.5291772108, 'c': 299792458, 'e': 1.60217653e-19, 'hbar': 6.58211915e-16, 'kB': 8.617343e-05, 'me': 0.00054857990945, 't0': 2.4188843276239763e-17})[source]

Reads a .md file written by a CASTEP MolecularDynamics task and returns the trajectory stored therein as a list of atoms object.

Note that the index argument has no effect as of now.

castep-phonon

ase.io.castep.read_castep_phonon(fd, index=None, read_vib_data=False, gamma_only=True, frequency_factor=None, units={'Eh': 27.2113845, 'Pascal': 160217653000.0, 'a0': 0.5291772108, 'c': 299792458, 'e': 1.60217653e-19, 'hbar': 6.58211915e-16, 'kB': 8.617343e-05, 'me': 0.00054857990945, 't0': 2.4188843276239763e-17})[source]

Reads a .phonon file written by a CASTEP Phonon task and returns an atoms object, as well as the calculated vibrational data if requested.

Note that the index argument has no effect as of now.

cfg

ase.io.cfg.read_cfg(f)[source]

Read atomic configuration from a CFG-file (native AtomEye format). See: http://mt.seas.upenn.edu/Archive/Graphics/A/

ase.io.cfg.write_cfg(f, a)[source]

Write atomic configuration to a CFG-file (native AtomEye format). See: http://mt.seas.upenn.edu/Archive/Graphics/A/

cif

ase.io.cif.read_cif(fileobj, index, store_tags=False, primitive_cell=False, subtrans_included=True, fractional_occupancies=True, reader='ase')[source]

Read Atoms object from CIF file. index specifies the data block number or name (if string) to return.

If index is None or a slice object, a list of atoms objects will be returned. In the case of index is None or slice(None), only blocks with valid crystal data will be included.

If store_tags is true, the info attribute of the returned Atoms object will be populated with all tags in the corresponding cif data block.

If primitive_cell is true, the primitive cell will be built instead of the conventional cell.

If subtrans_included is true, sublattice translations are assumed to be included among the symmetry operations listed in the CIF file (seems to be the common behaviour of CIF files). Otherwise the sublattice translations are determined from setting 1 of the extracted space group. A result of setting this flag to true, is that it will not be possible to determine the primitive cell.

If fractional_occupancies is true, the resulting atoms object will be tagged equipped with an array \(occupancy\). Also, in case of mixed occupancies, the atom’s chemical symbol will be that of the most dominant species.

String reader is used to select CIF reader. Value \(ase\) selects built-in CIF reader (default), while \(pycodcif\) selects CIF reader based on \(pycodcif\) package.

ase.io.cif.write_cif(fileobj, images, format='default')[source]

Write images to CIF file.

cmdft

ase.io.cmdft.read_cmdft(fileobj)[source]

cp2k-dcd

ase.io.cp2k.read_cp2k_dcd(fileobj, index=-1, ref_atoms=None, aligned=False)[source]

Read a DCD file created by CP2K.

To yield one Atoms object at a time use iread_cp2k_dcd.

Note: Other programs use other formats, they are probably not compatible.

If ref_atoms is not given, all atoms will have symbol ‘X’.

To make sure that this is a dcd file generated with the DCD_ALIGNED_CELL key in the CP2K input, you need to set aligned to True to get cell information. Make sure you do not set it otherwise, the cell will not match the atomic coordinates! See (this discussion)[https://groups.google.com/forum/#!searchin/cp2k/Outputting$20cell$20information$20and$20fractional$20coordinates%7Csort:relevance/cp2k/72MhYykrSrQ/5c9Jaw7S9yQJ] for details.

crystal

ase.io.crystal.read_crystal(filename)[source]

Method to read coordinates form ‘fort.34’ files additionally read information about periodic boundary condition

ase.io.crystal.write_crystal(filename, atoms)[source]

Method to write atom structure in crystal format (fort.34 format)

cube

ase.io.cube.read_cube(fileobj, read_data=True, program=None, verbose=False)[source]

Read atoms and data from CUBE file.

fileobjstr or file

Location to the cubefile.

read_databoolean

If set true, the actual cube file content, i.e. an array containing the electronic density (or something else )on a grid and the dimensions of the corresponding voxels are read.

program: str

Use program=’castep’ to follow the PBC convention that first and last voxel along a direction are mirror images, thus the last voxel is to be removed. If program=None, the routine will try to catch castep files from the comment lines.

verbosebool

Print some more information to stdout.

Returns a dict with the following keys:

  • ‘atoms’: Atoms object

  • ‘data’ : (Nx, Ny, Nz) ndarray

  • ‘origin’: (3,) ndarray, specifying the cube_data origin.

ase.io.cube.write_cube(fileobj, atoms, data=None, origin=None, comment=None)[source]

Function to write a cube file.

fileobj: str or file object

File to which output is written.

atoms: Atoms object

Atoms object specifying the atomic configuration.

data3dim numpy array, optional (default = None)

Array containing volumetric data as e.g. electronic density

origin3-tuple

Origin of the volumetric data (units: Angstrom)

commentstr, optional (default = None)

Comment for the first line of the cube file.

dacapo

ase.io.dacapo.read_dacapo(filename)[source]

dacapo-text

ase.io.dacapo.read_dacapo_text(fileobj)[source]

db

ase.io.db.read_db(filename, index, **kwargs)[source]
ase.io.db.write_db(filename, images, append=False, **kwargs)[source]

dftb

ase.io.dftb.read_dftb(filename='dftb_in.hsd')[source]

Method to read coordinates form DFTB+ input file dftb_in.hsd additionally read information about fixed atoms and periodic boundary condition

ase.io.dftb.write_dftb(filename, atoms)[source]

Method to write atom structure in DFTB+ format (gen format)

dlp-history

ase.io.dlp4.read_dlp_history(f, index=-1, symbols=None)[source]

Read a HISTORY file.

Compatible with DLP4 and DLP_CLASSIC.

Index can be integer or slice.

Provide a list of element strings to symbols to ignore naming from the HISTORY file.

dlp4

ase.io.dlp4.read_dlp4(f, symbols=None)[source]

Read a DL_POLY_4 config/revcon file.

Typically used indirectly through read(‘filename’, atoms, format=’dlp4’).

Can be unforgiven with custom chemical element names. Please complain to alin@elena.space for bugs.

ase.io.dlp4.write_dlp4(f, atoms, levcfg=0, title='CONFIG generated by ASE')[source]

Write a DL_POLY_4 config file.

Typically used indirectly through write(‘filename’, atoms, format=’dlp4’).

Can be unforgiven with custom chemical element names. Please complain to alin@elena.space in case of bugs

dmol-arc

ase.io.dmol.read_dmol_arc(filename, index=-1)[source]

Read a dmol arc-file and return a series of Atoms objects (images).

ase.io.dmol.write_dmol_arc(filename, images)[source]

Writes all images to file filename in arc format.

Similar to the .car format only pbc 111 or 000 is supported.

dmol-car

ase.io.dmol.read_dmol_car(filename)[source]

Read a dmol car-file and return an Atoms object.

Notes

Cell is constructed from cellpar so orientation of cell might be off.

ase.io.dmol.write_dmol_car(filename, atoms)[source]

Write a dmol car-file from an Atoms object

Notes

The positions written to file are rotated as to allign with the cell when reading (due to cellpar information) Can not handle multiple images. Only allows for pbc 111 or 000.

dmol-incoor

ase.io.dmol.read_dmol_incoor(filename, bohr=True)[source]

Reads an incoor file and returns an atoms object.

Notes

If bohr is True then incoor is assumed to be in bohr and the data is rescaled to Angstrom.

ase.io.dmol.write_dmol_incoor(filename, atoms, bohr=True)[source]

Write a dmol incoor-file from an Atoms object

Notes

Only used for pbc 111. Can not handle multiple images. DMol3 expect data in .incoor files to be in bohr, if bohr is false however the data is written in Angstroms.

elk

ase.io.elk.read_elk(filename)[source]

Import ELK atoms definition.

Reads unitcell, atom positions, magmoms from elk.in/GEOMETRY.OUT file.

eon

ase.io.eon.read_eon(fileobj, index=-1)[source]

Reads an EON reactant.con file. If fileobj is the name of a “states” directory created by EON, all the structures will be read.

ase.io.eon.write_eon(fileobj, images)[source]

Writes structure to EON reactant.con file Multiple snapshots are allowed.

eps

ase.io.eps.write_eps(filename, atoms, **parameters)[source]

espresso-in

ase.io.espresso.read_espresso_in(fileobj)[source]

Parse a Quantum ESPRESSO input files, ‘.in’, ‘.pwi’.

ESPRESSO inputs are generally a fortran-namelist format with custom blocks of data. The namelist is parsed as a dict and an atoms object is constructed from the included information.

Parameters

fileobj (file | str) – A file-like object that supports line iteration with the contents of the input file, or a filename.

Returns

atoms – Structure defined in the input file.

Return type

Atoms

Raises

KeyError – Raised for missing keys that are required to process the file

ase.io.espresso.write_espresso_in(fd, atoms, input_data=None, pseudopotentials=None, kspacing=None, kpts=None, koffset=(0, 0, 0), **kwargs)[source]

Create an input file for pw.x.

Use set_initial_magnetic_moments to turn on spin, if ispin is set to 2 with no magnetic moments, they will all be set to 0.0. Magnetic moments will be converted to the QE units (fraction of valence electrons) using any pseudopotential files found, or a best guess for the number of valence electrons.

Units are not converted for any other input data, so use Quantum ESPRESSO units (Usually Ry or atomic units).

Keys with a dimension (e.g. Hubbard_U(1)) will be incorporated as-is so the \(i\) should be made to match the output.

Implemented features:

  • Conversion of ase.constraints.FixAtoms and

    ase.constraints.FixCartesian.

  • \(starting_magnetization\) derived from the \(mgmoms\) and pseudopotentials (searches default paths for pseudo files.)

  • Automatic assignment of options to their correct sections.

  • Interpretation of ibrav (cell must exactly match the vectors defined in the QE docs).

Not implemented:

  • Lists of k-points

  • Other constraints

  • Hubbard parameters

  • Validation of the argument types for input

  • Validation of required options

  • Reorientation for ibrav settings

  • Noncollinear magnetism

Parameters
  • fd (file) – A file like object to write the input file to.

  • atoms (Atoms) – A single atomistic configuration to write to \(fd\).

  • input_data (dict) – A flat or nested dictionary with input parameters for pw.x

  • pseudopotentials (dict) – A filename for each atomic species, e.g. {‘O’: ‘O.pbe-rrkjus.UPF’, ‘H’: ‘H.pbe-rrkjus.UPF’}. A dummy name will be used if none are given.

  • kspacing (float) – Generate a grid of k-points with this as the minimum distance, in A^-1 between them in reciprocal space. If set to None, kpts will be used instead.

  • kpts ((int, int, int) or dict) – If kpts is a tuple (or list) of 3 integers, it is interpreted as the dimensions of a Monkhorst-Pack grid. If kpts is a dict, it will either be interpreted as a path in the Brillouin zone (*) if it contains the ‘path’ keyword, otherwise it is converted to a Monkhorst-Pack grid (**). (*) see ase.dft.kpoints.bandpath (**) see ase.calculators.calculator.kpts2sizeandoffsets

  • koffset ((int, int, int)) – Offset of kpoints in each direction. Must be 0 (no offset) or 1 (half grid offset). Setting to True is equivalent to (1, 1, 1).

espresso-out

ase.io.espresso.read_espresso_out(fileobj, index=-1, results_required=True)[source]

Reads Quantum ESPRESSO output files.

The atomistic configurations as well as results (energy, force, stress, magnetic moments) of the calculation are read for all configurations within the output file.

Will probably raise errors for broken or incomplete files.

Parameters
  • fileobj (file|str) – A file like object or filename

  • index (slice) – The index of configurations to extract.

  • results_required (bool) – If True, atomistic configurations that do not have any associated results will not be included. This prevents double printed configurations and incomplete calculations from being returned as the final configuration with no results data.

Yields

structure (Atoms) – The next structure from the index slice. The Atoms has a SinglePointCalculator attached with any results parsed from the file.

etsf

ase.io.etsf.read_etsf(filename)[source]
ase.io.etsf.write_etsf(filename, atoms)[source]

exciting

ase.io.exciting.read_exciting(fileobj, index=-1)[source]

Reads structure from exiting xml file.

Parameters

fileobj (file object) – File handle from which data should be read.

Other Parameters

index (integer -1) – Not used in this implementation.

ase.io.exciting.write_exciting(filename, images)[source]

writes exciting input structure in XML

Parameters
  • filename (str) – Name of file to which data should be written.

  • images (Atom Object or List of Atoms objects) – This function will write the first Atoms object to file.

extxyz

ase.io.extxyz.read_extxyz(fileobj, index=-1, properties_parser=<function key_val_str_to_dict>)

Read from a file in Extended XYZ format

index is the frame to read, default is last frame (index=-1). properties_parser is the parse to use when converting the properties line to a dictionary, extxyz.key_val_str_to_dict is the default and can deal with most use cases, extxyz.key_val_str_to_dict_regex is slightly faster but has fewer features.

ase.io.extxyz.write_extxyz(fileobj, images, comment='', columns=None, write_info=True, write_results=True, plain=False, vec_cell=False, append=False, tolerant=False)

Write output in extended XYZ format

Optionally, specify which columns (arrays) to include in output, and whether to write the contents of the Atoms.info dict to the XYZ comment line (default is True) and the results of any calculator attached to this Atoms.

findsym

ase.io.findsym.write_findsym(fileobj, images)[source]

gaussian

ase.io.gaussian.read_gaussian(filename)[source]

Reads a Gaussian input file

ase.io.gaussian.write_gaussian(filename, atoms)[source]

Writes a basic Gaussian input file

gaussian-out

ase.io.gaussian.read_gaussian_out(filename, index=-1, quantity='atoms')[source]

Interface to GaussianReader and returns various quantities. No support for multiple images in one file!

  • quantity = ‘structures’ -> all structures from the file

  • quantity = ‘atoms’ -> structure from the archive section

  • quantity = ‘energy’ -> from the archive section

  • quantity = ‘force’ -> last entry from the file

  • quantity = ‘dipole’ -> from the archive section

  • quantity = ‘version’ -> from the archive section

  • quantity = ‘multiplicity’ -> from the archive section

  • quantity = ‘charge’ -> from the archive section

gen

ase.io.gen.read_gen(fileobj)[source]

Read structure in GEN format (refer to DFTB+ manual). Multiple snapshot are not allowed.

ase.io.gen.write_gen(fileobj, images)[source]

Write structure in GEN format (refer to DFTB+ manual). Multiple snapshots are not allowed.

gif

ase.io.animation.write_gif(filename, images, writer=None, interval=200, save_count=100, save_parameters=None, ax=None, **kwargs)

gpaw-out

ase.io.gpaw_out.read_gpaw_out(fileobj, index)[source]

gpw

ase.io.gpw.read_gpw(filename)[source]

gromacs

ase.io.gromacs.read_gromacs(filename)[source]

From: http://manual.gromacs.org/current/online/gro.html C format “%5d%-5s%5s%5d%8.3f%8.3f%8.3f%8.4f%8.4f%8.4f” python: starting from 0, including first excluding last 0:4 5:10 10:15 15:20 20:28 28:36 36:44 44:52 52:60 60:68

Import gromacs geometry type files (.gro). Reads atom positions, velocities(if present) and simulation cell (if present)

ase.io.gromacs.write_gromacs(fileobj, images)[source]

Write gromacs geometry files (.gro).

Writes:

  • atom positions,

  • velocities (if present, otherwise 0)

  • simulation cell (if present)

gromos

ase.io.gromos.read_gromos(fileobj, index=-1)[source]

Read gromos geometry files (.g96). Reads: atom positions, and simulation cell (if present) tries to set atom types

ase.io.gromos.write_gromos(fileobj, images)[source]

Write gromos geometry files (.g96). Writes: atom positions, and simulation cell (if present)

html

ase.io.x3d.write_html(filename, atoms)[source]

Writes to html using X3DOM

Parameters
  • - str or file-like object, filename or output file object (filename) –

  • - Atoms object to be rendered (atoms) –

iwm

ase.io.iwm.read_iwm(fileobj, index=-1)[source]

json

ase.io.db.read_json(filename, index, **kwargs)
ase.io.db.write_json(filename, images, append=False, **kwargs)

jsv

ase.io.jsv.read_jsv(f)[source]

Reads a JSV file.

ase.io.jsv.write_jsv(f, atoms)[source]

Writes JSV file.

lammps-data

ase.io.lammpsdata.read_lammps_data(fileobj, Z_of_type=None, style='full', sort_by_id=False, units='metal')[source]

Method which reads a LAMMPS data file.

sort_by_id: Order the particles according to their id. Might be faster to switch it off. Units are set by default to the style=metal setting in LAMMPS.

ase.io.lammpsdata.write_lammps_data(fileobj, atoms, specorder=None, force_skew=False, prismobj=None, velocities=False, units='metal', atom_style='atomic')[source]

Write atomic structure data to a LAMMPS data file.

lammps-dump-binary

ase.io.lammpsrun.read_lammps_dump_binary(fileobj, index=-1, colnames=None, intformat='SMALLBIG', **kwargs)[source]

Read binary dump-files (after binary2txt.cpp from lammps/tools)

Parameters
  • fileobj – file-stream containing the binary lammps data

  • index – integer or slice object (default: get the last timestep)

  • colnames – data is columns and identified by a header

  • intformat – lammps support different integer size. Parameter set at compile-time and can unfortunately not derived from data file

Returns

list of Atoms-objects

Return type

list

lammps-dump-text

ase.io.lammpsrun.read_lammps_dump_text(fileobj, index=-1, **kwargs)[source]

Process cleartext lammps dumpfiles

Parameters
  • fileobj – filestream providing the trajectory data

  • index – integer or slice object (default: get the last timestep)

Returns

list of Atoms objects

Return type

list

magres

ase.io.magres.read_magres(fd, include_unrecognised=False)[source]

Reader function for magres files.

ase.io.magres.write_magres(fd, image)[source]

A writing function for magres files. Two steps: first data are arranged into structures, then dumped to the actual file

mol

ase.io.mol.read_mol(fileobj)[source]

mp4

ase.io.animation.write_mp4(filename, images, writer=None, interval=200, save_count=100, save_parameters=None, ax=None, **kwargs)

mustem

ase.io.mustem.read_mustem(filename)[source]

Import muSTEM input file.

Reads cell, atom positions, etc. from muSTEM xtl file

ase.io.mustem.write_mustem(filename, *args, **kwargs)[source]

mysql

ase.io.db.read_mysql(filename, index, **kwargs)
ase.io.db.write_mysql(filename, images, append=False, **kwargs)

netcdftrajectory

ase.io.netcdftrajectory.read_netcdftrajectory(filename, index=-1)[source]
ase.io.netcdftrajectory.write_netcdftrajectory(filename, images)[source]

nomad-json

ase.io.nomad_json.read_nomad_json(fd, index)[source]

nwchem

ase.io.nwchem.read_nwchem(filename)[source]

Method to read geometry from an NWChem input file.

ase.io.nwchem.write_nwchem(filename, atoms, geometry=None)[source]

Method to write nwchem coord file

octopus

ase.io.octopus.read_octopus(fileobj, get_kwargs=False)[source]

png

ase.io.png.write_png(filename, atoms, **parameters)[source]

postgresql

ase.io.db.read_postgresql(filename, index, **kwargs)
ase.io.db.write_postgresql(filename, images, append=False, **kwargs)

pov

ase.io.pov.write_pov(filename, atoms, run_povray=False, povray_path='povray', stderr=None, extras=[], **parameters)[source]

proteindatabank

ase.io.proteindatabank.read_proteindatabank(fileobj, index=-1, read_arrays=True)[source]

Read PDB files.

ase.io.proteindatabank.write_proteindatabank(fileobj, images, write_arrays=True)[source]

Write images to PDB-file.

py

ase.io.py.write_py(fileobj, images)[source]

Write to ASE-compatible python script.

qbox

ase.io.qbox.read_qbox(f, index=-1)[source]

Read data from QBox output file

Inputs:

f - str or fileobj, path to file or file object to read from index - int or slice, which frames to return

Returns

list of Atoms or atoms, requested frame(s)

res

ase.io.res.read_res(filename, index=-1)[source]

Read input in SHELX (.res) format

Multiple frames are read if \(filename\) contains a wildcard character, e.g. \(file_*.res\). \(index\) specifes which frames to retun: default is last frame only (index=-1).

ase.io.res.write_res(filename, images, write_info=True, write_results=True, significant_figures=6)[source]

Write output in SHELX (.res) format

To write multiple images, include a % format string in filename, e.g. \(file_%03d.res\).

Optionally include contents of Atoms.info dictionary if \(write_info\) is True, and/or results from attached calculator if \(write_results\) is True (only energy results are supported).

rmc6f

ase.io.rmc6f.read_rmc6f(filename, atom_type_map=None)[source]

Parse a RMCProfile rmc6f file into ASE Atoms object

Parameters
  • filename (file|str) – A file like object or filename.

  • atom_type_map (dict{str:str}) –

    Map of atom types for conversions. Mainly used if there is an atom type in the file that is not supported by ASE but want to map to a supported atom type instead.

    Example to map deuterium to hydrogen: atom_type_map = { ‘D’: ‘H’ }

Returns

structure – The Atoms object read in from the rmc6f file.

Return type

Atoms

ase.io.rmc6f.write_rmc6f(filename, atoms, order=None, atom_type_map=None)[source]

Write output in rmc6f format - RMCProfile v6 fractional coordinates

Parameters
  • filename (file|str) – A file like object or filename.

  • atoms (Atoms object) – The Atoms object to be written.

  • order (list[str]) – If not None, gives a list of atom types for the order to write out each.

  • atom_type_map (dict{str:str}) –

    Map of atom types for conversions. Mainly used if there is an atom type in the Atoms object that is a placeholder for a different atom type. This is used when the atom type is not supported by ASE but is in RMCProfile.

    Example to map hydrogen to deuterium: atom_type_map = { ‘H’: ‘D’ }

sdf

ase.io.sdf.read_sdf(fileobj)[source]

struct

ase.io.wien2k.read_struct(filename, ase=True)[source]
ase.io.wien2k.write_struct(filename, atoms2=None, rmt=None, lattice='P', zza=None)[source]

struct_out

ase.io.siesta.read_struct_out(fname)[source]

Read a siesta struct file

traj

ase.io.trajectory.read_traj(fd, index)[source]
ase.io.trajectory.write_traj(fd, images)[source]

Write image(s) to trajectory.

trj

ase.io.pickletrajectory.read_trj(filename, index=-1)
ase.io.pickletrajectory.write_trj(filename, images)

Write image(s) to trajectory.

Write also energy, forces, and stress if they are already calculated.

turbomole

ase.io.turbomole.read_turbomole(fd)[source]

Method to read turbomole coord file

coords in bohr, atom types in lowercase, format: $coord x y z atomtype x y z atomtype f $end Above ‘f’ means a fixed atom.

ase.io.turbomole.write_turbomole(fd, atoms)[source]

Method to write turbomole coord file

turbomole-gradient

ase.io.turbomole.read_turbomole_gradient(fd, index=-1)[source]

Method to read turbomole gradient file

v-sim

ase.io.v_sim.read_v_sim(filename='demo.ascii')[source]

Import V_Sim input file.

Reads cell, atom positions, etc. from v_sim ascii file

ase.io.v_sim.write_v_sim(filename, atoms)[source]

Write V_Sim input file.

Writes the atom positions and unit cell.

vasp

ase.io.vasp.read_vasp(filename='CONTCAR')[source]

Import POSCAR/CONTCAR type file.

Reads unitcell, atom positions and constraints from the POSCAR/CONTCAR file and tries to read atom types from POSCAR/CONTCAR header, if this fails the atom types are read from OUTCAR or POTCAR file.

ase.io.vasp.write_vasp(filename, atoms, label='', direct=False, sort=None, symbol_count=None, long_format=True, vasp5=False, ignore_constraints=False)[source]

Method to write VASP position (POSCAR/CONTCAR) files.

Writes label, scalefactor, unitcell, # of various kinds of atoms, positions in cartesian or scaled coordinates (Direct), and constraints to file. Cartesian coordiantes is default and default label is the atomic species, e.g. ‘C N H Cu’.

vasp-out

ase.io.vasp.read_vasp_out(filename='OUTCAR', index=-1)[source]

Import OUTCAR type file.

Reads unitcell, atom positions, energies, and forces from the OUTCAR file and attempts to read constraints (if any) from CONTCAR/POSCAR, if present.

vasp-xdatcar

ase.io.vasp.read_vasp_xdatcar(filename='XDATCAR', index=-1)[source]

Import XDATCAR file

Reads all positions from the XDATCAR and returns a list of Atoms objects. Useful for viewing optimizations runs from VASP5.x

Constraints ARE NOT stored in the XDATCAR, and as such, Atoms objects retrieved from the XDATCAR will not have constraints set.

vasp-xml

ase.io.vasp.read_vasp_xml(filename='vasprun.xml', index=-1)[source]

Parse vasprun.xml file.

Reads unit cell, atom positions, energies, forces, and constraints from vasprun.xml file

vti

ase.io.vtkxml.write_vti(filename, atoms, data=None)[source]

vtu

ase.io.vtkxml.write_vtu(filename, atoms, data=None)[source]

x3d

ase.io.x3d.write_x3d(filename, atoms, format=None)[source]

Writes to html using X3DOM.

Parameters
  • - str or file-like object, filename or output file object (filename) –

  • - Atoms object to be rendered (atoms) –

  • - str, either 'X3DOM' for web-browser compatibility or 'X3D' (format) – to be readable by Blender. \(None\) to detect format based on file extension (‘.html’ -> ‘X3DOM’, ‘.x3d’ -> ‘X3D’)

xsd

ase.io.xsd.read_xsd(fd)[source]
ase.io.xsd.write_xsd(filename, images, connectivity=None)[source]

Takes Atoms object, and write materials studio file atoms: Atoms object filename: path of the output file connectivity: number of atoms by number of atoms matrix for connectivity between atoms (0 not connected, 1 connected)

note: material studio file cannot use a partial periodic system. If partial perodic system was inputted, full periodicity was assumed.

xsf

ase.io.xsf.read_xsf(fileobj, index=-1, read_data=False)[source]
ase.io.xsf.write_xsf(fileobj, images, data=None)[source]

xtd

ase.io.xtd.read_xtd(filename, index=-1)[source]

Import xtd file (Materials Studio)

Xtd files always come with arc file, and arc file contains all the relevant information to make atoms so only Arc file needs to be read

ase.io.xtd.write_xtd(filename, images, connectivity=None, moviespeed=10)[source]

Takes Atoms object, and write materials studio file atoms: Atoms object filename: path of the output file moviespeed: speed of animation. between 0 and 10

note: material studio file cannot use a partial periodic system. If partial perodic system was inputted, full periodicity was assumed.

xyz

ase.io.xyz.read_xyz(fileobj, index=-1, properties_parser=<function key_val_str_to_dict>)[source]

Read from a file in Extended XYZ format

index is the frame to read, default is last frame (index=-1). properties_parser is the parse to use when converting the properties line to a dictionary, extxyz.key_val_str_to_dict is the default and can deal with most use cases, extxyz.key_val_str_to_dict_regex is slightly faster but has fewer features.

ase.io.xyz.write_xyz(fileobj, images, comment='', columns=None, write_info=True, write_results=True, plain=False, vec_cell=False, append=False, tolerant=False)[source]

Write output in extended XYZ format

Optionally, specify which columns (arrays) to include in output, and whether to write the contents of the Atoms.info dict to the XYZ comment line (default is True) and the results of any calculator attached to this Atoms.