Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better handling of neutralizing populations #124

Open
germasch opened this issue Sep 18, 2020 · 0 comments
Open

better handling of neutralizing populations #124

germasch opened this issue Sep 18, 2020 · 0 comments

Comments

@germasch
Copy link
Contributor

From @wrfox
...
if(pop == HE_population){
init_npt(non_neutralizing_population, pos, p, {jx, jy, jz}, npt);
npt.n *= HE_ratio;
...

Better is for all the case-specific code should be in init_npt.
Therefore, init_npt should return the correct density of HE particles to add. It should not need to be modified in setupParticles.
Second, there should not need to be a “non_neutralizing_population” variable

Second, I propose the pseudo-code should do the loop in the following order to handle the FIXME:

// positive charges
For each population pop
if (pop == Neutralizing population)
Continue

    call init_npt (pop, …)

    If npt.kind.q < 0
         continue

// else positive charge
     n_in_cell = get_n_in_cell ...
 	n_q_in_cell += kinds_[npt.kind].q * n_in_cell;
    inject..

end

// negative charges
For each population pop
if (pop == Neutralizing population)
Continue

    call init_npt (pop, …)

    If npt.kind.q >= 0
         continue

// else negative charge
     n_in_cell = get_n_in_cell

// make sure don’t add non-neutralizable amount
if n_q_in_cell + kinds_[npt.kind].q * n_in_cell < 0
	n_in_cell = -n_q_in_cell / kinds_[npt.kind].q;

 	n_q_in_cell += kinds_[npt.kind].q * n_in_cell;

    inject..

end

// now add neutralizing population
call init_npt (neutralizing population, …)
n_in_cell = -n_q_in_cell / kinds_[npt.kind].q;

assert (n_in_cell >= 0) !!!!

inject...

Thanks!
Will

On Sep 8, 2020, at 9:40 PM, jcd496 [email protected] wrote:

I see that his build failed, idk though. It builds fine on summit with spack


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Originally posted by @wrfox in #122 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant