LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
[lammps-users] Questions about loop in lammps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lammps-users] Questions about loop in lammps


From: "Xuechen Zheng" <xuechen_zheng@...730...>
Date: Tue, 12 Dec 2017 23:20:35 +0800 (GMT+08:00)

Dear all,

   I would like to addforce to lammps and the force is calculated by python scripts. However, it seems that it just evaluates the forces per atom. I want to sum the force of all atoms and add it to all atoms. The present input file is 

variable         tz2 equal z[1]
 variable         tx2 equal x[1]

 variable         tz2 equal z[1]

 variable         force_z python force_CH4_z
 python           force_CH4_z input 3 v_tx2 v_ty2 v_tz2 return v_force_z format ffff file  interp.py

 fix               3 all addforce 0 0 v_force_z

It just calculate the first atom's force and it works. Could you tell me how to do a loop that can sum the force of all atoms and do the remaining calculation. I tried the flowing commend

label            loop 

variable         a loop 100

variable         tz2 equal z[a]

variable         tx2 equal x[a]

variable         ty2 equal y[a]


variable         force_z python force_CH4_z

python           force_CH4_z input 3 v_tx2 v_ty2 v_tz2 return v_force_z format ffff file interp.py

fix               3 all addforce 0 0 v_force_z

clear

next              a

jump             z_move.force

"

But the result is that "Segmentation fault". Could you tell me how to set a corect loop? 

Thanks!



Xuechen Zheng