SMolSAT is a modern C++ toolkit with comprehensive Python bindings for analyzing molecular dynamics simulations of soft matter systems. It provides a flexible and extensible framework for loading trajectory data, managing system information, and performing various analysis methods commonly used in soft-matter molecular simulation research.
π Python Interface Available: Full Python API with NumPy integration, high-level convenience functions, and matplotlib plotting support!
- Complete Python API: All C++ functionality accessible from Python
- NumPy Integration: Seamless data conversion and array operations
- Matplotlib Plotting: Built-in visualization functions
- High-Level Functions: Quick analysis with
quick_msd()
,quick_rg()
, etc. - Easy Installation:
pip install .
from source - Jupyter Notebook Ready: Perfect for interactive analysis
- Flexible and extensible file format support
- XYZ format: Standard atomic coordinate files
- LAMMPS trajectory files: Custom dump files with various coordinate types
- LAMMPS data files: Initial configuration files
- Easy extension for additional formats
- Handles molecular dynamics systems with various particle types
- Support for periodic boundary conditions
- Efficient particle selection and grouping
- Time-dependent properties tracking
- Mean Square Displacement (MSD): Particle mobility analysis
- Radius of Gyration: Molecular size and shape analysis
- Gyration Tensor: Detailed molecular conformation analysis
- Radial/Pair Distribution Function (RDF): Structural correlations
- Chain End-to-End Distance: Polymer analysis
- Bond Vector Autocorrelation Functions: Orientational dynamics
Quick Install:
pip install .
Requirements:
- Python 3.7+
- NumPy >= 1.19.0
- Matplotlib >= 3.3.0
- pybind11 (automatically installed)
Requirements:
- C++17 compatible compiler (GCC 7+, Clang 5+, MSVC 2017+)
- CMake 3.12 or higher
- Eigen3 library for linear algebra operations
Build Instructions:
mkdir build
cd build
cmake ..
make -j$(nproc)
C++ Installation:
make install
import smolsat
import numpy as np
import matplotlib.pyplot as plt
# Create or load trajectory
trajectory = smolsat.create_example_trajectory(num_particles=100, num_frames=1000)
# Or load from file: trajectory = smolsat.load_trajectory("trajectory.xyz")
# Quick analysis with built-in functions
lag_times, msd_values = smolsat.quick_msd(trajectory)
times, rg_values = smolsat.quick_rg(trajectory)
# Plot results
smolsat.plot_msd(lag_times, msd_values, save_path="msd_plot.png")
smolsat.plot_time_series(times, rg_values, ylabel="Radius of Gyration",
save_path="rg_plot.png")
# Advanced analysis
system = smolsat.System(trajectory, periodic_boundaries=True)
particles = [trajectory.particle(i) for i in range(10)] # First 10 particles
msd_analysis = smolsat.MeanSquareDisplacement(system, particles)
msd_analysis.compute()
results = msd_analysis.msd_values()
#include "smolsat/smolsat.h"
int main() {
// Load trajectory data
SMolSAT::DataLoader loader;
auto trajectory = loader.load_xyz("trajectory.xyz");
// Create system
SMolSAT::System system(trajectory);
// Perform analysis
SMolSAT::MeanSquareDisplacement msd(system);
auto result = msd.calculate();
msd.write_output("msd.dat");
return 0;
}
# Coordinate operations
coord = smolsat.Coordinate(x, y, z)
distance = coord1.distance_to(coord2)
magnitude = coord.magnitude()
# Trajectory management
trajectory = smolsat.Trajectory()
particle = trajectory.add_particle(id, type, mass, name)
system = smolsat.System(trajectory, periodic_boundaries=True)
# Analysis methods
msd = smolsat.MeanSquareDisplacement(system, particles)
rg = smolsat.RadiusOfGyration(system, particles)
# Quick analysis
lag_times, msd = smolsat.quick_msd(trajectory, max_lag_time=100)
times, rg = smolsat.quick_rg(trajectory)
# Data utilities
positions, times = smolsat.trajectory_to_numpy(trajectory)
new_trajectory = smolsat.numpy_to_trajectory(positions, times)
# Visualization
smolsat.plot_msd(lag_times, msd_values, save_path="msd.png")
smolsat.plot_time_series(times, values, ylabel="Property")
MeanSquareDisplacement
: Particle diffusion analysisRadiusOfGyration
: Molecular size analysisCorrelationAnalysis
: Time correlation functionsTimeSeriesAnalysis
: General time series analysis
See dev.md for detailed development documentation and API reference.
This project is licensed under the MIT License - see the LICENSE file for details.
SMolSAT is inspired by the AMDAT (Amorphous Molecular Dynamics Analysis Toolkit) package, reimagined with modern C++ design principles and enhanced extensibility. The comprehensive Python interface brings the power of C++ performance to the convenience and flexibility of Python scientific computing.
Contributions are welcome! Please see dev.md for development guidelines and architecture documentation.
- β C++ Core Library: Production-ready with comprehensive testing
- β Python Interface: Complete with pybind11 bindings and high-level API
- β Installation: Fully automated with pip support
- β Documentation: Comprehensive development and API documentation
- π Ready for Scientific Use: Both C++ and Python interfaces validated