LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
Re: [lammps-users] fix/pair_style works in serial but do not work in parallel?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lammps-users] fix/pair_style works in serial but do not work in parallel?


From: Axel Kohlmeyer <akohlmey@...24...>
Date: Wed, 1 Nov 2017 18:42:18 -0400



On Wed, Nov 1, 2017 at 6:32 PM, Quang Ha <quang.t.ha.20@...43...4...> wrote:
> ... and in case you want to keep support for newton pair, you probably
> need to as a reverse communication at the end of your pair style.

Thanks, Axel. How would I go around to implement this? Rather, the documentation doesn't mention explicitly how, so any guidance toward where I could dig through would be great!

​this is also in response to your other post. you are now asking for more help than people here on the list can provide. nobody will go and debug/fix your code.
you'll have to learn the same way all of us did: read the source code​, or collaborate with a person that is willing and has the time to tutor you (and whom you can make an offer that is of mutual benefit).
you've been given quite a lot of pointers and recommendations. 

axel.

 

Thanks,
Quang

On 30 October 2017 at 13:59, Axel Kohlmeyer <akohlmey@...24...> wrote:
On Mon, Oct 30, 2017 at 11:45 AM, Quang Ha <quang.t.ha.20@...24...> wrote:
> Hi all,
>
> SHORT VERSION: I have written my fixes and pair styles to allow
> concentration diffusion. It works nicely in serial, but it chokes in
> parallel. What are the common errors that people make when implementing new
> fixes/pair styles that I could look into to fix this?
>
> LONGER VERSION (my apologise...): I don't think this is the right way to do
> it, but I got something to work (also it helped understanding how LAMMPS
> structure). I defined a new property using fix property/atom in the input
> script, here:
>
> https://github.com/quang-ha/lammps-test-case/blob/master/concentration_diffusion/sph_conc_diffusion_2d.lmp
>
> Then I added a new fixes and pair_style to allow the diffusion of the
> property here (the concentration cA):
>
> https://github.com/quang-ha/lammps/blob/concentraion_diffusion/src/USER-SPH/fix_meso_concentration_A.cpp
>
> https://github.com/quang-ha/lammps/blob/concentraion_diffusion/src/USER-SPH/pair_sph_concA_diffusion.cpp
>
> While I would truly appreciate being criticised about code-styles and
> good/bad practice (please do! I am still learning), I would love to know
> which step I missed out? Do I need to regenerate/update the values of the
> ghost atoms (from what I collected here
> http://lammps.sandia.gov/doc/Developer.pdf) at each time step? Bear in mind
> the code is still simply a proof on concept at this stage - I have not
> sanitise all inputs errors and make it truly robust...

from a quick check it it looks to me, as if you are not paying
attention to local vs. ghost atoms.
to have properties on ghost atoms communicated, you need to signal
this with fix property/atom.
also, you are initializing only local atoms, but you should intialize
local *and* ghost atoms, or you have to disallow newton == 1.

... and in case you want to keep support for newton pair, you probably
need to as a reverse communication at the end of your pair style.

>
> Also, I have a feeling like my approach is fundamentally wrong. Some
> instincts tell me that it would be better to implement the new properties
> inside the atom styles instead of introducing them anew in each script?

no. several styles do this and modifiying and maintaining atom_vec
styles has become a major nightmare. if fix property/atom had come
along earlier, other atoms styles would have been recast to use that
fix instead of building an atom style of their own. there are
extremely few cases of properties, where the implementation directly
into the atom style is warranted.

if desired, you can embed the call to fix property/atom into the fix
style construction process. you just need to add it to the
Fix::post_constructor() call, since the way how LAMMPS instantiates
fixes is incompatible with creating a second fix from inside the
constructor of a first fix. fix rx in USER-DPD takes advantage of
that, for example.

axel.

>
> Thanks,
> Quang
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> lammps-users mailing list
> lammps-users@...655....net
> https://lists.sourceforge.net/lists/listinfo/lammps-users
>



--
Dr. Axel Kohlmeyer  akohlmey@...24...  http://goo.gl/1wk0
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.




--
Dr. Axel Kohlmeyer  akohlmey@...24...  http://goo.gl/1wk0
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.