ase/traj format#

Aliases#

ase/traj

Implementation: ASETrajFormat

Overview#

ASE binary trajectory (.traj) file.

An ASE trajectory stores a sequence of Atoms objects and can retain calculator results. dpdata supports frame slicing on read and writes all frames to a new trajectory. The optional ase dependency is required.

Quick examples#

The examples use the preferred alias ase/traj; any alias listed above is equivalent.

import dpdata

# Geometry-only data
system = dpdata.System("input_file", fmt="ase/traj")

# Data with energies and forces
labeled_system = dpdata.LabeledSystem("input_file", fmt="ase/traj")

# Write geometry-only data
system.to("ase/traj", "output_path")

# Write labeled data
labeled_system.to("ase/traj", "output_path")

Conversions#

Convert from this format to System#

dpdata.System(file_name: 'str', begin: 'int | None' = 0, end: 'int | None' = None, step: 'int | None' = 1, fmt: Literal['ase/traj'] = None, **kwargs) → dpdata.system.System
dpdata.System.from_ase_traj(file_name: 'str', begin: 'int | None' = 0, end: 'int | None' = None, step: 'int | None' = 1, **kwargs) → dpdata.system.System

Read ASE’s trajectory file to System of multiple frames.

Parameters:
file_namestr

ASE’s trajectory file

beginint, optional

begin frame index

endint, optional

end frame index

stepint, optional

frame index step

**kwargsdict

other parameters

Returns:
System

converted system

Convert from System to this format#

dpdata.System.to(fmt: Literal['ase/traj'], file_name: 'str' = 'confs.traj', **kwargs) → 'None'
dpdata.System.to_ase_traj(file_name: 'str' = 'confs.traj', **kwargs) → 'None'

Write System frames to an ASE trajectory.

Parameters:
file_namestr

Destination trajectory path.

**kwargsdict

Options forwarded to the in-memory ASE structure converter.

Convert from LabeledSystem to this format#

dpdata.LabeledSystem.to(fmt: Literal['ase/traj'], file_name: 'str' = 'labeled_confs.traj', *args, **kwargs) → 'None'
dpdata.LabeledSystem.to_ase_traj(file_name: 'str' = 'labeled_confs.traj', *args, **kwargs) → 'None'

Write labeled frames to an ASE trajectory.

Parameters:
file_namestr

Destination trajectory path.

**kwargsdict

Keyword options forwarded to the in-memory ASE converter.

Convert from this format to LabeledSystem#

dpdata.LabeledSystem(file_name: 'str', begin: 'int | None' = 0, end: 'int | None' = None, step: 'int | None' = 1, fmt: Literal['ase/traj'] = None, **kwargs) → dpdata.system.LabeledSystem
dpdata.LabeledSystem.from_ase_traj(file_name: 'str', begin: 'int | None' = 0, end: 'int | None' = None, step: 'int | None' = 1, **kwargs) → dpdata.system.LabeledSystem

Read ASE’s trajectory file to System of multiple frames.

Parameters:
file_namestr

ASE’s trajectory file

beginint, optional

begin frame index

endint, optional

end frame index

stepint, optional

frame index step

**kwargsdict

other parameters

Returns:
LabeledSystem

converted system