I’m a lammps beginner especially in using kim potentials. I’ m trying to use the potential: Sim_LAMMPS_IFF_PCFF_HeinzMishraLinEmami_2015Ver1v5_FccmetalsMineralsSolventsPolymers__SM_039297821658_000 for lead alone (for now). The relevant part of the log:
kim interactions Pb
#=== BEGIN kim interactions ==================================
variable kim_update equal 0
variable kim_periodic equal 1
kspace_style pppm 1.0e-6
pair_style lj/class2/coul/long 12.0
pair_modify mix sixthpower
special_bonds lj/coul 0.0 0.0 1.0
Finding 1-2 1-3 1-4 neighbors …
special bond factors lj: 0 0 1
special bond factors coul: 0 0 1
0 = max # of 1-2 neighbors
0 = max # of 1-3 neighbors
1 = max # of special neighbors
special bonds CPU = 0.000 seconds
pair_coeff 1 1 0.0350000000 4.5000000000 # ay1
pair_coeff 2 2 0.0350000000 4.5000000000 # ay2
ERROR: Numeric index 2 is out of bounds (1-1) (src/CLASS2/pair_lj_class2_coul_long.cpp:637)
Last command: pair_coeff 2 2 0.0350000000 4.5000000000 # ay2
The input data follows the format atom_style full: atom-ID molecule-ID atom-type q x y z
where molecule-ID and q are 0. Am I missing something, how to resolve this error?
I use the LAMMPS version 29 Sep 2021, software works for other KIM potentials.
I would be grateful for any help!
First, to clarify, KIM Simulator Models (SMs) work something like macros or literal includes based on (1) an smspec.edn file and (2) one or more parameter files that are referenced by smspec.edn. For this specific SM, you can see its smspec.edn here. The contents of the
model-init field are literally included (i.e. “pasted”) in your LAMMPS input script at the point you issue
kim init and the rendered contents of
model-defn are included at the point where you issue
kim interactions. In this case, you can see that there’s a template directive
@<parameter-file-1>@ in the
model-defn field; this gets rendered into the name of the single parameter file that this SM has, IFF-supermodel.params. Since the command that references the file in the
model-defn is an
include itself, this means that the entire contents of that parameter file will be included in your LAMMPS script when you issue
As you can see from the parameter file of this SM, it uses a hard-coded set of integers corresponding to each atomic species, each type of bond interaction, each type of angle interaction, etc, and so it cannot be used portably across LAMMPS simulations by referencing species names. For this case, you need to use
kim interactions fixed_types rather than trying to specify “Pb” as a string, cf. the
kim command docs. You must then figure out, for each kind of interaction you want (pair, bond, angle, dihedral, improper) which specific integers in the parameter file of the SM correspond to Pb and use that when creating the atoms/bonds/angles/dihedrals/impropers in your system (note that with bonded potentials, as in this case, there are commonly multiple variants of a single atomic species that are defined to have different interactions parameters, so you need to be careful). Since all of the different
improper_coeff lines get literally included in your input script, you also need to make sure that you declare a sufficient number of each when you issue your
create_box command. The error you’re currently seeing is occurring because your system only contains a single atom type, but the line
pair_coeff 2 2 0.0350000000 4.5000000000 # ay2 from the parameter file has been literally included in your script; trying to reference atomic species with integer value 2 in this command causes a problem because LAMMPS only allocated memory for a single species.
As you can see, this is a very manual and undesirable situation, and it’s not even just something that’s specific to KIM models. The fundamental problem is really just that LAMMPS uses integers to represent all types, specifically pair/bond/angle/etc types. However, work is underway to change that! As far as I know, PR#2531 is essentially done and is just waiting for final review by the LAMMPS team before being merged. If you’re interested in bonded potentials, I encourage you to ping the developers in the PR comments to let them know this is a priority.