xyz format#

Aliases#

xyz

Implementation: XYZFormat

Overview#

Plain XYZ molecular structure file.

Plain XYZ stores element symbols and Cartesian coordinates but no cell or labels. dpdata therefore treats it as nonperiodic and assigns a placeholder cell. Use extxyz when energies, forces, virials, or multiple chemical formulas must be preserved.

Examples

>>> import dpdata
>>> system = dpdata.System("POSCAR", fmt="vasp/poscar")
>>> system.to("xyz", "a.xyz")

Quick examples#

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

import dpdata

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

# Write geometry-only data
system.to("xyz", "output_path")

Conversions#

Convert from this format to System#

dpdata.System(file_name: 'FileType', fmt: Literal['xyz'] = None, **kwargs) → dpdata.system.System
dpdata.System.from_xyz(file_name: 'FileType', **kwargs) → dpdata.system.System

Load the first structure from a plain XYZ file.

Parameters:
file_namestr or os.PathLike or file-like object

Input XYZ file.

**kwargsdict

Additional format arguments accepted for API compatibility.

Returns:
System

converted system

Convert from System to this format#

dpdata.System.to(fmt: Literal['xyz'], file_name: 'FileType', **kwargs)
dpdata.System.to_xyz(file_name: 'FileType', **kwargs)

Write all frames as concatenated plain XYZ records.

Parameters:
file_namestr or os.PathLike or file-like object

Destination XYZ file.

**kwargsdict

Additional format arguments accepted for API compatibility.

Convert from LabeledSystem to this format#

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

Write all frames as concatenated plain XYZ records.

Parameters:
file_namestr or os.PathLike or file-like object

Destination XYZ file.

**kwargsdict

Additional format arguments accepted for API compatibility.