|From:||Axel Kohlmeyer <akohlmey@...24...>|
|Date:||Wed, 1 Nov 2017 18:42:18 -0400|
> ... 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!
Thanks,QuangOn 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:
mmps-test-case/blob/master/con centration_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):
mmps/blob/concentraion_diffusi on/src/USER-SPH/fix_meso_ concentration_A.cpp
mmps/blob/concentraion_diffusi on/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
eveloper.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.
> 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
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.