[lammps-users] Setforce and addforce

Dear lammps users,

By applying the fix setforce 0 0 -1 command, the manual says this command will erase all the original forces. will this setforce erase all the pair forces and cohesion forces during running?

Besides, the fix addforce command is applying a force value on each atom. For a given solution under pressure, what is the best way to calculate the force on each atom? Right now, I calculate as below, but this gives me a small force value, all the particles stand still without any movement.
image.png

Best Regards
Ting

Neither fix setforce nor fix addforce are a way to “calculate” forces. This is done by pair styles, bond styles and so on.

there is not enough information here and what you state is quite confusing, so it is not possible to give any specific advice.

axel.

image.png

Hi Axel,

Sorry for being confusing.

the entire following paragraph makes no sense to me. i do not know this. there is no context about what force you are talking and how this is to be computed and what the purpose is.

Now we only know the force applied in the whole region is F0=6N, this 6N is the force value applied in the whole region. In this region, there are solvents particles and solute particles. So I calculated the force on each atom based on this equation manually.
image.png
After this, I can use the fix addforce or fix setforce command with force value ‘f(atom)’ on each atom.

But the particles don’t move with fix addforce. If I use fix setforce, the particles will move well. I don’t understand why there is such a difference.

So I just want to use fix setforce to add forces on atoms. With fix setforce, the manual says that it will erase the original forces. I am not sure whether the forces from pair style setting are still counted or not if fix setforce. If so, the fix setforce is definitely not good for adding forces.

the manual is clear on that. fix setforce will replace the original forces.

what happens without either fix setforce or fix addforce?

are there any warnings?

it would be best if you post a smaller demo input and the corresponding output.

axel.

Hi Axel,

Sorry for being confusing.
Now we only know the force applied in the whole region is F0=6N, this 6N is the force value applied in the whole region. In this region, there are solvents particles and solute particles. So I calculated the force on each atom based on this equation manually.
image.png
After this, I can use the fix addforce or fix setforce command with force value ‘f(atom)’ on each atom.

But the particles don’t move with fix addforce. If I use fix setforce, the particles will move well. I don’t understand why there is such a difference.

So I just want to use fix setforce to add forces on atoms. With fix setforce, the manual says that it will erase the original forces. I am not sure whether the forces from pair style setting are still counted or not if fix setforce. If so, the fix setforce is definitely not good for adding forces.

Best Regards
Ting

Axel Kohlmeyer <[email protected]>于2021年5月10日 周一下午4:58写道:

Hi Axel,
With fix setforce, the particle move along the force direction. With fix addforce, the particle stand still. All the other commands are the same.
If this doesn’t work, any suggestions for applying a pressure to a region to simulate the pressure driven filtration?
Regards
Ting

Axel Kohlmeyer <[email protected]>于2021年5月10日 周一下午5:24写道:

image.png

Hi Axel,
With fix setforce, the particle move along the force direction. With fix addforce, the particle stand still. All the other commands are the same.

sorry, but this doesn’t make a lot of sense. if the input is exactly the same with just fix setforce replaced by fix addforce, then particles have to move in all cases.

now, they may not be moving a lot, if there is a difficult to penetrate barrier. when using fix setforce you will be wiping out all resistance from that barrier since the existing forces will be discarded (that is the difference between “add” and “set”) and thus particles can just move “trough” the barrier. so it appears from this (still very limited information) that fix addforce is showing the behavior that is consistent with the system you intend to simulate.

If this doesn’t work, any suggestions for applying a pressure to a region to simulate the pressure driven filtration?

this all looks to me as if you are having fundamental problems with understanding MD simulations and simulation timescales and how the process of setting up, verifying and interpreting your results works. that is not something that we can teach you on a mailing list. you need to get proper tutoring and advising for that. if I remember correctly, I have already mentioned that before.

axel.

image.png

Hi Axel,
I have attached the input script. My installed LAMMPS version is 30 Jun 2020 on Ubuntu.
I only changed the setforce to addforce, then the particles no longer move, as shown in the two output videos.
The other existing forces are the pair style and fix viscous, it should not have strong barrier forces. This really confused me.
Sadly I am learning lammps with manual, google, literature, forums, chat groups, and mailing list.
Best regards

Ting

image.png

addforce.mp4 (150 KB)

in.setforce (2.68 KB)

setforce.mp4 (82.2 KB)

sorry, but as I already said, this is now moving into the realm of providing scientific advising and thus has next to nothing to do with LAMMPS itself. thus it is mostly outside of the scope of this mailing list.

I already told you my opinion on undertaking such a research project without proper and competent tutoring and advising support, when you don’t have the prerequisite training, knowledge, and skills. you are bound to make many mistakes or get confused. and it will only get worse.
mind you the confusion you have is with a rather trivial matter. just imagine what else you will be missing and not understanding if you come across a “difficult” problem.

if you cannot get competent advising and tutoring, you will be better off abandoning your project right now instead of wasting a lot of time and effort only to find out later that many or all your simulation results are tainted because of not-so-obvious mistakes you made because of lack of knowledge and training.
getting simulations correctly requires more than being told the “one proper command to do what I need to be done”. you are up against ~50 years of accumulated knowledge and experience and that is not something that you can learn on your own or from what you find with google.

axel.

image.png

Hi Axel
I agree. You are right. Thank you for your kind suggestions.
Regards
Ting

Axel Kohlmeyer <[email protected]>于2021年5月10日 周一下午11:01写道:

image.png