It appears I'm encountering an issue with the Kim init command

I’m unsure whether to post this here or in the Kim section, but I’ll start here. I’m encountering the following error:

ERROR: Must use ‘kim init’ before ‘kim interactions’ (src/KIM/kim_interactions.cpp:123)
Last command: kim interactions Fe Cr Ni

Despite running the kim init command before using kim interactions, I still get this error. I even tried declaring it twice in both files, but I then encountered these errors:

ERROR: Must use ‘kim init’ before ‘kim interactions’ (src/KIM/kim_interactions.cpp:123)
Last command: kim interactions Fe Cr Ni

and this

ERROR: Must use ‘kim init’ command before simulation box is defined (src/KIM/kim_init.cpp:89)
Last command: kim init EAM_Dynamo_MendelevBorovikov_2020_FeNiCr__MO_922363340570_000 metal

I’m completely lost :cry:. Any help would be greatly appreciated!
Version: stable_2Aug2023_update3
Uploading: potential.mod…
Uploading: init.mod…

Hi,

It appears that I cannot download your files, for me they say “Uploading: potential.mod…” for example. Do you see anything like that on your end? Can you try re-attaching the files? Are they very big files or anything? I imagine not…

doesnt let me :smiling_face_with_tear:

# NOTE: This script can be modified for different pair styles 
# See in.elastic for more info.

# we must undefine any fix ave/* fix before using reset_timestep
if "$(is_defined(fix,avp))" then "unfix avp"
reset_timestep 0

# Choose potential
kim interactions Fe Cr Ni

# Setup neighbor style
neighbor 1.0 nsq
neigh_modify once no every 1 delay 0 check yes

# Setup output

fix avp all ave/time  ${nevery} ${nrepeat} ${nfreq} c_thermo_press mode vector
thermo		${nthermo}
thermo_style custom step temp pe press f_avp[1] f_avp[2] f_avp[3] f_avp[4] f_avp[5] f_avp[6]
thermo_modify norm no

# Setup MD

timestep ${timestep}
fix 4 all nve
if "${thermostat} == 1" then &
   "fix 5 all langevin ${temp} ${temp} ${tdamp} ${seed}"
# NOTE: This script can be modified for different atomic structures, 
# units, etc. See in.elastic for more info.
#

# Define the finite deformation size. Try several values of this
# variable to verify that results do not depend on it.
variable up equal 2.0e-2
 
# metal units, elastic constants in GPa
kim init EAM_Dynamo_MendelevBorovikov_2020_FeNiCr__MO_922363340570_000 metal
variable cfac equal 1.0e-4
variable cunits string GPa

# Define MD parameters
variable nevery equal 10                  # sampling interval
variable nrepeat equal 10                 # number of samples
variable nfreq equal ${nevery}*${nrepeat} # length of one average
variable nthermo equal ${nfreq}           # interval for thermo output
variable nequil equal 10*${nthermo}       # length of equilibration run
variable nrun equal 3*${nthermo}          # length of equilibrated run
variable temp equal 1500.0                # temperature of initial sample
variable timestep equal 0.001             # timestep
variable massFe equal 55.845              # mass of Fe
variable massCr equal 51.9961             # mass of Cr
variable massNi equal 58.6934             # mass of Ni
variable adiabatic equal 0                # adiabatic (1) or isothermal (2)
variable tdamp equal 0.01                 # time constant for thermostat
variable seed equal 123457                # seed for thermostat

# generate the box and atom positions using an FCC lattice
variable a equal 3.59  # approximate lattice constant for FeCrNi in angstroms

boundary    p p p

lattice         fcc $a
region      box prism 0 10 0 10 0 10 0.0 0.0 0.0
create_box  3 box
create_atoms 1 box
mass 1 ${massFe}
mass 2 ${massCr}
mass 3 ${massNi}

# Assign random types to atoms to create an alloy
set type 1 type/fraction 2 0.33 12345
set type 1 type/fraction 3 0.33 12345

velocity    all create ${temp} ${seed}

This is the LAMMPS example for ELASTIC_T. Unfortunately, I can’t send the files, but these two remain unchanged from the original example. i send you the init.mod and potential.mod and the displace.mod in.elastic remain unchanged.

Oh, I know this one, I had to make the modification myself recently, let me dig it up.

1 Like

The issue is the clear command in displace.mod clears the kim init command.

So I think you have the exact correct idea with the changes you made in init.mod and potential.mod, but you also have to repeat the kim init command after both clear in displace.mod

EDIT: My use was with zero temperature ELASTIC, not ELASTIC_T, so it may be different

I understand now. After every clear command and before using a potential, I need to use kim init. It’s working perfectly now.

Thank you very much!