Question about running a diffusion simulation code using a structure generated after initial NPT and NVT equilibration

I am trying to simulate the diffusion characteristics of hydrogen atoms in an Inconel alloy comprising Ni, Cr and Fe at a specified percentage. Initially, I defined the composition of the alloy and generated the structure, minimized the energy, performed a round of heating and cooling at 3000 K from 300 K and at the end of the last stage of cooling I performed the NPT and NVT equilibrations to get the final structure of the alloy. My LAMMPS script has the codes containing the definition of hydrogen, defining the Lennard-Jones pair-wise potential of hydrogen with all 3 alloy elements and then a further hydrogen diffusion calculation right after the equilibration code. But every time I am running the simulation, it stops after the equilibration stating that an error occurred with “invalid value in set command” for this command- “set type 1 type/fraction 4 0.0008 1322”. What I am doing in this command is setting up a new element type 4 from type 1 (which is Ni defined earlier in the script) with a fraction value of 0.0008. Can anyone please tell me why is this error popping up here? What am I doing wrong and what should I do so that I can define a new type 4 from type 1 with the same fractional value? I have also added the section of codes where I am defining these types after the equilibration of the alloy with 1, 2 and 3 elements. Any help, in this case, will be highly appreciated. Thanks.

Here is the code-

# defining lattice parameter
#variable latparam equal 3.4987
variable        tracerCharge    equal   1 # Hydrogen
variable        trFrac  equal           0.1
#variable n equal 4
#variable t equal 100
#variable p equal $(v_t/v_n)
#variable fb equal 42
#variable fc equal 22

############### Set type fraction for atom percent ###################

# definining the type of metals
# Introduction of new type of tracer element Hydrogen
#set type 1 type/fraction 2 $(v_fb/v_t) 11
#set type 2 type/fraction 3 $(v_fc/v_fb) 12
set type 1 type/fraction 4 0.0008 1322
set type 2 type/fraction 5 0.0008 1422
set type 3 type/fraction 6 0.0008 1522
set type 1 type/fraction 7 ${trFrac} 1013
set type 7 charge ${tracerCharge} # charge of Hydrogen

###################### Group Atoms ###################################
# Atom type 1, 2 and 3 are already defined in the earlier part of this same script for the equilibration simulation
#group Ni type 1
#group Fe type 2
#group Cr type 3

group Ni1 type 4
group Fe1 type 5
group Cr1 type 6

group tracer type 7

pair_style hybrid lj/cut 10 eam/alloy

pair_coeff * * FeNiCr_eam.alloy  Ni Fe Cr
pair_coeff 1 7 lj/cut 0 1.46
pair_coeff 2 7 lj/cut 0 1.37
pair_coeff 3 7 lj/cut 0 1.49
pair_coeff 4 7 lj/cut 0 1.46
pair_coeff 5 7 lj/cut 0 1.37
pair_coeff 6 7 lj/cut 0 1.49
pair_coeff 7 7 lj/cut 0 0

kspace_style ewald/disp 1.0e-10

When reporting issues, please always report which LAMMPS version you are using and platform you are running on.

This input seems incomplete, it has lots of commented out lines, which is very confusing and making it difficult to tell what is going on, and there are many things that don’t make sense and are inconsistent:

  • using a kspace style with pair styles lj/cut and eam/alloy
  • you have atom types referred until type 7, but your pair_coeff line for eam/alloy only refers to three
  • the syntax for that pair_coeff command is incorrect
  • all the lj/cut coefficients have a zero epsilon, so they effectively have no interaction at all, but waste time on determining whether pairs are within the cutoff or not and the cutoff is larger than for the eam/alloy pair style, so you are wasting time on both, the neighbor list build and all pair style executions
  • there is no box being created which is a requirement to set the maximum number of atom types
  • you as assigning a charge, but there are to pair styles using that information

Overall, this all looks like you have no practical experience with writing LAMMPS input at all, yet are trying to set up a rather complex simulation without first gaining some experience in more basic matters.

This is documented behavior and a fundamental property of LAMMPS simulations: you cannot assign an atom type value larger than what was reserved when the simulation box was created. The same applies to bond types, angle types and several other fundamental simulation properties. Please see the documentation of the create_box command — LAMMPS documentation and the read_data command — LAMMPS documentation for details.