Molecular Dynamic Trajectory Trace — tracing phonon and vibrational physics in MD trajectories.
MDtrace computes the dynamic structure factor
conda create -n mdtrace python=3.12 -y
conda activate mdtrace
git clone https://github.com/AI4MD-lab/MDtrace.git
cd MDtrace
python -m pip install .
mdtrace -hThe installation above runs on the CPU. For GPU calculations:
-
Run
nvidia-smiand check that it lists your GPU. If you need a driver, install the NVIDIA driver. For WSL 2, install the driver on Windows. -
In the
mdtraceenvironment, install CuPy and the CUDA runtime together:conda activate mdtrace conda install -c conda-forge cupy
If you already have a CUDA Toolkit and prefer pip, check
nvcc --versionand use one of these commands instead:Installed CUDA Toolkit Command 12.x python -m pip install cupy-cuda12x13.x python -m pip install cupy-cuda13x -
Run the check below. If it prints
6, setdevice = gpuin your MDtrace input file. To run a fresh GPU calculation on the training data, also setaction = compute.python -c "import cupy as cp; print(cp.arange(4).sum().item())"
- Copy the amorphous input template into your calculation directory as
input.in. Settrajectory_fileto your fixed-cell, periodic trajectory. Density spectra need positions. For current spectra (dsf_currents = 1), include velocities in the same frames. - Set
time_stepin fs andoutput_data_strideto the number of MD steps between saved frames. For example, a 1 fs step with a frame saved every 5 steps gives 5 fs between frames. - Set
action = thinking. From the calculation directory, run:
mdtrace input.inSiO₂ training files. From the supplied dsf/ directory, run mdtrace input_dsf.in. Use action = plot to redraw the supplied spectra, or action = thinking to compute them when needed.
Open the longitudinal and transverse maps side by side. At the same wavevector magnitude
| Figure suffix | What it shows |
|---|---|
.dsf_CL.png |
Atomic motion parallel to the wavevector |
.dsf_CT.png |
Atomic motion perpendicular to the wavevector |
.dsf_Ctotal.png |
Total current spectrum, |
.dsf.png |
Density fluctuations, |
The training files use the prefix sio2, for example sio2.dsf_CT.png.
For a crystal, use the crystal input template.
DSF workflow and parameters
Why the name?
Molecular Dynamic Trajectory Trace
│ │ │ │
▼ ▼ ▼ ▼
[MD] + [MD] + [tra] + [ce]
│ │ │ │
└────────────────┘ └────────────┘
MD trace
──▶ MDtrace ◀──
The name is self-contained in the phrase: Molecular Dynamic Trajectory Trace. The MD captures the simulation method, and trace is the action — tracing phonons, tracing spectra, tracing the physics hidden in every atom's path.
Questions and feedback: [email protected].