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

Update freysoldt.py #113

Merged
merged 1 commit into from
Mar 24, 2023
Merged

Update freysoldt.py #113

merged 1 commit into from
Mar 24, 2023

Conversation

nwinner
Copy link
Contributor

@nwinner nwinner commented Mar 22, 2023

Need floor operators here for odd nx.

If nx is even, then the current and proposed lines give the same results for g.

If nx is odd, then it needs to be odd so that the the 0 value is at the 0 index. Otherwise, the following line will cause a divide by zero since it assumes the zero value is at v_G[0]

v_G[1:] = 4 * np.pi / (dielectric * g2) * -q * q_model.rho_rec(g2)

Need floor operators here for odd nx.

If nx is even, then the current and proposed lines give the same results for g.

If nx is odd, then it needs to be odd so that the the 0 value is at the 0 index. Otherwise, the following line will cause a divide by zero.

v_G[1:] = 4 * np.pi / (dielectric * g2) * -q * q_model.rho_rec(g2)
@codecov
Copy link

codecov bot commented Mar 22, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (1d74e66) 91.23% compared to head (79940b5) 91.23%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #113   +/-   ##
=======================================
  Coverage   91.23%   91.23%           
=======================================
  Files          11       11           
  Lines        1768     1768           
  Branches      310      310           
=======================================
  Hits         1613     1613           
  Misses         88       88           
  Partials       67       67           
Impacted Files Coverage Δ
pymatgen/analysis/defects/corrections/freysoldt.py 86.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jmmshn
Copy link
Collaborator

jmmshn commented Mar 24, 2023

Thanks, @nwinner

Small note for myself in the future:

nx = 19
g = np.roll(np.arange(-nx // 2, nx // 2, 1, dtype=int), int(nx // 2))
# g =array([  0,   1,   2,   3,   4,   5,   6,   7,   8, -10,  -9,  -8,  -7, -6,  -5,  -4,  -3,  -2,  -1])
g = np.roll(np.arange(-nx / 2, nx / 2, 1, dtype=int), int(nx / 2))
# g = array([ 1,  2,  3,  4,  5,  6,  7,  8,  9, -9, -8, -7, -6, -5, -4, -3, -2, -1,  0])

@jmmshn jmmshn merged commit a3ca9d8 into materialsproject:main Mar 24, 2023
@nwinner nwinner deleted the patch-1 branch March 24, 2023 16:49
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.

2 participants