Construct a Trajectory object
A Trajectory object provides the following methods:
image(image_index): Query method for getting an image.
imageEnergy(image_index): Query method for getting the energy for a given image.
imageForces(image_index): Query method for getting the forces for a given image.
images(): Query method for all the configurations in the trajectory.
length(): Return the length of the trajectory
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]