This repository contains Python tools for analyzing shock behavior in materials using molecular dynamics simulations performed with LAMMPS. These scripts streamline the processing of simulation data, enabling in-depth analysis, binning, and visualization of key properties.
- Simulation Data Processing: Extract, bin, and label data from LAMMPS simulation dumps.
- Customizable Binning: Divide simulation data into spatial bins for localized analysis.
- Hugoniot State Calculation: Calculate key properties of materials under shock conditions.
- Data Visualization: Generate interactive plots using Plotly for time-series and spatial data.
- Integrated Logging: Monitor and debug processes with structured log outputs.
This toolkit requires the following Python libraries:
numpy
matplotlib
pandas
plotly
tqdm
scipy
pymatgen
logging
Install the dependencies using pip:
pip install numpy matplotlib pandas plotly tqdm scipy pymatgen
To process simulation files and create a structured DataFrame for analysis:
from shock_analysis import process_files
files = ["path/to/file1.dump", "path/to/file2.dump"]
sim_df = process_files(files, ts=0.2) # Specify the timestep in fs
To bin data spatially:
from shock_analysis import bin_data
data, bin_atom_map = bin_data(df, num_bins=100, bin_direction='z')
Generate interactive time-series plots:
from shock_analysis import SimulationDump
sim = SimulationDump("path/to/dump.file")
fig = sim.plot_time_data(x="timestep", y="temperature")
fig.show()
To compute the average properties in specific regions and time intervals:
hugoniot_data = sim.get_hugoniot_state(bin1=10, bin2=20, t1=0, t2=100)
print(hugoniot_data)
shock_analysis.py
: Main script containing all helper functions and classes for data processing and visualization.logs/
: Directory to store log files.data_files/
: Directory for input and output simulation files.
Logs are stored in logs/shock_analysis.log
. Adjust logging levels in the script if needed to monitor specific processes.
Below is an example workflow for processing and visualizing simulation data:
from shock_analysis import SimulationDump
# Initialize a SimulationDump object
sim = SimulationDump("path/to/dump.file")
# Process and visualize time-series data
fig = sim.plot_time_data(x="timestep", y="temperature")
fig.show()
# Calculate Hugoniot state properties
hugoniot_data = sim.get_hugoniot_state()
print(hugoniot_data)
Kimia Ghaffari
MIT License
Special thanks to the developers of pymatgen and the scientific computing community for their contributions to molecular dynamics and data analysis.