# Define looping variables
variable loopcount loop 42
variable latticeconst index 5.504600 5.135771 4.907185 4.741106 4.610587 4.503055 4.411612 4.332064 4.261670 4.198539 4.141311 4.088976 4.040763 3.996070 3.954418 3.915418 3.878754 3.844161 3.811418 3.780337 3.750757 3.722540 3.695566 3.669730 3.652142 3.633631 3.614094 3.593413 3.571445 3.548017 3.522923 3.495908 3.466652 3.434751 3.399677 3.360729 3.316944 3.266947 3.208682 3.138858 3.051727 2.935780 

# Define unit set and class of atomic model
units metal
atom_style atomic

# Periodic boundary conditions along all three dimensions
boundary p p p

# Create a sc lattice using a single conventional (orthogonal)
# unit cell with a lattice constant from the 'latticeconst' variable defined on line 3 above
lattice sc ${latticeconst}
region box block 0 1 0 1 0 1 units lattice
create_box 1 box
create_atoms 1 box
mass 1 39.948

# Specify which KIM Model to use
pair_style kim LAMMPSvirial Pair_LJ_Smooth_Bernardes_Ar__MO_764178710049_000
pair_coeff * * Ar

# Set what thermodynamic information to print to log
thermo_style custom step atoms xlo xhi ylo yhi zlo zhi pe press pxx pyy pzz pxy pxz pyz
thermo 10 # Print every 10 steps

# Set what information to write to dump file
dump id all custom 10 output/lammps.dump id type x y z fx fy fz
dump_modify id format line "%d %d %16.7f %16.7f %16.7f %16.7f %16.7f %16.7f"

# Compute the energy and forces for this lattice spacing
run 0

# Define auxiliary variables to contain cohesive energy and equilibrium lattice constant
variable poteng    equal "c_thermo_pe"
variable natoms    equal "count(all)"
variable ecohesive equal "v_poteng/v_natoms"

# Output cohesive energy and equilibrium lattice constant
print "Cohesive energy = ${ecohesive} eV/atom"

# Queue next loop
clear # Clear existing atoms, variables, and allocated memory
next latticeconst # Increment latticeconst to next value
next loopcount # Increment loopcount to next value
jump SELF # Reload this input script with the new variable values