[lammps-users] net force on granular particle

Hi Ram,
Please forward all your questions to LAMMPS group so that the discussion can archived and useful for others in future.

To extract the force or any other quantity (which are not directly written to a file) generally I go to the code (i have already pointed out where these calculations takes place in my previous email) and write them in a separate file using “fprintf” command. You just need to go to the code and write F[i][0] etc. in a file, i generally do not prefer to this by input script.

Its just a guideline and may vary from different applications and in that case you have to think little more about how to do this for your purpose.

Regards,
Vidya

Dear Vidyapati,
I am intermediate programmer in C++ so I cant modified codes. Please can you guide me? Can I calculate net force from three forces fx fy and fz which lammps dumps in dumpfile. Like F=sqrt(fx^2+fy^2+fz^2)? Is this net force on ith particle due to jth particle?
Sincerely yours…R


|

Hi Ram,
I too a not expert of C++ but can do some changes to make my living:) If you want to dump the force every time step, then you need to use “pair_gran_history.cpp” file, in this there is a function called “compute” which get called every time step from “verlet.cpp”. In the “compute” function all force and stress calculations being performed for a granular system. Similar calculations are also performed in “fix_gran_history.cpp” in function name “stress_histroy” but that is not called every time steps (its gets called when you want to write the stresses, velocities to the file).

  1. In “compute” function of the “pair_gran_history.cpp” f[i][0] is the x direction force on the i^th particle, similarly f[i][1] and f[i][2] are the y and z direction force on the i^th particle due to neighboring particles. So you can simply calculate F_{net} as you mentioned in your email, thats does not requires any knowledge of C++.
  2. The net force on the particle j will just -ve of that of on ith particle because of Newton’s 3rd law.
  3. You can simply write this quantities to any files by suing “fprintf” command. (Search on google about the format of this command).
  4. You can see in the existing code how you can open a file and close it, really most of the changes you need will be there in existing code, you just need to change some names.

I will advise you to at least understand the “pair_gran_history.cpp” or “fix_gran_diag.cpp” if you want to work on granular stuff, you can follow this paper to understand the code

"Granular flow down an inclined plane: Bagnold scaling and rhelogy", PRE, Volume 64, 051302.

See the section II of this paper, essentially that there in the code. I too never work in C++ before (I am a Fortran guy) but picked up some of it slowly. See this website for your reference

http://www.cplusplus.com/doc/tutorial/

I think these all i can do for you, rest of all depends upon you!!!
Regards,
Vidya

If you don’t want to modify the source code, you can
dump the total force on an atom with the dump custom
command. Thus fx on the Ith particle will be the
sum of all the forces it feels from nearby J particles, which
I think is what you first asked. You could write a formula
for an atom-style variable to sum fx^2+fy^2, etc and dump
that.

If you weren’t wanting this for granular interactions,
you could use compute pair/local to get a list of I-J interactions,
e.g. forces on a pairwise basis, but that only works for
some pair styles. Granular can’t do it b/c of the history-dependent
interactions.

Steve