n2p2 format#

Aliases#

n2p2

Implementation: N2P2Format

Overview#

n2p2 input.data neural-network training dataset.

Each begin/end block stores a periodic configuration with energy and forces in atomic units. dpdata converts units on read and write. See the n2p2 configuration-file specification.

Quick examples#

The examples use the preferred alias n2p2; any alias listed above is equivalent.

import dpdata

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

# Write labeled data
labeled_system.to("n2p2", "output_path")

Conversions#

Convert from this format to LabeledSystem#

dpdata.LabeledSystem(file_name: 'FileType', fmt: Literal['n2p2'] = None, **kwargs) dpdata.system.LabeledSystem
dpdata.LabeledSystem.from_n2p2(file_name: 'FileType', **kwargs) dpdata.system.LabeledSystem

Read from n2p2 format.

Parameters:
file_namestr

file name, i.e. the first argument

**kwargsdict

keyword arguments that will be passed from the method

Returns:
LabeledSystem

converted system

Convert from LabeledSystem to this format#

dpdata.LabeledSystem.to(fmt: Literal['n2p2'], file_name: 'FileType', **kwargs)
dpdata.LabeledSystem.to_n2p2(file_name: 'FileType', **kwargs)

Write n2p2 format.

By default, LabeledSystem.to will fallback to System.to.

Parameters:
file_namestr

file name, where the data will be written

**kwargsdict

keyword arguments that will be passed from the method