LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
Re: [lammps-users] Regarding force on one group due to another
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lammps-users] Regarding force on one group due to another

From: Sharma MD <>
Date: Tue, 27 Jun 2017 22:49:58 +0530

Hello Axel and all,
Thanks for explaining the use of Force/tally with the example.
However when I run this example I get following error:
ERROR: Compute force/tally used with incompatible pair style. (../compute_force_tally.cpp:72)

How to correct it? Kindly suggest.

On Wed, Jun 14, 2017 at 12:22 AM, Axel Kohlmeyer <akohlmey@...24...> wrote:

On Tue, Jun 13, 2017 at 1:24 PM, Sharma MD <> wrote:
Hello all,

I am using compute group/group command to calculate force from Cu atoms to c atoms since I am using pair potential between two. However for Si and C, I am using tersoff potential, Compute group/group command doesn't work.
How to calculate force on one group due to another group if there is no pair potential between two groups. Kindly suggest.

​for tersoff, you can try compute force/tally from the USER-TALLY package. you will get a warning, but tersoff is compatible with tallying forces, only the virial tally is not completely covered by USER-TALLY for tersoff.

another approach would be to record the trajectory and then use rerun on it, but have only the desired interacting potentials defined and the rest to non using a hybrid style​. then you should get the same result from simply doing compute reduce for fx fy fz.

please see below a small test example of two tersoff si spheres set up to bouncing into each other.

note how the scalar (total force) from compute force/tally is the same as the reduced fx component on the left sphere and the reduced tallied x component of the pairwise forces. for the right sphere, the sign is inverted. now, if there was an additional component in the system, the reduced fx, fy, fz components would be different, but the tallied not, since they would only be accumulated for forces between the two pairs. hence, you would need to use rerun with disabling unwanted interactions plus compute reduce or try compute force/tally, but the latter will not work for a

units           metal

atom_style      atomic
atom_modify     map array
boundary        m m m

# diamond unit cell

variable a equal 5.431
lattice         custom $a               &
                a1 1.0 0.0 0.0          &
                a2 0.0 1.0 0.0          &
                a3 0.0 0.0 1.0          &
                basis 0.0 0.0 0.0       &
                basis 0.0 0.5 0.5       &
                basis 0.5 0.0 0.5       &
                basis 0.5 0.5 0.0       &
                basis 0.25 0.25 0.25    &
                basis 0.25 0.75 0.75    &
                basis 0.75 0.25 0.75    &
                basis 0.75 0.75 0.25

region          myreg block     0 8 &
                                0 4 &
                                0 4

create_box      2 myreg
region          left  sphere 2.0 2.0 2.0 1.2
region          right sphere 6.0 2.0 2.0 1.2
create_atoms    1 region left
create_atoms    2 region right

group           left region left
group           right region right

# choose potential

pair_style      tersoff
pair_coeff      * * SiC.tersoff Si Si
mass            *    28.06

velocity        left set 0.2 0.0 0.0
velocity        right set -0.2 0.0 0.0

compute         ft left force/tally right
compute         fl left reduce sum fx fy fz c_ft[1] c_ft[2] c_ft[3]
compute         fr right reduce sum fx fy fz c_ft[1] c_ft[2] c_ft[3]

fix             1 all nve
timestep        0.001

#dump            1 all movie 100 movie.mpg type type 

thermo_style custom step temp pe vol c_ft c_fl[*] c_fr[*]
thermo          1000
run             10000


Check out the vibrant tech community on one of the world's most
engaging tech sites,!
lammps-users mailing list

Dr. Axel Kohlmeyer  akohlmey@...24...
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.