How to Run Molecular Dynamics Using SchNetPack

What is SchNetPack?

SchNetPack is a deep learning framework designed for atomistic simulations. You can use pre-trained models (like SchNet) to run molecular dynamics (MD) simulations that compute forces and energies on atoms using neural networks.

Requirements

Folder Structure

project-root/
├── md_configs/
│   ├── config.yaml
│   ├── dynamics/
│   ├── system.yaml
│   └── callbacks/
├── tests/testdata/
│   ├── md_ethanol.model
│   └── md_ethanol.xyz
├── src/scripts/spkmd.py
    

Configurations

In md_configs/dynamics/base.yaml, define:

n_steps: 1000000
defaults:
  - integrator: md
    

In md_configs/integrator/md.yaml, define:

_target_: schnetpack.md.integrators.VelocityVerlet
time_step: 0.5
    

Run the Simulation

Use the following command (on Windows CMD) to start your simulation:

python spkmd.py \
  simulation_dir=outputs/ethanol_test \
  system.molecule_file=C:/full/path/to/md_ethanol.xyz \
  calculator.model_file=C:/full/path/to/md_ethanol.model \
  calculator.neighbor_list.cutoff=5.0
    

Output Explanation

Visualize Results

To view energy and temperature curves:

tensorboard --logdir outputs/ethanol_test/logs
    

Open http://localhost:6006 in your browser to explore the results.

Summary

This guide showed how to:

The image below shows a successful run of the SchNetPack MD simulation:

SchNetPack simulation output screenshot