# LAMMPS workflow LAMMPS [home](https://lammps.sandia.gov/) LAMMPS script [explanations](https://lammps.sandia.gov/doc/Examples.html) (example input scripts available in install directory) ### Creation of initial geometry files ([Avogadro](https://avogadro.cc/)) ### Generation of geometry for LAMMPS script - generate supercell from basic `.cif` crystal file using [*supercell*](https://orex.github.io/supercell/) software - *supercell* [documentation](https://orex.github.io/supercell/doc/supercell_man.html#section_5) - run input example: `supercell -i input.cif -v 2 -s 2x2x2 -o output` - generate `.xyz` file from `.cif` file generated by *supercell* using *cif2xyz* - *cif2xyz* GitHub [repository](https://github.com/JJPPeters/CIF2XYZ/blob/master/main.cpp) - run input example: `cif2xyz input.cif -z angle_x,angle_y,angle_z -d dimension_x,dimension_y,dimension_z -o output` - generate system and initial positions for *LAMMPS* script using [*packmol*](http://m3g.iqm.unicamp.br/packmol/download.shtml) software - *packmol* [User's guide](http://www.ime.unicamp.br/~martinez/packmol/userguide.shtml#radii) - generate system in either `.xyz` or `.pdb` file format (other supported but not suitable) - `.xyz` file (only positions, no bonds, unlimited system size) - `.pdb` file (positions + bonds, 9,999 atoms system limit) - input file [example](https://github.com/Fercik86/LAMMPS_NWChem_workflows/blob/LAMMPS/packmol/builder_example.int) - run input example: `packmol < packmol.inp` - (optional) generate odd shaped models - using *cutter.py* script - cuts out along the specified axis or plane - keeps/removes file either over or under axis/plane ### Visualizing generated system using [*OVITO*](https://www.ovito.org/) sotfware Visualization done to check wheter the system was generated correctly and can be used as input geometry in *LAMMPS* script ### Generate *LAMMPS* input geometry .dat file using *OVITO* and *"swapper"* - Import file to be exported to `.dat` - Export to `.dat` using: `File > Export File > LAMMPS Data File` (Atom style **full** recommended) - Use *"swapper"* to differentiate same atoms in different molecules (instructions on use in the script beginning) ### Writing *LAMMPS* input script Any text editor can be used to edit *LAMMPS* input scripts. [*Notepad++*](https://notepad-plus-plus.org/) is a better alternative to the default Notepad. [*Visual Studio Code*](https://code.visualstudio.com/) is the recommended option. [*LAMMPS* extentsion](https://marketplace.visualstudio.com/items?itemName=ThFriedrich.lammps&utm_source=VSCode.pro&utm_campaign=AhmadAwais) for VS Code makes writting *LAMMPS* scripts much easier thanks to the syntax highlighting, hover explanations, offline documentation and more. ### *LAMMPS* script example (TBA) ((there are no easy examples)) ### Running *LAMMPS* on Windows Running in serial mode (1 core) ``` lmp_serial < in.file --> will run in the console ``` Running with MPI (multi-core) ``` mpiexec -n 4 lmp_mpi -in input.lmp -pk omp 2 -sf omp --> will run in the console (4 cores, omp hyperthreading) ``` ### Visualizing results - *LAMMPS* output file - text editor - `.lammpstrj` file - *OVITO* [link](https://www.ovito.org/) ### Processing of results - Calculating Diffusion coefficients via MSD (mean square displacement) from `.lammpstrj` file - using *"bestScript"* [link](https://github.com/ErikPitko/lammps-parser) - calculation of x_MSD, y_MSD, z_MSD, combined_MSD of each selected atom type - MSDs are plotted against time - Diffusion coefficient is obtained as slope of initial linear part of the diffusion curve - Based on the work of David Keffer [ref](http://www.utkstair.org/clausius/docs/che548/pdf/selfD.pdf) - Visualising trajectories from `.lammpstrj` file - using *"bestScript"* [link](https://github.com/ErikPitko/lammps-parser) - generation of coordinates in each timestep for each selected atom type - Coordinates are plotted against time to obtain 3D trajectory - [script](https://github.com/Fercik86/LAMMPS_NWChem_workflows/blob/LAMMPS/OriginPro_scripts/origin_scripts.txt) for *OriginPro* to change columns to X1 Y1 Z1; X2 Y2 Z2;... <!-- -------------------------------------------------------------------------------------------- --> <style> html, body, .ui-content { background-color: #333; color: #ddd; } .markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { color: #ddd; } .markdown-body h1, .markdown-body h2 { border-bottom-color: #ffffff69; } .markdown-body h1 .octicon-link, .markdown-body h2 .octicon-link, .markdown-body h3 .octicon-link, .markdown-body h4 .octicon-link, .markdown-body h5 .octicon-link, .markdown-body h6 .octicon-link { color: #fff; } .markdown-body img { background-color: transparent; } .ui-toc-dropdown .nav>.active:focus>a, .ui-toc-dropdown .nav>.active:hover>a, .ui-toc-dropdown .nav>.active>a { color: white; border-left: 2px solid white; } .expand-toggle:hover, .expand-toggle:focus, .back-to-top:hover, .back-to-top:focus, .go-to-bottom:hover, .go-to-bottom:focus { color: white; } .ui-toc-dropdown { background-color: #333; } .ui-toc-label.btn { background-color: #191919; color: white; } .ui-toc-dropdown .nav>li>a:focus, .ui-toc-dropdown .nav>li>a:hover { color: white; border-left: 1px solid white; } .markdown-body blockquote { color: #bcbcbc; } .markdown-body table tr { background-color: #5f5f5f; } .markdown-body table tr:nth-child(2n) { background-color: #4f4f4f; } .markdown-body code, .markdown-body tt { color: #eee; background-color: rgba(230, 230, 230, 0.36); } a, .open-files-container li.selected a { color: #5EB7E0; } </style>