Gaussian distribution for radii using particletemplate/sphere and particledistribution/discrete

Submitted by willroc7 on Mon, 08/29/2011 - 17:28

Is it possible to use a gaussian distribution of radii for the particletemplate/sphere command? The documentation says it is possible but I am getting the following error:

ERROR: Random style gaussian not available for radius

My pertinent code is:
fix pts1 all particletemplate/sphere 1 atom_type 1 density constant 2500 radius gaussian 0.0003 0.00005
fix pdd1 all particledistribution/discrete 1. 1 pts1 1.0

Thanks,
Will

ckloss's picture

ckloss | Tue, 08/30/2011 - 09:06

I will remove it from the doc. The reason is that it does not really make sense as a gaussian dist will exhibit negative values. You can approximate the distribution you want by multiple particletemplate/sphere commands

Christoph

msbentley's picture

msbentley | Tue, 08/30/2011 - 14:45

I see that the latest dev version includes instead a lognormal distribution, but for all my attempts at finding sane input parameters I get an error:

ERROR: mass_shift_ not implemented for lognormal

Any suggestions?

Thanks! Mark

ckloss's picture

ckloss | Tue, 08/30/2011 - 14:48

Hi Mark,
It is what it says... something is not implemented yet :-) Its just simple math but I did not yet have time to dig into how to translate a mass-based log-normal distribution (which is defined via the input script) into a number-based distribution (which is used for insertion). If anybody has time and is willing to do the math or knows a clever way how to do it, I will include it in the next release

Christoph

drheine | Fri, 11/09/2012 - 22:11

I haven't figured out a clever way to do it. Has anyone implemented the mass-based log-normal distribution? I can get the number-based mean from the mass-based mean, but I'm not sure what the full number distribution should look like in terms of the mass mean and standard deviation.

David

drheine | Tue, 12/18/2012 - 22:01

I spent a little time looking into the mass based log-normal distribution and found that for a mass distribution characterized by mu and sigma, the number based distribution should be a log-normal distribution with mu_number = mu - 3 * sigma^2 and sigma_number = sigma.

I made the following modification to fix_template_sphere.cpp starting at line 158:

else if (strcmp(arg[iarg+1],"lognormal") == 0)
{
if(iarg+5 > narg)
error->fix_error(FLERR,this,"not enough arguments for lognormal");
if(strcmp(arg[iarg+2],"mass") == 0)
pdf_radius->activate_mass_shift();
else if(strcmp(arg[iarg+2],"number"))
error->fix_error(FLERR,this,"expecting 'mass' or 'number'");
if(force->cg() > 1.)
error->fix_error(FLERR,this,"cannot use distribution with coarse-graining.");
double mu = atof(arg[iarg+3]);
double sigma = atof(arg[iarg+4]);
if(strcmp(arg[iarg+2],"mass") == 0)
mu = mu - 3.0*sigma*sigma;
if( sigma <= 0. ) error->fix_error(FLERR,this,"illegal sigma value for radius");
pdf_radius->set_params(mu,sigma);
iarg += 5;
}
<\code>
David

ckloss's picture

ckloss | Tue, 12/25/2012 - 15:13

Hi David,

thanks for doing the math :-) I'll include this into the next release.

Cheers, Christoph