/LAMMPS

This repository contains some scripts to deal with LAMMPS out files, focused on diffusion coefficients

Primary LanguagePython

LAMMPS

This repository contains one script to deal with LAMMPS out files, focused on diffusion coefficients

The msd_main.py file:

This script was developed to calc the diffusion coefficient of one specific atom based on 'msd.txt' file from LAMMPS.

The linear adjust of MSD values in time is performed, based on Einstein equation for diffusion, the diffusion coefficient is obtained by the division of the slope value by 6.

  • The script uses sklearn, scipy and matplotlib libraries, please check if you have them installed.

  • Please check the input file format (below), and if your file is in this specification, insert you text file name in line 227.

The input file format: The file msd_main.py reads one 'msd.txt' file generated by LAMMPS with 5 columns:

1st column = steps (if you asked 4000 steps sampling, then this column will be 0,4000,8000, and so on)
2nd column = X_msd, not used
3rd column = Y_msd, not used
4th column = Z_msd, not used
5th column = Total msd, the sum of 2nd,3rd,4th columns, this value is used to calc the Mean Squared Deviation linear           adjust in time.

After reading the msd.txt file, the script will calculate the linear adjust from msd in 3 time ranges. You can run it without modifications, and the 3 time ranges will be automatically generated. You can uncomment the line 232 and enter 3 arguments in picoseconds. This script will open the three graphs with the results of linear adjusts and diffusion coefficients. This script will also save the three figures as total_msd_**ps.png, where ** are the time ranges.