Skip to content

Commit

Permalink
Merge pull request #6 from eimrek/master
Browse files Browse the repository at this point in the history
Fix bug in extrapolation with weighted averaging
  • Loading branch information
ltalirz authored Jan 11, 2018
2 parents a04f89d + 3f708f6 commit 57b74b9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/cp2k-extrapolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@
args.height, verbose=True)
np.savetxt(hartree_planefile, hartree_plane)

hartree_avg = np.mean(hartree_plane) / eV2Ha
hartree_min = np.min(hartree_plane) / eV2Ha
hartree_max = np.max(hartree_plane) / eV2Ha
hartree_plane /= eV2Ha

hartree_avg = np.mean(hartree_plane)
hartree_min = np.min(hartree_plane)
hartree_max = np.max(hartree_plane)
print("Hartree potential on extrapolation surface:")
print(" min {:+.4f} eV, max {:+4f} eV, avg {:+.4f} eV" \
.format(hartree_min, hartree_max, hartree_avg))
Expand Down Expand Up @@ -138,7 +140,7 @@
weighted_hartree = hartree_plane * density_plane
weighted_hartree_avg = np.sum(weighted_hartree)
print("Weighted average of Hartree potential: {:+.4f} eV" \
.format(weighted_hartree_avg/eV2Ha))
.format(weighted_hartree_avg))
hartree = weighted_hartree_avg

# Note: Working in Hartree atomic units here
Expand Down Expand Up @@ -195,4 +197,3 @@

print("")
print("Job done.")

0 comments on commit 57b74b9

Please sign in to comment.