Name

Trajectory — Class for representing the trajectory of a relaxation

Synopsis

Namespace: NanoLanguage
Trajectory()

Description

Construct a Trajectory object

Trajectory Arguments

Trajectory Methods

A Trajectory object provides the following methods:

  • image(image_index): Query method for getting an image.

    image_index

    The index of the desired image.

    Type: Non-negative integer.

  • imageEnergy(image_index): Query method for getting the energy for a given image.

    image_index

    The index of the desired image.

    Type: Non-negative integer.

  • imageForces(image_index): Query method for getting the forces for a given image.

    image_index

    The index of the desired image.

    Type: Non-negative integer.

  • images(): Query method for all the configurations in the trajectory.

  • length(): Return the length of the trajectory

Usage Examples

Optimize the geometry of a water molecule and read the result into a trajectory object

# Define elements
elements = [Oxygen, Hydrogen, Hydrogen]

# Define coordinates
cartesian_coordinates = [[  0.0,  -1.70000000e-05,   1.20198000e-01],
                         [  0.0,   7.59572000e-01,  -4.86714000e-01],
                         [  0.0,  -7.59606000e-01,  -4.86721000e-01]]*Angstrom

# Set up configuration
molecule_configuration = MoleculeConfiguration(
    elements=elements,
    cartesian_coordinates=cartesian_coordinates
    )

# define a calculator
molecule_configuration.setCalculator(LCAOCalculator())

# perform optimization and read the relaxation trajectory
OptimizeGeometry(molecule_configuration, trajectory_filename='opt.nc')
trajectory = nlread('opt.nc', Trajectory)[0]

trajectory.py

Notes