ConfigurationDataContainer¶
- class ConfigurationDataContainer(path=None, group_name=None)¶
Constructor for the ConfigurationDataContainer that contains the different configurations.
- Parameters:
path (str | None) – The path to the HDF5 file. If the path is None then all data will be stored in memory and no file will be written. Default: None
group_name (str | None) – The name of the HDF5 group to store the data in. If the value is None then a new group will be automatically made. Default: None
- allCoordinates()¶
- Returns:
The Cartesian coordinates of all images. A MxNx3 array is returned where M is the number of images and N is the number of atoms per image.
- Return type:
list of PhysicalQuantity of type length
- calculator()¶
- Returns:
The calculator if one is available, otherwise None.
- Return type:
Calculator | None
- cell(idx)¶
- Parameters:
idx (int) – The index to return.
- Returns:
The cell vectors of images with index idx or None if the trajectory length is zero or the configuration is a MoleculeConfiguration.
- Return type:
PhysicalQuantity of type length | None
- coordinates(idx)¶
- Parameters:
idx (int) – The index to return.
- Returns:
The Cartesian coordinates of the images or None if the trajectory length is zero.
- Return type:
PhysicalQuantity of type length | None
- elements(idx)¶
- Parameters:
idx (int) – The index to return.
- Returns:
The elements of the images as a list of length n or None if the trajectory length is zero.
- Return type:
list of type
PeriodicTableElement
- forces(idx=None)¶
- Parameters:
idx (int | None) – The index to return.
- Returns:
The forces of the image. If the trajectory length is zero or the forces were not written then None is returned.
- Return type:
PhysicalQuantity of type energy/length | list of PhysicalQuantity of type energy/length | None
- image(image_index, set_calculator=True, set_velocities=True, ignore_cache=False)¶
- Parameters:
image_index (int) – The index of the configuration that should be extracted.
set_calculator (bool) – If True, the calculator is set on the returned image. This can be disabled to increase the performance when iterating over images, because the overhead of copying and setting up a new calculator can be large. Default: True
set_velocities (bool) – DEPRECATED, only kept for compatibility. The velocities are always set on the configuration.
ignore_cache – If True, the image is not read from the cache.
- Returns:
A copy of the configuration with the image_index.
- Return type:
- imageEnergy(idx=Ellipsis)¶
- Parameters:
idx (int | slice) – The index or slice to return. Default: All indices
- Returns:
The potential energies of the images or None the trajectory length is zero.
- Return type:
PhysicalQuantity of type energy | None
- imageForces(idx=None)¶
- Parameters:
idx (int | None) – The index to return.
- Returns:
The forces of the image. If the trajectory length is zero or the forces were not written then None is returned.
- Return type:
PhysicalQuantity of type energy/length | list of PhysicalQuantity of type energy/length | None
- imageStress(idx=None)¶
- Parameters:
idx (int | None) – The index to return.
- Returns:
The stresses of the image. If the trajectory length is zero or the stresses were not written then None is returned. None is also returned if the configuration is a MoleculeConfiguration.
- Return type:
PhysicalQuantity of type energy/length | list of PhysicalQuantity of type energy/length | None
- images(set_calculator=True, set_velocities=True, ignore_cache=False)¶
- Parameters:
set_calculator (bool) – If True, the calculator is set on the returned image. This can be disabled to increase the performance when iterating over images, because the overhead of copying and setting up a new calculator can be large. Default: True.
set_velocities (bool) – If True, the velocities are set on the returned image. This can be disabled to increase performance. Default: True.
- Returns:
All the configurations in the trajectory.
- Return type:
list of
MoleculeConfiguration
|BulkConfiguration
|DeviceConfiguration
|SurfaceConfiguration
- kineticEnergies(idx=Ellipsis)¶
- Parameters:
idx (int | slice) – The index or slice to return. Default: All indices
- Returns:
The kinetic energies of the images or None the trajectory length is zero.
- Return type:
PhysicalQuantity of type energy | None
- lastImage()¶
- Returns:
The last image in the trajectory with the calculator attached.
- Return type:
- lastStep()¶
- Returns:
The step number of the last step.
- Return type:
int
- lastTime()¶
- Returns:
The time associated with the last step.
- Return type:
PhysicalQuantity of type time
- length()¶
- Returns:
The number of images in the trajectory.
- Return type:
int
- masses(idx)¶
- Parameters:
idx (int) – The index to return.
- Returns:
The masses of the atoms of image with index idx with shape (num_atoms,) or None if the trajectory length is zero.
- Return type:
PhysicalQuantity of type mass
- measurement(name, idx=Ellipsis)¶
- Parameters:
name (str) – The name of the measurement.
idx (int | slice) – The index or slice to return. Default: All indices
- Returns:
A 2-tuple of the time and the measurement.
- Return type:
tuple
- measurementNames()¶
- Returns:
The names of the measurements.
- Return type:
list of type str
- metatext()¶
- Returns:
The metatext of the object or None if no metatext is set.
- Return type:
str | None
- nlinfo()¶
- Returns:
The trajectory information.
- Return type:
dict
- nlprint(stream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)¶
Write a text description of the trajectory to the stream.
- Parameters:
stream (file-like object) – The stream to write to. Default:
sys.stdout
- numberOfAtoms(idx)¶
- Parameters:
idx (int) – The index to return.
- Returns:
The number of atoms in the system.
- Return type:
int
- partialCharges(idx)¶
- Parameters:
idx (int) – The index to return.
- Returns:
The partial charges of the atoms with shape (num_atoms,) or None if the trajectory length is zero.
- Return type:
PhysicalQuantity of type mass
- potentialEnergies(idx=Ellipsis)¶
- Parameters:
idx (int | slice) – The index or slice to return. Default: All indices
- Returns:
The potential energies of the images or None the trajectory length is zero.
- Return type:
PhysicalQuantity of type energy | None
- pressure(idx)¶
- Parameters:
idx (int) – The index to return.
- Returns:
The pressure value of the image with index idx or None if the trajectory length is zero.
- Return type:
PhysicalQuantity of type pressure | None
- pressureTensor(idx)¶
- Parameters:
idx (int) – The index to return.
- Returns:
The pressure tensor of the image as a vector with shape (1, 3, 3) or None if the trajectory length is zero.
- Return type:
PhysicalQuantity of type pressure | None
- pressures()¶
- Returns:
The pressure values of all images as a vector with shape (m) or None if the trajectory length is zero.
- Return type:
PhysicalQuantity of type pressure | None
- reservoirPressures(idx=Ellipsis)¶
- Parameters:
idx (int | slice) – The index or slice to return. Default: All indices
- Returns:
The reservoir pressure of the MD barostat. If the trajectory length is zero or this trajectory was not generated from a NPT simulation then None is returned. NaN is returned for indices for which no temperature data is available.
- Return type:
PhysicalQuantity of type temperature
- reservoirTemperatures(idx=Ellipsis)¶
- Parameters:
idx (int | slice) – The index or slice to return. Default: All indices
- Returns:
The reservoir temperature of the MD thermostat. If the trajectory length is zero or this trajectory was generated from a NVE simulation then None is returned. NaN is returned for indices for which no temperature data is available.
- Return type:
PhysicalQuantity of type temperature
- setMetatext(text)¶
Set a given metatext string on the object.
- Parameters:
text (str | None) – The metatext string that should be set. A value of “None” can be given to remove the current metatext.
- steps(idx=Ellipsis)¶
- Parameters:
idx (int | slice) – The index or slice to return. Default: All indices
- Returns:
The step numbers of the images or None if the trajectory length is zero.
- Return type:
array of type int | None
- stresses(idx=None)¶
- Parameters:
idx (int | None) – The index to return.
- Returns:
The stresses of the image. If the trajectory length is zero or the stresses were not written then None is returned. None is also returned if the configuration is a MoleculeConfiguration.
- Return type:
PhysicalQuantity of type energy/length | list of PhysicalQuantity of type energy/length | None
- tagData(idx)¶
- Parameters:
idx (int) – The index to return.
- Returns:
The tag data of the image or None if the trajectory length is zero or the tags are not stored in the trajectory.
- Return type:
ndarray of type int | None
- temperatures(idx=Ellipsis)¶
- Parameters:
idx (int | slice) – The index to return. Default: All indices
- Returns:
The instantaneous kinetic temperatures of the images. If the trajectory length is zero or the temperatures were not written during the MolecularDynamics run then None is returned. NaN is returned for indices for which no temperature data is available.
- Return type:
PhysicalQuantity of type temperature
- timeInterval()¶
- Returns:
The time interval between two images.
- Return type:
PhysicalQuantity of type time
- timeStep()¶
- Returns:
The time step of the simulation.
- Return type:
PhysicalQuantity of type time or None if times are not available.
- times(idx=Ellipsis)¶
- Parameters:
idx (int | slice) – The index or slice to return. Default: All indices
- Returns:
The simulation times of the images or None if the trajectory length is zero.
- Return type:
PhysicalQuantity of type time | None
- trajectoryInterval()¶
- Returns:
The interval at which snapshots are saved.
- Return type:
int
- uniqueElements(idx=None)¶
- Parameters:
idx (int | None) – The index to return. If None, all images are considered.
- Returns:
The unique elements of the images, sorted after their atomic numbers or None if the trajectory length is zero.
- Return type:
list of type
PeriodicTableElement
- velocities(idx)¶
- Parameters:
idx (int) – The index to return.
- Returns:
The velocities of the images. If the trajectory length is zero or the velocities were not written during the MolecularDynamics run then None is returned.
- Return type:
PhysicalQuantity of type length/time
- volume(idx)¶
- Parameters:
idx (int) – The index to return.
- Returns:
The volume of the unit cell of index idx. If this was a simulation of molecules, then None will be returned.
- Return type:
PhysicalQuantity of type length**3 | None
- volumes()¶
- Returns:
The volume of all unit cells. If this was a simulation of molecules, then None will be returned.
- Return type:
PhysicalQuantity of type length**3 | None
Notes¶
The MDTrajectory format is very efficient but does not support storage of heterogeneous data such as configurations with different numbers and types of atoms. The ConfigurationDataContainer format is designed to overcome this limitation. However, it does so in a more efficient way than Trajectory which stores every configuration as an individual image.