problems with END to END distance of polymer

Hi LAMMPS users,

i would like to comput end-to-end length of a polymer using LAMMPS directly.
I use this formulation:
variable end_to_end equal sqrt((x[${id1}] - x[${id0}])^2 + (y[$[id1}] -y[${id0}])^2 + (z[${id1}] - z[${id0}])^2)

fix 2 all print 1 "${step} ${end_to_end}" file ../thermo-data-MD/end_to_end.log title "End to End Distance of PCE23-6: step End to End" screen no


but i obtain this error:
<b>ERROR on proc 1: Substitution for illegal variable (input.cpp:414)
ERROR on proc 2: Substitution for illegal variable (input.cpp:414)
ERROR on proc 3: Substitution for illegal variable (input.cpp:414)
ERROR on proc 4: Substitution for illegal variable (input.cpp:414)
ERROR on proc 5: Substitution for illegal variable (input.cpp:414)
ERROR on proc 6: Substitution for illegal variable (input.cpp:414)
ERROR on proc 7: Substitution for illegal variable (input.cpp:414)
ERROR on proc 8: Substitution for illegal variable (input.cpp:414)
ERROR on proc 9: Substitution for illegal variable (input.cpp:414)
ERROR on proc 10: Substitution for illegal variable (input.cpp:414)
ERROR on proc 11: Substitution for illegal variable (input.cpp:414)
ERROR on proc 12: Substitution for illegal variable (input.cpp:414)
ERROR on proc 13: Substitution for illegal variable (input.cpp:414)
ERROR on proc 14: Substitution for illegal variable (input.cpp:414)
ERROR on proc 15: Substitution for illegal variable (input.cpp:414)
Nlocal:    16 ave 122 max 0 min
Histogram: 12 1 0 1 0 1 0 0 0 1
Nghost:    29.75 ave 151 max 0 min
Histogram: 10 0 1 2 1 0 1 0 0 1
Neighs:    416.375 ave 3677 max 0 min
Histogram: 12 1 1 1 0 0 0 0 0 1

Total # of neighbors = 6662
Ave neighs/atom = 26.0234
Ave special neighs/atom = 5.57812
Neighbor list builds = 0
Dangerous builds = 0
ERROR on proc 0: Substitution for illegal variable (input.cpp:414)</b>

where I’m wrong?

Hi LAMMPS users,

i would like to comput end-to-end length of a polymer using LAMMPS directly.

I use this formulation:

variable end_to_end equal sqrt((x[\{id1\}\] \- x\[{id0}])^2 + (y[\[id1\}\] \-y\[{id0}])^2 + (z[\{id1\}\] \- z\[{id0}])^2)

fix 2 all print 1 "\{step\} {end_to_end}" file
../thermo-data-MD/end_to_end.log title "End to End Distance of PCE23-6: step
End to End" screen no

but i obtain this error:

ERROR on proc 1: Substitution for illegal variable (input.cpp:414)
ERROR on proc 2: Substitution for illegal variable (input.cpp:414)
ERROR on proc 3: Substitution for illegal variable (input.cpp:414)
ERROR on proc 4: Substitution for illegal variable (input.cpp:414)
ERROR on proc 5: Substitution for illegal variable (input.cpp:414)
ERROR on proc 6: Substitution for illegal variable (input.cpp:414)
ERROR on proc 7: Substitution for illegal variable (input.cpp:414)
ERROR on proc 8: Substitution for illegal variable (input.cpp:414)
ERROR on proc 9: Substitution for illegal variable (input.cpp:414)
ERROR on proc 10: Substitution for illegal variable (input.cpp:414)
ERROR on proc 11: Substitution for illegal variable (input.cpp:414)
ERROR on proc 12: Substitution for illegal variable (input.cpp:414)
ERROR on proc 13: Substitution for illegal variable (input.cpp:414)
ERROR on proc 14: Substitution for illegal variable (input.cpp:414)
ERROR on proc 15: Substitution for illegal variable (input.cpp:414)
Nlocal: 16 ave 122 max 0 min
Histogram: 12 1 0 1 0 1 0 0 0 1
Nghost: 29.75 ave 151 max 0 min
Histogram: 10 0 1 2 1 0 1 0 0 1
Neighs: 416.375 ave 3677 max 0 min
Histogram: 12 1 1 1 0 0 0 0 0 1

Total # of neighbors = 6662
Ave neighs/atom = 26.0234
Ave special neighs/atom = 5.57812
Neighbor list builds = 0
Dangerous builds = 0
ERROR on proc 0: Substitution for illegal variable (input.cpp:414)

where I'm wrong?

how should we know? the input you provide is incomplete and people
here don't have crystal balls or can read minds...

axel.

May it be spaces in the "equal" string?

There is also a square bracket instead of a curly one in y[$[id1}]

Oleg.

Hi LAMMPS users,

i would like to comput end-to-end length of a polymer using LAMMPS directly.
I use this formulation:

clear
units real
atom_style full
dimension 3
boundary p p p

neighbor 2.5 bin
neigh_modify every 1 delay 0 check yes

# -----------------------------------------------------------
# – Force Field styles -------------------------------------
# -----------------------------------------------------------
bond_style harmonic
angle_style harmonic
dihedral_style harmonic
improper_style umbrella

# style cutoff1 cutoff2
pair_style lj/cut/coul/cut 9.0 10.5

pair_modify mix arithmetic
#Modify the parameters of the currently defined pair style
#mix arithmetic
#epsilon_ij = sqrt(epsilon_i * epsilon_j)
#sigma_ij = (sigma_i + sigma_j) / 2

dielectric 1

special_bonds dreiding # oppure questo lj 0.0 0.0 1.0
#Set weighting coefficients for pairwise energy and force contributions between pairs of atoms that are also permanently bonded
#to each other, either directly or via one or two intermediate bonds.
#The dreiding keyword sets the 3 coefficients to 0.0, 0.0, 1.0 for both LJ and Coulombic interactions, which is the default for
#the Dreiding force field, as discussed in (Mayo).

# -----------------------------------------------------------
# ----------------- Atom Definition Section -----------------
# -----------------------------------------------------------
read_data …/common/system.data

# -----------------------------------------------------------
# ----------------- Settings Section ------------------------
# -----------------------------------------------------------
# bond-type k r0
bond_coeff 1 350.0 1.090 # H_ C_3
bond_coeff 2 350.0 1.530 # C_3 C_3
bond_coeff 3 350.0 1.430 # C_3 C_2
bond_coeff 4 350.0 1.420 # C_3 O_3
bond_coeff 5 350.0 1.320 # C_2 O_3
bond_coeff 6 350.0 1.220 # C_2 O_2

# angle-type k theta0
angle_coeff 1 50.0 109.4710 # X C_3 X
angle_coeff 2 50.0 120.0000 # X C_2 X
angle_coeff 3 50.0 104.5100 # X O_3 X

# dihedral-type k d n
dihedral_coeff 1 1.0 -1 3 # X C_3 C_3 X
dihedral_coeff 2 0.5 -1 6 # X C_3 C_2 X
dihedral_coeff 3 0.5 -1 6 # X C_2 O_3 X
dihedral_coeff 4 2.5 -1 2 # X C_2 O_2 X
dihedral_coeff 5 1.0 -1 3 # X C_3 O_3 X

# improper-type k omega0
improper_coeff 1 40.0 0.0 # C_2 X X X

# atom-type atom-type epsilon sigma cutoff L-J
pair_coeff 1 1 0.0152 2.8464 7.1160
pair_coeff 2 2 0.0951 3.4729 8.68225
pair_coeff 3 3 0.0951 3.4729 8.68225
pair_coeff 4 4 0.0957 3.0331 7.58275
pair_coeff 5 5 0.0957 3.0331 7.58275
pair_coeff 6 6 0.5000 2.8009 7.00225