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).
- 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
Truethe 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
# Read self-consistent calculations molecule_configuration_list = nlread( 'nh3_scf.hdf5', MoleculeConfiguration ) # Choose the first configuration in the list molecule_configuration = molecule_configuration_list
Restore the object with
object_id = 'id0' from the NetCDF file
(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
select the first object.
molecular_energy_spectrums = nlread( 'spectrum.hdf5', MolecularEnergySpectrum ) molecular_energy_spectrum = molecular_energy_spectrums
More details regarding file IO in QuantumATK can be found here.