Follow-up question on comm->forward_comm_pair(this)

​When I was calculating the inter-particle force calculation for a Many-body DPD as shown in

pair_mdpd.cpp
,​ I thought whether to use comm->forward_comm_pair(this**)** to update the local density or NOT, should deliver the identical result in the case of serial run. However, it turns out that the results look really different (a simple vapor-liquid separation case)

visit0043.png (
comm->forward_comm_pair(this**) is NOT used in**
pair_mdpd.cpp
)
2)
visit0044.png
(
comm->forward_comm_pair(this**) is used in**
pair_mdpd.cpp
)

So if I can understand it correctly, the purpose of comm->forward_comm_pair(this**)** in the case of single core run is to update values for the ghost particles used for periodic boundaries? As I am learning LAMMPS infrastructures, I wan to confirm this.

Thanks in advance for any comments.

Plus, my MDPD implementation seems over-predicting the density distribution in the attached classic test case
in.mdpd
. Ideal rho = 6.88, but mine is around 9.

pair_mdpd.cpp (15.2 KB)

pair_mdpd.h (2.39 KB)

in.mdpd (1.05 KB)

visit0043.png

visit0044.png

When I was calculating the inter-particle force calculation for a Many-body
DPD as shown in
pair_mdpd.cpp
, I thought whether to use comm->forward_comm_pair(this) to update the local
density or NOT, should deliver the identical result in the case of serial
run. However, it turns out that the results look really different (a simple
vapor-liquid separation case)

1)
visit0043.png (
comm->forward_comm_pair(this) is NOT used in
pair_mdpd.cpp
)
2)
visit0044.png
(
comm->forward_comm_pair(this) is used in
pair_mdpd.cpp
)

So if I can understand it correctly, the purpose of
comm->forward_comm_pair(this) in the case of single core run is to update
values for the ghost particles used for periodic boundaries? As I am
learning LAMMPS infrastructures, I wan to confirm this.

that is not how learning things work. if you want to get confirmation,
you have to devise a way to confirm it by yourself.

in this case the confirmation would be rather simpel: set up an
extremely small test system and run with one or two processes. if you
place your atoms right, they should be all local atoms in the first
case, and some should be ghost atoms in the second case. just add
suitable printf() statements to your code to determine whether the
forward communication does what it is supposed to do for the parallel
case.

axel.

yes, on a single proc you have ghost atoms across PBC,

and if you want those ghost atoms to have the value

you calculate, you need to use comm->forward_comm()

even on 1 proc.

Steve

Thanks for reply.

So I am also wondering, if the implementation is correct, then should the serial run and parallel run generate the identical particle trajectories? I think the results should be different, as long as the random force term and random number is involved.

Thanks,

If you’re using random numbers differently in parallel than

in serial, then yes the results will be different.

Steve