Name

nlread — Function for reading configurations and results from files. The following file types are supported: 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).

Synopsis

Namespace: NanoLanguage
nlread(
filename,
class_type,
object_id,
read_state
)

Description

Function for reading configurations and results from files. The following file types are supported: 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). Returns: A list of the objects loaded from the NetCDF file.

nlread Arguments

filename

The file that objects should be loaded from from.

Type: A string.

class_type

Only load objects of this type (NetCDF and GPAW only).

Type: A class.

object_id

Only load objects that match object_id (NetCDF and GPAW only).

Type: A string.

read_state

Read the full state of the object. If not, then enough is read that will support visualization of the configuration in the graphical user interface.

Type: True or False.

Default: True

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.nc',
    MoleculeConfiguration
)

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

nh3_read.py

Restore the object with object_id = 0 from the NetCDF file bandstructure.nc (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.nc and select the first object.

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

Notes