Table of Contents | Load trajectory | Up
Prev | Modifiers | Next

### Load trajectory

This modifier loads atomic trajectories and other time-dependent data from a separate trajectory file and merges them with static topology data (e.g. atom type and bond connectivity information) loaded from the primary data file.

Some molecular dynamics codes use or write separate topology and trajectory files. The topology file typically serves as starting point of the MD simulation and contains the initial atomic positions and the definitions of static structures like the atom types, bonds, etc., which do not change throughout the simulation. The trajectories of the particles computed by the MD code are then written to an output file, which stores just the time-dependent coordinates and sometimes other varying information such as the atomic energies.

LAMMPS is a simulation code that employes this topology+trajectory file scheme. LAMMPS uses the `data` file format for input files, which define the atom types and bonds in the simulation, whereas the `dump` file format serves as output format storing the computed atom trajectories.

To load such a pair of topology and trajectory files in OVITO, first open the topology file using the regular File → Load File menu function. Then insert the Load Trajectory modifier into the data pipeline and use the button highlighted in this screenshot to also load the corresponding trajectory file. Make sure you perform the last step in the user interface panel of the selected Load Trajectory modifier and not in the original "External file" panel, which looks very similar and manages the initial topology file.

After loading the trajectory file in the Load Trajectory panel, the modifier will subsequently replace the initial particle positions with the time-dependent positions read from the trajectory file. The same is done for the simulation cell geometry as well as any other auxiliary particle properties found in the trajectory file. Furthermore, you see the timeline of OVITO now display the animation frames found in the trajectory file.

#### Particle ordering

The modifier needs to assign the coordinates read from in the trajectory file to the corresponding particles from the topology dataset. In order to do this mapping correctly, the modifier uses the unique identifiers of particles (`Particle Identifier` property) if available. Otherwise, the modifier simply assumes that the storage orders of particles in the topology and the trajectory file are the same.

#### Varying bond connectivity

The LAMMPS code supports reactive molecular dynamics simulations, in which the bond topology dynamically changes during the course of the simulation as bonds break or newly form. The changing bond topology of such a simulation can be dumped to an output file using the `dump local` command of LAMMPS in combination with the `compute property/local` command, see the example below.

OVITO's Load Trajectory modifier can read the varying bond topology from `dump local` files and overwrite any static connectivity from the initial LAMMPS data file with it. Typically, you will use two instances of the Load Trajectory modifier in the same pipeline, as shown on the side, to load both the time-varying atomic coordinates and the time-varying bond information from such a reactive MD simulation.

LAMMPS is able to output the changing bond topology in regular time intervals and also additional per-bond quantities such as the bond lengths, bond forces or bond energies. Take for example the following LAMMPS commands, which dump the current bond list to an output file in regular timestep intervals:

       compute 1 all property/local btype batom1 batom2
       compute 2 all bond/local dist engpot
       dump 1 all local 100 bonds.dump index c_1[*] c_2[*]

The `dump local` command generates a file `bonds.dump` having six data columns:

       ITEM: ENTRIES index c_1[1] c_1[2] c_1[3] c_2[1] c_2[2]
       1 10 24 33 1.02482 0.158356
       2 10 24 34 1.01407 0.0298494
       3  7 21 22 1.53167 0.000836934
       ...

During import of the file into OVITO using the Load Trajectory modifier you need to map these data columns to the correct bond properties of OVITO so that the program can interpret the data in the LAMMPS dump file correctly:

| LAMMPS name | File column identifier | OVITO bond property
--- | --- | --- | ---
1 | `index` | `index` | (ignore)
2 | `btype` | `c_1[1]` | Bond Type
3 | `batom1` | `c_1[2]` | Topology.A
4 | `batom2` | `c_1[3]` | Topology.B
5 | `dist` | `c_2[1]` | Length
6 | `engpot` | `c_2[2]` | Energy

In this example, the third and the fourth file column were mapped to the `Topology` bond property, which signals OVITO that the dump local file contains a complete new set of bonds, replacing the original (static) bond topology previously loaded from the LAMMPS data file. In contrast, if the dump local file doesn't contain the two topology columns, then OVITO assumes that the file stores auxiliary bond property values and simply adds them to the existing bonds. In this case, the number of entries in the dump local file must exactly match the number of existing bonds in OVITO.

#### See also

`LoadTrajectoryModifier` (Python API) pro

Prev | Up | Next
Invert selection | Table of Contents | Manual selection