How To Run Lammps On Windows
Please contact me if you have any questions or comments about this tutorial. For an updated 2020 version of this tutorial, please encounter my GitHub LAMMPS tutorial website.
Email: Marking A. Tschopp, mark.tschopp@gatech.edu or Dr. Marking Horstemeyer, mfhorst@me.msstate.edu
Abstruse
This is a quick tutorial to running a LAMMPS simulation on a Windows machine. For this simple example, the molecular simulation calculates the equilibrium lattice abiding and corresponding cohesive energy for aluminum.
Author(s): Marking A. Tschopp
The general workflow for running molecular dynamics simulations using LAMMPS is illustrated in the figure below:
Download LAMMPS
Follow these steps to download the LAMMPS Windows Executable:
- Goto the LAMMPS download webpage, click here.
- Click on LAMMPS Windows serial executable.
- Click the "download at present" button.
If you wish to run LAMMPS in a Unix shell, you lot must download a version on download webpage and compile and executable.
Voila! Easy every bit that.
Download a potential
Follow these steps to download a potential.
- Goto the NIST Interatomic Potential webpage, click here
- Click on Al for an aluminum single element potential
- Click on whichever potential you similar. For this example, utilize the Mishin et al. potential, Al99.eam.blend
Save this in the same directory every bit the LAMMPS executable.
Download an input file
This input script was run using the Aug 2015 version of LAMMPS. Changes in some commands may require revision of the input script. Copy the text beneath and paste it into a text file, 'calc_fcc.in'. Utilise the 'Paste Special' command with 'Unformatted Text'.
# Detect minimum energy fcc configuration # Mark Tschopp, 2010 # ---------- Initialize Simulation --------------------- articulate units metal dimension 3 boundary p p p atom_style atomic atom_modify map array # ---------- Create Atoms --------------------- lattice fcc 4 region box block 0 1 0 1 0 1 units lattice create_box one box lattice fcc iv orient 10 1 0 0 orient y 0 1 0 orient z 0 0 1 create_atoms one box replicate one 1 1 # ---------- Define Interatomic Potential --------------------- pair_style eam/alloy pair_coeff * * Al99.eam.alloy Al neighbour 2.0 bin neigh_modify filibuster 10 bank check yes # ---------- Ascertain Settings --------------------- compute eng all pe/atom compute eatoms all reduce sum c_eng # ---------- Run Minimization --------------------- reset_timestep 0 fix i all box/relax iso 0.0 vmax 0.001 thermo 10 thermo_style custom footstep pe lx ly lz press pxx pyy pzz c_eatoms min_style cg minimize 1e-25 1e-25 5000 10000 variable natoms equal "count(all)" variable teng equal "c_eatoms" variable length equal "60" variable ecoh equal "v_teng/v_natoms" print "Total energy (eV) = ${teng};" print "Number of atoms = ${natoms};" print "Lattice constant (Angstoms) = ${length};" print "Cohesive free energy (eV) = ${ecoh};" print "All done!"
Run this using LAMMPS in Windows, Method ane
Follow these steps if running LAMMPS in Windows:
- Click on the Start push button on the toolbar
- Click on Run...
- Enter 'cmd' and hitting OK
- In new window, change to the directory that contains the LAMMPS executable (lmp_win_no-mpi.exe), the input script (calc_fcc.in), and the potential file (Al99.eam.alloy). For case, if these are on the desktop, type 'cd h:/desktop' to change to the desktop.
- Type 'lmp_win_no-mpi < calc_fcc.in'
- If the simulation completes, then it volition type "All done!"
Run this using LAMMPS in Windows, Method ii
An culling way to run this in Windows is to develop a *.bat file, which is a Windows executable file. For instance, create a new text file and alter the extension from .txt to .bat. Past double clicking on a *.bat file, you will execute the lines of scripts within the file. Now, don't double click to open, simply rather right click and click on edit. Then enter the following lines:
lmp_win_no-mpi.exe < calc_fcc.in repeat All done! echo Printing a key to cease pause > nul
Try it past dropping it in the aforementioned folder as the LAMMPS executable, input script, and potential file and double clicking... voila!
Run this using LAMMPS in UNIX
If in Unix, simply type 'LAMMPS executable < input file.' If you wish to use multiple processors, use the mpirun command. For example, 'mpirun -np 8 LAMMPS executable < input file' runs the simulation on eight processors.
The end of the logfile/screen output should look like this:
Total free energy (eV) = -thirteen.43999995; Number of atoms = 4; Lattice constant (Angstoms) = four.05; Cohesive energy (eV) = -3.359999988; All done!
What it does
In this section, we will break down what LAMMPS is doing for each step. The like shooting fish in a barrel way to do this on your own is to consult the LAMMPS manual for each command or go to the Internet LAMMPS manual, i.eastward., at lammps.sandia.gov.
# Find minimum energy fcc configuration # Marker Tschopp, 2010
The '#' denotes a comment. Hence LAMMPS does not do anything for these lines.
# ---------- Initialize Simulation --------------------- clear units metal dimension iii boundary p p p atom_style atomic atom_modify map array
This section initializes the simulations. The 'clear' command clears all memory. The 'units' control specifies the units that volition be used for the residuum of the simulation; 'metallic' uses Angstroms and eV, among other units. The 'dimension three' command specifies a 3-dimensional simulation cell will be used (ii-D is too an choice). The 'boundary p p p' specifies periodic boundaries in the ten-, y-, and z-management.
# ---------- Create Atoms --------------------- lattice fcc four region box block 0 1 0 1 0 i units lattice create_box one box lattice fcc iv orient x 1 0 0 orient y 0 1 0 orient z 0 0 1 create_atoms i box replicate 1 1 1
The 'lattice' command specifies what type of lattice is used (fcc, bcc, hcp, etc.) and the number post-obit this specifies the lattice constant. The 'region' control specifies the simulation cell. Here, nosotros accept used lattice units and specified that the simulation prison cell box is to exist 1 lattice unit in each direction. The 'create_box' control following this will use the parameters outlined in the 'region' command to actually create the box. The 'replicate' command can be used to replicate the periodic cell in each direction.
# ---------- Define Interatomic Potential --------------------- pair_style eam/blend pair_coeff * * Al99.eam.alloy Al neighbour 2.0 bin neigh_modify delay ten cheque yep
The 'pair_style' command specifies what kind of interatomic potential volition be used, while the 'pair_coeff' specifies the file that the pair potential coefficients are stored in. HINT: the potential extension can sometimes give a inkling as to which format is existence used.
# ---------- Define Settings --------------------- compute eng all pe/atom compute eatoms all reduce sum c_eng
Hither, two computes are defined. In the outset 'compute' command, a variable named 'eng' is defined to store the potential energy for each atom. In the second 'compute' command, a variable named 'eatoms' is defined to store the sum of all 'eng' values.
# ---------- Run Minimization --------------------- reset_timestep 0 gear up ane all box/relax iso 0.0 vmax 0.001 thermo 10 thermo_style custom footstep pe lx ly lz press pxx pyy pzz c_eatoms min_style cg minimize 1e-25 1e-25 5000 10000
The 'reset_timestep' does just that. The 'fix' command uses the 'box/relax' setting, whereby all directions ('iso') are relaxed to 0.0 Pa pressure for all atoms ('all'). The 'thermo' specifies the output during minimization. The 'thermo_style' specifies what type of output is shown to screen. The 'min_style' specifies that conjugate gradient volition be used for minimization and the 'minimize' starts the minimization, i.e., the simulation prison cell boundaries are relaxed from the specified lattice constant (iv Angstroms) to the actual lattice constant (4.05 Angstroms).
variable natoms equal "count(all)" variable teng equal "c_eatoms" variable length equal "lx" variable ecoh equal "v_teng/v_natoms"
This section defines some variables, such as 'natoms' for the number of atoms, 'teng' for the total potential energy, 'length' for the length of the simulation cell, and 'ecoh' for the cohesive free energy of Al.
print "Total free energy (eV) = ${teng};" print "Number of atoms = ${natoms};" impress "Lattice constant (Angstoms) = ${length};" impress "Cohesive free energy (eV) = ${ecoh};" print "All done!"
This section prints these values to screen and to the logfile. The '${}' is used to insert the variables defined earlier.
Questions and Answers
Q1: I typed in the to a higher place line and nothing happened.
A1: Make sure that you are in the same directory as the LAMMPS executable. Make sure that you are typing in the right filename.
Q2: I keep getting an error with the potential, i.e., potential file not found.
A2: Get-go, check that the potential file is in the directory that you are running out of. Although, you can insert paths, if you want to shop the potentials in some other directory. Second, make sure that the potential file proper name is the same as that given in the input script. For instance, Windows has the habit of saving text files (like the potential files) with .txt extensions. If yous happen to be running from a Windows operating organization, I would change the settings and then that you lot can come across the extensions of the files besides.
Adjacent Tutorial
- Goto role two of tutorial
Get Back
- Nanoscale
- LAMMPS tutorials
Source: https://icme.hpc.msstate.edu/mediawiki/index.php/LAMMPS_Tutorial_1.html
0 Response to "How To Run Lammps On Windows"
Post a Comment