multisphere clump generated at a pre-specified location

Submitted by zhou_yu on
richti83

no, but I hacked the fix_insert_pack to do so:
line 134ff

else if (strcmp(arg[iarg], "atP") == 0) {
if (iarg + 4 > narg) error->fix_error(FLERR, this, "");
px_ = atof(arg[iarg + 1]);
py_ = atof(arg[iarg + 2]);
pz_ = atof(arg[iarg + 3]);
insert_at = true;
iarg += 4;
hasargs = true;
} else if(strcmp(style,"insert/pack") == 0)

line 437ff

if(all_in_flag) ins_region->generate_random_shrinkby_cut(pos,rbound,true);
else if (insert_at) {
pos[0] = px_;
pos[1] = py_;
pos[2] = pz_;
}

don't forget to declare the global variables in the header file !
Than you can use atP $x $y $z inside the input deck in a loop

Wed, 6 Apr 2016 - 15:03 Permalink
zhou_yu

In reply to by richti83

I am not quite familiar with C++. I followed with your hint and added the argument "atP" as follow (from line 132ff, a little different from your hint).

} else if (strcmp(arg[iarg], "atP") == 0) {
if (iarg + 4 > narg) error->fix_error(FLERR, this, "");
px_ = atof(arg[iarg+1]);
py_ = atof(arg[iarg+2]);
pz_ = atof(arg[iarg+3]);
insert_at = true;
iarg += 4;
hasargs = true;
} else if(strcmp(style,"insert/pack") == 0)
error->fix_error(FLERR,this,"unknown keyword");
}

Then I add the position ( the adjacent lines included):

do
{

if(all_in_flag) ins_region->generate_random_shrinkby_cut(pos,rbound,true);
else if (insert_at) {
pos[0] = px_;
pos[1] = py_;
pos[2] = pz_;
}
else ins_region->generate_random(pos,true);
ntry++;
}
while(ntry < maxtry && domain->dist_subbox_borders(pos) < rbound);

if(ntry == maxtry) break;

the above shows the changes in cpp file, and I am not sure what needs to be added into the head file.
I added some as follows:

double atP;
double pos[3];
double px_;
double py_;
double pz_;
int insert_at;

These changes do make the 'make fedora' work with no error, and the 'lmp_fedora' can check the argument 'atP', but the following position is ignored, just seems like the 'atP 0 0 0' is skipped.
Could you help me and give more hints?
Thanks a lot.

Mon, 11 Apr 2016 - 16:50 Permalink
richti83

In reply to by zhou_yu

I'm not in the office so I try to help from memory:

//double atP; //<- not used
//double pos[3]; //<-- local definded in insert_pack::x_v_omega()
double px_;
double py_;
double pz_;
int insert_at; // should be bool but doesn't matter

Maybe a make clean-all && make fedora is necessary ...

Mon, 11 Apr 2016 - 19:44 Permalink
Westbrink

Hi I am a very new LIGGGHTS user and have to use multispheres.
Due to this it is necessary to "place" these multispheres at a distinct position.

I tried your code and re-complied via "make fedora". There are no errors etc, but there will be no atoms inserted
Did I anything wrong?
Do you have a hint?

region insert_box1 block -5 5 -10 10 10.1 15 units box
fix ins1 all insert/pack seed 1001 distributiontemplate msd1 insert_every once overlapcheck yes particles_in_region 10 atP 0 0 0 region insert_box1 ntry_mc 10000
region insert_box2 block -5 5 -10 10 10.1 15 units box
fix ins2 all insert/pack seed 1001 distributiontemplate msd2 insert_every once overlapcheck yes particles_in_region 20 region insert_box2 ntry_mc 10000

PS: The "old" insert/pack does not work anymore

Fri, 8 Apr 2016 - 15:09 Permalink
richti83

Your z Position is outside the Region.

Check if the reg used in create box command includes the atP coords otherwise the newly created particles are deleted asap.
Set particles in Region for first insert to 1 otherwise you will create 10 totally overlapping clumps and this is Bad.

Maybe the lines i mentioned are not exact because of my changes check the sourrounding lines of code.

Fri, 8 Apr 2016 - 17:07 Permalink
Westbrink

Hi all,

I installed a new simulation machine with the newest version of LIGGGHTS and implemented the changed code into the insert/pack command.
If my code has mutiple "run" commands, the particles are unexpetly delted after the second run command.

Does anyone else has similiar problems and a solution?

Regards,
Westbrink

Wed, 28 Sep 2016 - 15:13 Permalink
richti83

I guess my patch does not check if the insert position is inside the subdomain of a specific process (as before 3.5.0 we only have had single core multispheres), so every instance inserts at "atP". Try fix .. multisphere/nointegration and check dump file if there are particles at exact same position (this will lead to 100% overlap -> a=NAN -> f=NAN -> particles flying away in 1 step to nirvana)
In my case changing

else if(ntotal_region > 0)
{
MPI_Sum_Scalar(np_region,world);
if (insert_at) ninsert_this = 1;
else ninsert_this = ntotal_region - np_region;
insertion_ratio = static_cast(np_region) / static_cast(ntotal_region);
}

in fix_insert_pack.cpp line 320ff
helped.

Sat, 1 Oct 2016 - 22:30 Permalink

can the multisphere clump generated at a specified location?