!! Variable ID in variable formula does not exist

Dear all

During my simulation, I got an error, “Variable ID in variable formula does not exist”. Here are the details of my simulation.

I have to print dump files of atom style at timesteps that could be decided only during the course of simulation (there are intermediate minimizations, but dump has to be after certain runs), and therefore I dynamically create file that contains timesteps, at which I should create the dump. And then using variable next(), dump_modify every, etc I change the dump frequency. The error above mentioned started after implementing this dynamic frequency of dumping in the source code.

The error looks so bizarre for me since I was unable to find out the error, even after many checks. I would be grateful to you if anybody could point out even if its a care-less petty mistake.

Here are my source code and log_restart files

Source code:

# VARIABLES
variable fname index data.susigrapheneminimlammps
variable simname index datarestart_susigrapheneminimlammps
# Initialization
units real
boundary p p p
atom_style molecular
log log.{simname}.txt* *read_data {fname}
neighbor 3 bin
neigh_modify page 10000000 one 1000000 every 1 delay 0 check no
# dielectric 1.0
# potentials
pair_style lj/cut 20.045 # global cut off 5*sigma sigma for rminij 4.5
pair_coeff 1 1 0.0936 4.009 9.2207 # 2.3 sigma as suggested by doxasrakis
pair_coeff 1 2 0.1015 3.7925 8.72278 #
pair_coeff 1 3 0.1015 3.7925 8.72278 #
pair_coeff 1 4 0.0936 4.009 9.2207 #
pair_coeff 1 5 0.1456 4.009 9.2207 #
pair_coeff 1 6 0.1456 4.009 9.2207 #
pair_coeff 1 7 0.1456 4.009 9.2207 #
pair_coeff 1 8 0.0892 3.8398 8.8315 #
pair_coeff 2 2 0.1 3.3854 7.78642 #
pair_coeff 2 3 0.1 3.3854 7.78642 #
pair_coeff 2 4 0.1015 3.7925 8.72278 #
pair_coeff 2 5 0.1505 3.7925 8.72278 #
pair_coeff 2 6 0.1505 3.7925 8.72278 #
pair_coeff 2 7 0.1505 3.7925 8.72278 #
pair_coeff 2 8 0.0922 3.5279 8.1142 #
pair_coeff 3 3 0.1 3.3854 7.78642 #
pair_coeff 3 4 0.1015 3.7925 8.72278 #
pair_coeff 3 5 0.1505 3.7925 8.72278 #
pair_coeff 3 6 0.1505 3.7925 8.72278 #
pair_coeff 3 7 0.1505 3.7925 8.72278 #
pair_coeff 3 8 0.0922 3.5279 8.1142 #
pair_coeff 4 4 0.0936 4.009 9.2207 #
pair_coeff 4 5 0.1456 4.009 9.2207 #
pair_coeff 4 6 0.1456 4.009 9.2207 #
pair_coeff 4 7 0.1456 4.009 9.2207 #
pair_coeff 4 8 0.0892 3.8398 8.8315 #
pair_coeff 5 5 0.2264 4.009 9.2207 #
pair_coeff 5 6 0.2264 4.009 9.2207 #
pair_coeff 5 7 0.2264 4.009 9.2207 #
pair_coeff 5 8 0.1387 3.8398 8.8315 #
pair_coeff 6 6 0.2264 4.009 9.2207 #
pair_coeff 6 7 0.2264 4.009 9.2207 #
pair_coeff 6 8 0.1387 3.8398 8.8315 #
pair_coeff 7 7 0.2264 4.009 9.2207 #
pair_coeff 7 8 0.1387 3.8398 8.8315 #
pair_coeff 8 8 0.085 3.6705 8.4421 #

bond_style harmonic # CVFF http://redmine.scorec.rpi.edu/anonsvn/lammps-cuda/tools/msi2lmp/biosym_frc_files/cvff.frc
bond_coeff 1 322.8 1.51
bond_coeff 2 655.2 1.34
bond_coeff 3 322.8 1.51
bond_coeff 4 322.8 1.51
bond_coeff 5 322.8 1.51
bond_coeff 6 322.7 1.53
bond_coeff 7 322.8 1.51
bond_coeff 8 480.0 1.42
angle_style harmonic # CVFF, smith paul paper
angle_coeff 1 45 125.0
angle_coeff 2 45 125.0
angle_coeff 3 45 126.0
angle_coeff 4 45 125.0
angle_coeff 5 57 112.0
angle_coeff 6 57 112.0
angle_coeff 7 45 125.0
angle_coeff 8 100 120.0
dihedral_style table spline 10000
dihedral_coeff 1 dihedrallistminimisationsusi.table TORSION13
dihedral_coeff 2 dihedrallistminimisationsusi.table TORSION2
dihedral_coeff 3 dihedrallistminimisationsusi.table TORSION13
improper_style harmonic # a high value
improper_coeff 1 500 0.0
improper_coeff 2 500 0.0
improper_coeff 3 500 0.0
improper_coeff 4 500 0.0
improper_coeff 5 500 0.0
improper_coeff 6 500 0.0

special_bonds lj 0.0 0.0 0.05

compute 1 all reduce max z
compute 2 all reduce min z
thermo 400
thermo_style custom step temp etotal pe ke evdwl eangle ebond edihed eimp lx ly lz density vol press c_1 c_2 # c_inter c_inter[1] c_inter[2] c_inter[3] c_poly[1] c_poly[2] c_poly[3] c_grap[1] c_grap[2] c_grap[3]
min_style cg
minimize 0.0 0.0 5000000 1000000
variable 1 equal c_1
variable 2 equal c_2
variable networkfixed atom “z > (v_2 + (v_1 - v_2)*(5/7))”
group fixednetwork variable networkfixed
group fixedgraphene type 8
group timeintegrable subtract all fixednetwork fixedgraphene
group timeintnetfixed union timeintegrable fixednetwork
# compute load fixedgraphene reduce ave fx fy fz
compute load fixedgraphene group/group timeintnetfixed
variable displacement equal 0

dump 2 all atom 100000000000 dump.*.opening #
dump_modify 2 first yes
dump 1 all dcd 1000000 susiminimlammps.dcd #
dump_modify 1 first yes
variable tm equal step+10
print {tm} file time.txt* *print 100000000000 append time.txt #* *variable filassign file time.txt* *variable timeselect equal next(filassign)* *dump_modify 2 every v_timeselect* *# equilibration to 305 K 1 atm* *timestep 0.05* *velocity all create 305.0 123456 rot yes dist gaussian* *fix 1 all npt temp 305.0 305.0 100.0 iso 1.0 1.0 20000.0 tchain 1 pchain 14 # drag 4* *velocity all scale 305.0* *fix 2 all momentum 1 linear 1 1 1* *thermo_style custom step temp etotal pe ke evdwl eangle ebond edihed eimp xlo xhi ylo yhi zlo zhi c_load[1] c_load[2] c_load density press v_displacement c_load[3]* *thermo 100* *run 10* *unfix 1* *unfix 2* *variable displacement delete* *undump 1 #* *write_dump all custom dump.intermediatesusigrapheneopen id type x y z ix iy iz modify sort id* *variable n4 equal 5* *variable a loop {n4}
label loop4
_variable displacement equal .125*{a}_ *timestep 0.05* *fix 1 fixednetwork move linear 0.0 0.0 0.0 units box* *fix 2 fixedgraphene move linear 0.0 0.0 -0.0025 units box* *fix 3 timeintegrable nve* *thermo_style custom step temp etotal pe ke evdwl eangle ebond edihed eimp xlo xhi ylo yhi zlo zhi density press* *thermo 200* *run 1000* *unfix 1* *unfix 2* *unfix 3* *# Minimization* *fix 1 fixednetwork setforce 0.0 0.0 0.0* *fix 2 fixedgraphene setforce 0.0 0.0 0.0* *thermo 400* *thermo_style custom step temp etotal pe ke evdwl eangle ebond edihed eimp xlo xhi ylo yhi zlo zhi density press* *min_style cg* *minimize 0.0 0.0 5000000 1000000* *unfix 1* *unfix 2* *variable tm equal step+35* *print {tm} file time.txt*
print 100000000000 append time.txt
variable filassign file time.txt
variable timeselect equal next(filassign)
dump_modify 2 every v_timeselect
timestep 0.05
fix 1 fixednetwork setforce 0.0 0.0 0.0
fix 2 fixedgraphene setforce 0.0 0.0 0.0
velocity fixednetwork set 0.0 0.0 0.0 units box
velocity fixedgraphene set 0.0 0.0 0.0 units box
fix 3 timeintegrable npt temp 305.0 305.0 100.0 iso 1.0 1.0 2000.0 tchain 1 pchain 14 # drag 4
thermo 100
thermo_style custom step temp etotal pe ke evdwl eangle ebond edihed eimp xlo xhi ylo yhi zlo zhi c_load[1] c_load[2] c_load density press v_displacement c_load[3]
run 35
unfix 1
unfix 2
unfix 3

Dear all

During my simulation, I got an error, "Variable ID in variable formula does
not exist". Here are the details of my simulation.

I have to print dump files of atom style at timesteps that could be decided
only during the course of simulation (there are intermediate minimizations,
but dump has to be after certain runs), and therefore I dynamically create
file that contains timesteps, at which I should create the dump. And then
using variable next(), dump_modify every, etc I change the dump frequency.
The error above mentioned started after implementing this dynamic frequency
of dumping in the source code.

The error looks so bizarre for me since I was unable to find out the error,
even after many checks. I would be grateful to you if anybody could point
out even if its a care-less petty mistake.

since this is a near-unreadable and complex input. it is not very
likely that somebody will sit down and debug this from reading through
it. you will make your own life much easier, if you make this more
readable and structured.

why don't you apply standard debugging techniques and take out as many
lines from this script as possible without triggering an additional
error and then more easily identify the mistake, or start from scratch
with an empty input and then test out each of the "tasks" that you
have in your convoluted script individually and see where things
break.

with both approaches you should converge to the same problematic part
of the input and then it should be straightforward to resolve the
problem.

axel.

Dear all

The part of the code which used to create file containing dynamic frequencies was deleted. Instead, a vary was used to assign every and inorder to avoid subsequent unnecessary dumps succeeding the minimizations, undump was used after the required dump. When ever dump was needed, this method was used.

Old segment

variable tm equal step+10
print ${tm} file time.txt
print 100000000000 append time.txt #
variable filassign file time.txt
variable timeselect equal next(filassign)
dump_modify 2 every v_timeselect

.
.
.
run 10
.
.

New segment

dump 2 all custom 10000 dump.*.current id mol type x y z
variable tm equal step+10
dump_modify 2 every v_tm

.
.
.
run 10
.
.

undump 2

Thank you
Jeeno Jose

Dear all

The part of the code which used to create file containing dynamic
frequencies was deleted. Instead, a vary was used to assign every and
inorder to avoid subsequent unnecessary dumps succeeding the minimizations,
undump was used after the required dump. When ever dump was needed, this
method was used.

Old segment

variable tm equal step+10
print ${tm} file time.txt
print 100000000000 append time.txt #
variable filassign file time.txt
variable timeselect equal next(filassign)
dump_modify 2 every v_timeselect

.
.
.
run 10
.
.

New segment

dump 2 all custom 10000 dump.*.current id mol type x y z
variable tm equal step+10
dump_modify 2 every v_tm

if i add these 3 lines of input script to a working input, there is no
problem, no error message.

axel.