Disable atom charge in specific region


I would like to disable the atomic charge or set it to 0.0 if an atom passes into a specific region and reset the charge if it travels outside of the region. Is there a fix that would be able to accomplish this? Or another method that I’m missing? If not, I was thinking of setting a run loop that would check the regions after doing a short run and using the set command to change the charges.

I’m using the latest lammps version.

Thanks for the help/ideas.

  • Stacey

i am not aware of such a feature, but would like to caution that a sudden change in charges (especially from full to zero or the other way around) can lead to significant disruptions due to the large change in forces, which is probably why nobody has bothered to implement such a feature.


You could do something like this

if your region is for example a block that contains all the simulation box in the x and y direction but some part in the z you can define a bell function
y=1/(1+((z-zo)/a)^(2*b) this function has a value of 1 in almost all the +/-a region in the limits near +/-a the function goes smoothly to zero, the slope of this change is defined by b,

you can rewrite this function as y=1-1/(1+((z-zo)/a)^(2*b) with this it will be zero inside the region +/-a and 1 otherwise with a smother change

you could then define in lammps an atom type variable

variable charge atom q*(1-1/(1+((z-${zo})/$a)^(2*$b)))

q is the original charge of each particle wich

you will have your original charge outside the region and zero inside with an smoth change, you will have to experience with the b parameter to get the a suitable slope for the transition zone a value of 10 for example is quiet okey

then you can use fix adapt to change the charges as the simulation progress

fix 1 all adapt 1 atom charge v_charge

i think this will work but the question is whether is okay, you might end up having a no neutral system this might mess the simulation.

If you have other geometris you can look on internet for other function that might be suitable.

cheers !