nlread

nlread(filename, class_type=None, object_id=None, read_state=None)

Function for reading configurations and results from files. The following file types are supported: HDF5 (only from ATK 2017 and later), NetCDF (only from ATK 10.8 and later), GPAW, ASE, XYZ, Python scripts (also from ATK 2008.10 and earlier), CAR and TRAJ (ASE trajectories).

Parameters:
  • filename (str) – The file that objects should be loaded from.

  • class_type (class) – Only load objects of this type (HDF5, NetCDF and GPAW only).

  • object_id (str) – Only load objects that match object_id.

  • read_state (bool) – When read_state is True the self-consistent calculation data is read from configurations when present. Otherwise, configurations will still have a calculator, but the self-consistent data will not be available.

Returns:

A list of the objects loaded from the file.

Return type:

list

Usage Examples

Restore the self-consistent state of a previous calculation (to save the state, see the Usage Examples for the nlsave function).

# Read self-consistent calculations
molecule_configuration_list = nlread(
    'nh3_scf.hdf5',
    MoleculeConfiguration
)

# Choose the first configuration in the list
molecule_configuration = molecule_configuration_list[0]

nh3_read.py

Restore the object with object_id = 'id0' from the NetCDF file bandstructure.hdf5 (to save the state, consult the nlsave function).

molecular_energy_spectrum = nlread(filename='spectrum.nc', object_id='id0')

Restore all MolecularEnergySpectrum objects from the file spectrum.hdf5 and select the first object.

molecular_energy_spectrums = nlread(
    'spectrum.hdf5',
    MolecularEnergySpectrum
    )
molecular_energy_spectrum = molecular_energy_spectrums[0]

More details regarding file IO in QuantumATK can be found here.