LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
[lammps-users] In which situations v_A or $A should be used for an variable?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lammps-users] In which situations v_A or $A should be used for an variable?


From: JWG <w.g.jiang@...127...>
Date: Sun, 9 Jul 2017 19:00:37 +0800 (CST)

Dear all,
I used some variables to define a graphene region, but the code doesnt work,


variable alattice equal 4.05
variable xmax equal 20
variable ymax equal 20
variable zmax equal 160
variable cz equal 20
variable distance equal 2.6
variable zgl equal 3.35
variable xgmax equal ${alattice}*${xmax}  # units in distance 
variable ygmax equal ${alattice}*${ymax}
variable zgmin equal ${cz}*${alattice}+${distance}
variable zgmax equal ${zgmin}+${zgl}
region        graphene block 0 ${xgmax} 0 ${ygmax} ${zgmin} ${zgmax} units box

log.test
...
variable zgl equal 3.35#lattice size in z direction of graphene
variable xgmax equal ${alattice}*${xmax}  # units in distance
variable xgmax equal 4.05*${xmax}  
variable xgmax equal 4.05*20  
variable ygmax equal ${alattice}*${ymax}
variable ygmax equal 4.05*${ymax}
variable ygmax equal 4.05*20
variable zgmin equal ${cz}*${alattice}+${distance}
variable zgmin equal 20*${alattice}+${distance}
variable zgmin equal 20*4.05+${distance}
variable zgmin equal 20*4.05+2.6
variable zgmax equal ${zgmin}+${zgl}
variable zgmax equal 83.6+${zgl}
variable zgmax equal 83.6+3.35
region        graphene block 0 ${xgmax} 0 ${ygmax} ${zgmin} ${zgmax} units box
region        graphene block 0 81 0 ${ygmax} ${zgmin} ${zgmax} units box
region        graphene block 0 81 0 81 

ERROR on proc 0: Substitution for illegal variable (../input.cpp:530)
ERROR on proc 3: Substitution for illegal variable (../input.cpp:530)
ERROR on proc 1: Substitution for illegal variable (../input.cpp:530)
ERROR on proc 10: Substitution for illegal variable (../input.cpp:530)
ERROR on proc 11: Substitution for illegal variable (../input.cpp:530)
ERROR on proc 12: Substitution for illegal variable (../input.cpp:530)
ERROR on proc 14: Substitution for illegal variable (../input.cpp:530)
ERROR on proc 16: Substitution for illegal variable (../input.cpp:530)
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 1
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 3
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 11
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 16

for example,  if I have variable A and B, which are defined 
variable A equal 10
variable B equal lx

Now, I am confused about v_A, V_B or $A, $B should be used in the codes.

Thanks in advance.

Mike