Hi LAMMPS developers,
I have started to use lammps recently and the LAMMPS documentation is really helpful for me to learn myself as a beginner. I am struggling to solve a simple problem of using group-id properly. I am trying to update the forces on each of the atoms in my system by using ‘fix addforce’ command. I need to update different forces on each atom, where the forces are variables run by ‘loop’ across all the 76 atoms in my system.
variable nFx file Fx.txt #Forces
variable nFy file Fy.txt
variable nFz file Fz.txt
variable nid loop 76
group sub id ${nid}
fix 2 sub setforce 0.0 0.0 0.0
fix 3 sub addforce ${nFx} ${nFy} ${nFz} every 1
next nFx nFy nFz
next nid
When I use the above commands, the forces on all of the atoms are being replaced by the forces of the last (76th) atom. I think this is due to the ‘group-id’ which is being 76 in the last iteration. Is it possible to update the corresponding forces on each atom properly by means of atom-id or group-id ?
Thanks a lot for reading about my problem. I hope I made my explanation clear and would get some help from you. Thanks again!