LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
[lammps-users] summing too many variables in a loop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lammps-users] summing too many variables in a loop

From: Mostafa Nejatolahi <mostafa.nejatolahi@...24...>
Date: Sat, 15 Jul 2017 04:10:07 +0430

Hello all,

I will be appreciated if someone tells me a way to calculate a summation like the following in a shorter way (the number of variables could be higher like 81, 125, ...).

variable        Jx equal v_Jx1+v_Jx2+v_Jx3+v_Jx4+v_Jx5+v_Jx6+v_Jx7&

I used a loop-next-jump command but I got this error:
ERROR: Variable has circular dependency (../variable.cpp:1823)

variable sum equal 0 
variable i loop 27 
label start_of_loop_5 
variable sum equal v_sum+v_Jx$i
jump SELF start_of_loop_5