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

Fixing FHI-aims electron densities for FDBM #276

Open
NikoOinonen opened this issue Apr 9, 2024 · 8 comments · May be fixed by #313
Open

Fixing FHI-aims electron densities for FDBM #276

NikoOinonen opened this issue Apr 9, 2024 · 8 comments · May be fixed by #313
Assignees

Comments

@NikoOinonen
Copy link
Collaborator

I have been having some problems using electron densities from FHI-aims with the full-density-based model. The problem shows up in the simulated images as severe noise and artifacts in the mid to far range images.

Here is a random test molecule from our database which exhibits the issue:
image
Far:
10
Close:
26

The close range image is fine, but in the far-range image there is a lot of noise and a weird round artifact at the position of the Cl atom.

Since the problem only shows up at the far range, I first thought the issue might be something to do with the integration grid in aims, which gets more sparse further away from the atoms. However, after a quite a bit of testing, it looks like the issue actually stems from the core electrons. FHI-aims is an all-electron code so the density has sharp spikes at the positions of the atoms.

By simply applying a cutoff to the electron density, the issue seems to go away:
10

After trying a bunch of different cutoff values, it looks like somewhere around 100 the image becomes completely smooth for this particular case. Interestingly, going down even far as 1 with the cutoff still does not affect the close range image in any appreciable way. For reference, the original value at the position of the Cl atom is ~18000.

A line scan through the center of the Cl atoms:
density_line

It seems worth implementing this cutoff into ppafm in some way in order to make electron densities from aims also usable with the FDBM.

@ProkopHapala Do you foresee any problem with applying a cutoff in this way? It does get rid of some electrons, but then again, previously we have used the pseudo-potential densities that don't have the core electrons either.

@ondrejkrejci
Copy link
Collaborator

My personal opinion is that it makes sense to apply this cutoff with a proper keyword and documentation later.

I would suggest the value for a cutoff to be as low as possible, but still bigger than density from VASP - as this is the "ground truth" testing code for the ppafm (not telling that the VASP or its density - e.g. soft PPs ... - just that we tune everything on it.

With this saying I would suggest, to update the code, once #275 is implemented. I think that this is also interesting for @mondracek

@ProkopHapala
Copy link
Collaborator

ProkopHapala commented Apr 10, 2024

Hi, I was never using (or liking) FHI-aims to much. But I remember we had this problem with PPAFM from the start.

ad possible problems

  • We should distinguish if we speak about Electrostacis (Hartree) or Pauli poentials.
  • For Pauli I think this cut of high density around atoms is fine - this is exactly what I would do. Maybe I would think about make it somwhow smoother, but in the end it probably does not matter.
  • For electrostatics it is a problem. I'm not sure if I missed something (maybe I did not read what you wrote carefully) but I wonder that it works (maybe it is because of renormalization of the total charge?)
    • I think for electrostatics if we want to apply modification like this, we should make sure that the charge blobs which we add to simulate nuclei (which make sure the atoms are quasi-neutral) properly consider this change in electron densiry around core.

@NikoOinonen
Copy link
Collaborator Author

@ProkopHapala

We should distinguish if we speak about Electrostacis (Hartree) or Pauli poentials.

Sorry I did not specify. I was only using the cutoff for the Pauli part. The electrostatics with aims does not pose any problem.

@NikoOinonen NikoOinonen self-assigned this May 14, 2024
@NikoOinonen
Copy link
Collaborator Author

We agreed in the meeting that this should be implemented. I will try to get around to it some time soon.

@NikoOinonen
Copy link
Collaborator Author

I did some more testing with this and implemented two different types of cutoff, a hard cutoff and a soft cutoff:
clamps

After trying different cutoff values with both types, it does not seem to make any significant difference which one you use. Both get rid of the artifacts just fine, so I would probably opt for the hard cutoff because it's simpler and faster.

I would suggest the value for a cutoff to be as low as possible, but still bigger than density from VASP - as this is the "ground truth" testing code for the ppafm (not telling that the VASP or its density - e.g. soft PPs ... - just that we tune everything on it.

Using the 6 molecules in the review paper as a reference, the maximum value for the VASP densities there is ~13. A cutoff of 100 seems to get rid of all artifacts and is well above the VASP values, so I would probably use that as a default value.

With the cutoff, the simulations between aims and VASP look pretty much identical in the relevant range:
C60_26

The aims densities also have the advantage that they don't have these ring oscillations arising from the plane waves in the VASP densities, so with the cutoff aims electron densities could actually work quite nicely with the FDBM:
C60_19

@ProkopHapala
Copy link
Collaborator

ProkopHapala commented Oct 16, 2024

Perfect.
ad VASP rings due to PW cutoff - this is probably something we can smooth out by doing few iteration of real-space laplace as I was mentioning.

Code is here in FireCore:
OpenCL
python
C++

but I'm still testing it

EDIT:
Oh, I'm stupid. This is relevatn just for electrostatics. But you speak about Pauli.

@NikoOinonen
Copy link
Collaborator Author

Also adding this option to the GUI:
Pasted image 20241017155034

@NikoOinonen
Copy link
Collaborator Author

After testing on a larger set of molecules with a wider range of the Pauli integral parameters, it looks like a cutoff of 100 is in some rare cases still too large, requiring going down as low as 20, mostly when the exponent and prefactor are both large. I'll add this information to the documentation.

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

Successfully merging a pull request may close this issue.

3 participants