Skip to content

Data Loader Module

Overview

The data_loader module provides utilities for loading and converting molecular dynamics data.

Functions

Dict()

The central part of internal API.

This represents a generic version of type 'origin' with type arguments 'params'.
There are two kind of these aliases: user defined and special. The special ones
are wrappers around builtin collections and ABCs in collections.abc. These must
have 'name' always set. If 'inst' is False, then the alias can't be instantiated,
this is used by e.g. typing.List and typing.Dict.

Optional()

Internal indicator of special typing constructs. See _doc instance attribute for specific docs.

Tuple()

Tuple type; Tuple[X, Y] is the cross-product type of X and Y.

Example: Tuple[T1, T2] is a tuple of two elements corresponding
to type variables T1 and T2.  Tuple[int, float, str] is a tuple
of an int, a float and a string.

To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].

Union()

Internal indicator of special typing constructs. See _doc instance attribute for specific docs.

available_loaders()

Get list of available trajectory file loaders.

Returns:
    List of available loader names

create_test_xyz()

Create a simple test XYZ file for testing purposes.

Args:
    filename: Output filename
    num_particles: Number of particles
    num_frames: Number of frames
    box_size: Box size (cubic)
    element: Element symbol to use

Returns:
    Path to created file

detect_file_format()

Detect trajectory file format based on extension and content.

Args:
    filename: Path to trajectory file

Returns:
    Detected format name or None if unknown

get_atomic_mass()

Get atomic mass for a specific element.

Args:
    element: Element symbol (e.g., 'C', 'H', 'O')

Returns:
    Atomic mass in atomic mass units

get_default_masses()

Get dictionary of standard atomic masses.

Returns:
    Dictionary mapping element symbols to atomic masses

load_trajectory()

Load trajectory from file with automatic format detection.

Args:
    filename: Path to trajectory file
    loader_type: Specific loader to use (None for auto-detection)

Returns:
    SMolSAT trajectory object

load_xyz()

Load XYZ trajectory file with configuration.

Args:
    filename: Path to XYZ file
    box_size: Box dimensions (tuple or single value for cubic box)
    time_step: Time step between frames
    masses: Dictionary of atomic masses (element -> mass)

Returns:
    SMolSAT trajectory object

trajectory_info()

Get comprehensive information about a trajectory.

Args:
    trajectory: SMolSAT trajectory object

Returns:
    Dictionary containing trajectory information

validate_file()

Validate trajectory file format and readability.

Args:
    filename: Path to trajectory file
    expected_format: Expected file format (None for auto-detection)

Returns:
    Dictionary with validation results