-
Notifications
You must be signed in to change notification settings - Fork 19
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
Generate automatic lattice vectors in loadGeometry #216
Conversation
…ini nor the input file specify them Moreover - remove premature call to autoGridN in loadParams - enable reading ASE-style lattice vector from XYZ in ppafm_gui.py - handle fzs/Fout deletion in plot_results.py correctly depending on tip tilt - correct typo Lenard-Jones -> Lennard-Jones - add 'self' argument to prepareFEConv() in relax.py to console precommit checks - resolve conflicts in formatting resulting from limits on line length Set grid in computeELFF_pointCharge before parsing atoms Correct swapped PBC / not PBC condition in loadGeometry Correct format of atomic data returned by loadGeometry - accept the solution from branch load-geometry-fix by Niko Oinonen - read 'nDim' from 'gridN' for POSCAR and geometry.in inputs Repair a comment line in io.py broken by automatic reformatting Repair an indentation error in ppafm/HighLevel.py and typo in ppafm/cpp/Force.h
The formatting changes were removed with the help of @yakutovicha and the other commits squashed into one. |
@NikoOinonen , I implemented the amendments you proposed (not pushed yet). Restricting the automatic cell to the scan region (plus some padding) works okay for non-periodic structures. It leads to wrong results for What I'd proposed now: Make |
Yes, it makes sense to have some default behaviour when not otherwise specified.
Would it not be fine to just set it True whenever the lattice vectors are defined in the input regardless of the format (when not explicitly set as False)? Especially for cube files (and for xsf), the convolution of the Hartree potential is always periodic just because of how the operation is defined, so we end up using periodic boundary conditions anyways.
Yes, I think it makes sense, since it affects the behaviour here. |
Right, I was about to do it that way after all: Set |
- Sets PBC to False whenever automatic grid needs to be created - Remove the back-and-forth transformation between pivot-particle and probe-particle coordinates
Pushed a new version that reflects the recent discussion. |
ppafm/io.py
Outdated
if np.allclose(lvec[i + 1, :], 0): | ||
params["PBC"] = False | ||
lvec[i + 1, i] = probeMax[i] + pad |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me like we are not taking into account the start of the scan region here. I think we would need to adjust the origin of the lvec to be at something like probeMin - pad
, and then the length of the lattice vectors would be something like probeMax - probeMin + 2 * pad
? Notice that currently probeMin
is not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly right. The thing is, the current version of the code (at least the CPU part, I do not know about the OCL) does not work with non-zero origin in non-periodic systems. I should and I will solve this, but as a separate issue. In fact, I have added a line #lvec[i + 1, i] = probe_max[i] - probe_min[i] + 2*pad
to io.py
, which is commented-out for now but which I intend to use instead of the contemporary lvec[i + 1, i] = probe_max[i] + pad
as soon as I solve the issue of an arbitrary origin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I didn't know that. It should work with any origin in the OCL code. I guess this by extension means that negative scan window coordinates don't work when PBC = False
. Is there an issue for this? If not, then better make one so that it does not slip by.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, last time I tried I got a blank area with zero forces for the part of scan region in which any of the three coordinates negative. There is no issue about it and I am going to make one. The original plan was to solve it as a by-product of #217 (may seem to be unrelated but as FHI-AIMS tends to be creative about the grid origin, it would have to be done to address that issue too). However, as I am being rather discouraged to implement #217, I will start a separate issue.
@@ -451,7 +451,8 @@ def loadGeometry(fname=None,format=None,params=None): | |||
# The automatic generated lattice vector should enclose the whole area filled with atoms as well as the whole scanning area, plus the default padding. | |||
if np.allclose(lvec[i + 1, :], 0): | |||
params["PBC"] = False | |||
lvec[i + 1, i] = probeMax[i] + pad | |||
#lvec[i + 1, i] = probe_max[i] - probe_min[i] + 2*pad |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment line will be activated once we deal with a potentially non-zero origin properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, looks good now. Thanks Martin!
Fixes #52
Supersedes #213 and #197