Structure

Object Hierarchy

The core object in presto is the Trajectory, which represents a single trajectory. Each trajectory contains a number of Frame objects, which represent snapshots of atomic positions, velocities, and accelerations. Frames can be converted into cctk.Molecule objects by calling frame.molecule().

Each trajectory is associated with a given Calculator and Integrator, which together dictate how new frames are generated. More specifically, the calculator calls an external program to compute the forces, and the integrator generates the next frame by applying the forces to the current frame.

Every trajectory has a .chk checkpoint file, which represents a saved snapshot of the trajectory. The checkpoint file is stored in the compressed hdf5 format and is not human-readable. Frames are added to the checkpoint file every trajectory.checkpoint_interval frames.

Although trajectories can be initiated from pure Python code, the simplest and safest way to start a trajectory with the desired settings is by using a config .yaml file, which builds the desired Python objects automatically:

  > trajectory = presto.build("config.yaml", "save.chk")
  > print(trajectory)
  Trajectory(243 frames)

Trajectories also possess Check and Reporter objects. Check objects periodically perform "sanity checks" on the trajectory, while reporter objects extract data and write it to an external file.

What Happens When A Trajectory Is Run?

When a trajectory is run (using trajectory.run()), a complex sequence of events occurs:

  1. The trajectory spawns a Controller object, which manages running new frames.
  2. The controller determines the new forces using the trajectory's Calculator (trajectory.calculator).
    1. The calculator dispatches force jobs to Gaussian or xtb and parses the output. (This is usually the rate-determining step.)
    2. Then, the calculator applies whatever constraints the user has defined, to freeze certain bonds or prevent atoms from leaving the sphere.
  3. The Integrator (trajectory.integrator) then calculates new coordinates based on the previous frame, writes a new frame, and appends it to trajectory.frames.
  4. The controller checks if the new frame satisfies the termination conditions or if the timelimit has been exceeded. If not, the cycle repeats!