Skip to main content

dynasor is a tool for calculating total and partial dynamic structure factors as well as related correlation functions from molecular dynamics (MD) simulations. By analyzing these functions one can access the dynamics of a system without resorting to perturbative approaches. Moreover by combining in particular the structure factor with the cross sections (or form factors) of, e.g., neutrons, X-rays or electrons, one can predict experimental spectra. The main input consists of a trajectory from an MD simulation, i.e., a file containing snapshots of the particle coordinates and optionally velocities that correspond to consecutive, equally spaced points in simulation time.

dynasor provides both a Python interface and a command-line interface. The following snippet illustrates how one can calculate dynamic structure factors using the former.

from dynasor import Trajectory, compute_dynamic_structure_factors
from dynasor.qpoints import get_spherical_qpoints

traj = Trajectory('dump.xyz', trajectory_format='extxyz')
q_points = get_spherical_qpoints(traj.cell, q_max=20)
sample = compute_dynamic_structure_factors(traj, q_points=q_points, dt=5, window_size=100)
sample.write_to_npz('test.npz')

dynasor can be installed via pip or conda. Please consult the installation section of the user guide for details.

The full documentation can be found in the user guide. For questions and help please use the dynasor discussion forum on matsci.org. dynasor and its development are hosted on gitlab.

When using dynasor in your research please cite the following papers:

Dynasor – A tool for extracting dynamical structure factors and current correlation functions from molecular dynamics simulations
Erik Fransson, Mattias Slabanja, Paul Erhart, and Göran Wahnström
Advanced Theory and Simulations 4, 2000240 (2021); DOI:10.1002/adts.202000240
Dynasor 2: From simulation to experiment through correlation functions
Esmée Berger, Erik Fransson, Fredrik Eriksson, Eric Lindgren, Göran Wahnström, Thomas Holm Rod, and Paul Erhart
Computer Physics Communications 316, 109759 (2025); DOI: 10.1016/j.cpc.2025.109759

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dynasor-2.4.tar.gz (165.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dynasor-2.4-py3-none-any.whl (144.5 kB view details)

Uploaded Python 3

File details

Details for the file dynasor-2.4.tar.gz.

File metadata

  • Download URL: dynasor-2.4.tar.gz
  • Upload date:
  • Size: 165.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.6

File hashes

Hashes for dynasor-2.4.tar.gz
Algorithm Hash digest
SHA256 5ffc16ea5506fd735e9ade06a9aace061b643e7700dd18fe65c6db03d9601006
MD5 188e81262e4921551a6e5df1a45e665f
BLAKE2b-256 3d197319005d047cdb8d362d0161a7a24ed65f574bd0611f6ed538de483b9d2e

See more details on using hashes here.

File details

Details for the file dynasor-2.4-py3-none-any.whl.

File metadata

  • Download URL: dynasor-2.4-py3-none-any.whl
  • Upload date:
  • Size: 144.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.6

File hashes

Hashes for dynasor-2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c35810251c8e09e63193c4523b61b30001bed00006baa7bb6663135f4942ba39
MD5 9b2c3927f30f3d8e700821d9b45a09d0
BLAKE2b-256 e66f2a3dad03cc9814bf8fd02f558100e4e003bc58fea326c260da91cfe01ddf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page