Defining and calling integer variables

Hi All,

I’m trying to define a few variables with integer variables in my LAMMPS input, and to call to them later in the file. However, LAMMPS fails to read interpret these variables as integers and returns a corresponding error (“ERROR: Expected integer parameter in input script or data file”).

Is there a way to force a variable to be defined as an integer?

Below is the relevant part of my code:

Here is where I define the integer variables for relevant bond ID, angle, ID, atom type, etc…

variable CO_bond equal 5
variable CCO_angle equal 7
variable CCCO_dihedral equal 8
variable OH_bond equal 2
variable COH_angle equal 5
variable CCOH_dihedral equal 6
variable water_bond equal 1
variable water_angle equal 1
variable C_type equal 1
variable H_type equal 2
variable O_type equal 3
variable zC_type equal 4
variable zH_type equal 5
variable zO_type equal 6

(some unrelated stuff goes here)

This is an example of where I call the previously defined variables:

pair_style lj/cut/coul/long/tip4p v_O_type v_H_type v_water_bond v_water_angle 0.1250 12.000

pair_coeff v_C_type v_C_type 0.0859 3.3997 # C-C

Many thanks!
David

Hi All,

I'm trying to define a few variables with integer variables in my
LAMMPS input, and to call to them later in the file. However, LAMMPS
fails to read interpret these variables as integers and returns a
corresponding error ("ERROR: Expected integer parameter in input
script or data file").

Is there a way to force a variable to be defined as an integer?

david,

that is not your problem.

the locations where you use variables in v_name notation
don't recognize variables like this. all you can use
is ${name} expansion which will be immediate.

the error is not due to integer vs. floating point,
but integer vs. string.

cheers,
    axel.

pair_style lj/cut/coul/long/tip4p v_O_type v_H_type v_water_bond
pair_coeff v_C_type v_C_type 0.0859 3.3997 # C-C

More generally, no input script command allows this syntax (v_foo)
unless the command doc page explicitly says that it allows it.

OTOH, all input script commands allow this syntax:

pair_coeff \{C\_type\} {C_type} 0.0859 3.3997 # C-C

Steve