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
Bug Using Charged systems #485
Comments
We have not thought at all about charged systems; the functionality to have a separate number of electrons is only there for "artificial" models (eg without atoms). You're packing together positive charges, so the energy is infinite here, no? |
True, but I have run self_consistent_field with a charged system in the past. |
If it yielded a finite answer that was probably a bug... What's your use case here? |
The above example was just to show the ERROR. Generally the use case is an atom bonding to a surface in a charged system. EDIT: Spelling mistake |
We can certainly disable the error, but I'm more interested in doing the right thing here. Don't you get an infinite energy in this case also? |
I agree that disabling the error wouldn't be the right thing. We did not get infinite energy in our systems. The systems gave some numbers that cardinally agreed with the literature. |
Physically, a 2D array of charges does not blow up? I've been meaning to look at these things for a while... The first step would be to be right for an isolated ion. |
I'm not sure what you mean by your question. By blow up do you mean produce an infinite energy? |
Not only energy, potential also, because it's 1/r and there are r of them. Maybe forces are conditionally summable, though... |
Ie physically I'd expect the ions to start moving away from each other, pulling the surface apart? |
I believe the forces cancelled in the repeating lattice. Also, the surface could've been neutrally charged and the adsorbed atom lost all of the electrons. |
Regardless, thank you for the quick responses. This issue is resolved, but I'm curious what would need to be done in order to use charged systems? |
That really depends on the system. Isolated charged system (eg an ion on a molecule) is rather easy, one just needs a correction scheme for the potential (I've never seen this done in the literature but it's not hard), but we need to implement it. Charged defects in semiconductors is more involved, there's a bunch of schemes, I need to look into it more. Charged ion on top of a surface I don't know. I have a PhD student starting who's going to look among other things into this kind of issues, so we'll see. |
But in @antoine-levitt's comments is clearly the mathematician speaking. Many codes support charged unit cells and I don't think they do fancy corrections by default. I tested this with QE at some point and the difference between our definitely inconsistent implementation and QE (without corrections) was small, similar to what @umbriquse has pointed out. I think to a first approximation if we ensure that the compensating background is consistently taken into account in all terms, we can disable the assertion. We just have to communicate to the user that the compensating background is implicit ... and therefore that it's not a charged ion in vacuum you are modelling, but a charged ion with compensating uniform background charge. |
I don't know what QE does but VASP has correction schemes that appear to be enabled by default: https://www.vasp.at/wiki/index.php/Monopole_Dipole_and_Quadrupole_corrections . I'm fine with doing something very naive here if we have a strong warning |
Same. And getting the compensating backgrounds to agree is not hard, one just has to go through the relevant terms and be careful. |
For QE you can switch on Markov-Payne, but you have to do so explicitly. |
I thought Makov-Payne was for defects, but maybe it's also for isolated molecules. Makov-Payne is a bit of a hack : it only corrects the total energy, not the density or the potential. There's simpler and better ways to do that for isolated systems: you have to add and subtract a reference density that compensates the extra charge, and compute the potential for that analytically. I do that eg in the anyon code. |
Found a bug relating to an assertion of charges in energy_ewald
System Version
Code
ERROR Message
Version Info
The text was updated successfully, but these errors were encountered: