force calculation

can i compute the force acting on a particle in fluid due to temperature gradient by using compute group/group command

This question is really about sampling the potential of mean force. There are many ways to do this. I am not sure I have ever seen anyone use the method you describe (measuring average displacement of a particle restrained by a harmonic well). A more straightforward method would be to literally do nothing. Exclude the particle from the MD fix (e.g. fix nve) so its position is never updated. You can still sample the force on the particle and average it at whatever frequency you need:

group atom1 id 1
group md subtract all atom1
variable fx1 equal fx[1]
variable fy1 equal fy[1]
variable fz1 equal fz[1]
fix pmf all ave/time 10 100 1000 v_fx1 v_fy1 v_fz1 file pmf.dat

I ran a simple test with all the particles assigned an average x-velocity of +1.0 in LJ units. The output shows fx1 gradually decreasing from a large positive value.

[athomps@…5834… genericmd]$ more pmf.dat

Time-averaged data for fix pmf

TimeStep v_fx1 v_fy1 v_fz1

1000 26.5592 3.81859 -8.05658
2000 26.3908 1.34714 2.41531
3000 30.1356 3.47733 -1.23915
4000 21.8561 1.9043 2.57763
5000 25.4985 -0.638132 2.57419
6000 26.4464 -1.08122 -0.114759
7000 20.4708 6.58261 3.55364
8000 23.0757 0.731702 -5.06514
9000 21.2459 -2.19472 2.42222
10000 17.1818 0.222538 3.96738

My name is Nikitha. You reply to my doubt in lammps.

First of all thanks Aidan for your reply.
But to be fair i don't understand your method. Sir, actually i'm studying
thermophoretic effect(motion of nano sized particle against temperature
gradient) of particle in liquid. Actually i want to measure the force
acting on particle due to thermophoresis effect. For the same i apply a
temperature gradient to my system (liquid argon) and i obtained a linear
temperature gradient. Now i need to measure the force on particle. I have
two ideas in my mind
(1) if i fix the particle in fluid domain with a particle spring constant
during my equlibrium run(before applying temperature gradient) and if know
the displacement of particle once the transient state is reached and
running the system for 5ns i can find out the force.
(2) after 5nm run measure the force exerted by surrounding fluid on
nanoparticle

i need to know which command i have to use to implement the idea

I just told you which commands to use. There is no need to allow the particle to move. Instead, let the liquid argon move around it. Anything you do with springs will just be more complicated. I append my sample script.

Aidan

[athomps@…5834… genericmd]$ more in.test

3d Lennard-Jones melt

units lj
atom_style atomic

atom_modify map hash

boundary p p p
lattice fcc 0.8442
region box block 0 10 0 10 0 10
create_box 1 box
create_atoms 1 box
mass 1 1.0

velocity all create 3.0 87287
velocity all set 1.0 NULL NULL sum yes
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5

neighbor 0.3 bin
neigh_modify every 20 delay 0 check no

group atom1 id 1
group md subtract all atom1
variable fx1 equal fx[1]
variable fy1 equal fy[1]
variable fz1 equal fz[1]
fix pmf all ave/time 10 100 1000 v_fx1 v_fy1 v_fz1 file pmf.dat

variable x1 equal x[1]
variable y1 equal y[1]
variable z1 equal z[1]
compute mype all pe

fix 1 md nve

thermo_style custom step temp pe ke etotal press c_mype v_x1 v_y1 v_z1
thermo 50
run 10000

thanks steve for your suggestion. its work for me i guess

thanks steve for your suggestion. its work for me i guess

guessing is *never* a good approach in science. either you can prove
that you are doing the right thing or not.

same as aidan, i think your approach is needlessly complicated and
possibly missing the point. it feels a lot like you are trying to
apply a macroscopic model to a microscopic situation. even more so, by
tethering your reference atom you may perturb your system and you'll
have to consider the impact of the strength of the tether on your
results. also, you may have to check on how much the viscosity of your
liquid has an impact.

on the other hand, you already *have* the forces acting on each
particle. it is part of the MD simulation where you have direct access
to data, not available macroscopically. and if your interest is to
compute the net force in space due to the temperature gradient, i
would just go and average the force.
a more practical approach in my opinion would be to set up 1d slices
as chunks and use fix ave/chunk to get a "net force profile" across
the direction of the temperature gradient.

at any rate, if you ever plan to publish the results, you need to find
a solid statistical mechanical derivation of what you are computing.
"i guess" isn't sufficient.

axel.

thanks Dr. Axel for your valuable suggestion.