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

Master kpfm #45

Merged
merged 5 commits into from
Nov 22, 2022
Merged

Master kpfm #45

merged 5 commits into from
Nov 22, 2022

Conversation

aureliojgc
Copy link
Collaborator

@aureliojgc aureliojgc commented Nov 9, 2022

Fixes #43

Request for pull the kpfm modifications.
Basically I add the cycles over bias in generateELFF, both the relaxed_scan and relaxed_scan_PVE and the plot_results.
I made relaxed_scan_PVE to work also with LJ
The rest are minor changes around the kpfm needs.

I have tested all AFM and KPFM with density tips and orbital-like tips for AIMS and VASP.

…nt kpfm forces.

small mod in pyProbeParticle/HighLevel.py to generate pz orbitals with diferent sigma to generate the bias dependent polarization of the tip for kpfm
      read the new forces for kpfm
	as a side product, make it work with both Pauli+vdW and LJ
	The main cicle is written is manner that if there is no bias or kpfm requested, it goes as usual for AFM, ignoring all the bias stuff

Touch perform_relaxation in  pyProbeParticle/HighLevel.py to read the new kpfm forces. If no kpfm is requested, the loop works as usual.
Include the kpfm cicle in relaxed_scan.py the same way it was included in relaxed_scan_PVE.py in the previous commit
modify the pyProbeParticle/PPPlot.py to plot it with kpfm like colorscale
modify pyProbeParticle/common.py to ad a few default parameters for KPFM
Copy link
Collaborator

@ProkopHapala ProkopHapala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems fine, assuming you tested original functionality works (I didn't)

@@ -97,6 +101,70 @@

PPU.params['tip'] = rho_tip

if (options.KPFM_sample is not None):
V_v0_aux = V.copy()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why you need to copy? dV_kpfm = (V_kpfm - V_v0_aux) is non-destructive operation ?

print(">>> loading tip density under bias from ",options.KPFM_tip,"...")
if (options.KPFM_tip.lower().endswith(".xsf")):
Vref_t = options.Vref
rho_tip_v0_aux = rho_tip.copy()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, why you need to copy? why not simply
drho_kpfm = (rho_tip_kpfm - rho_tip) ?
it does not cause any harm, but seems to be wasting some memory

FFvdW, FFpauli, FFel, FFboltz=None,None,None,None
FFvdW, FFpauli, FFel, FFboltz, FFkpfm_t0sV, FFkpfm_tVs0=None,None,None,None,None,None

try: #wrote in this way in can work with both LJ and Pauli+vdW modes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great

Copy link
Collaborator

@ProkopHapala ProkopHapala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine, assuming you tested it.

Consider if you really need to copy V and rho before you subtract it? Do you need to save original array? Are you worried that the original array may be changed? It can cost quite a lot of memory if the arrays are large.

Copy link
Collaborator

@ProkopHapala ProkopHapala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems fine assuming you tested that original functionality works (I didn't)

Copy link
Collaborator

@ProkopHapala ProkopHapala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems OK, as long as it is tested

elif opt_dict['Vbias'] is not None:
Vs = [ opt_dict['Vbias'] ]
else:
Vs = [0.0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so it now always loop over Vs, but when KPFM is inactive Vs=[0.0]

@ProkopHapala ProkopHapala merged commit 3020d00 into main Nov 22, 2022
@ProkopHapala ProkopHapala deleted the master_kpfm branch November 22, 2022 15:32
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

Successfully merging this pull request may close these issues.

Merging the KPFM part to the main.
3 participants