There is a long standing issue with the geometry of data grid (handling of the cell boundary and number of grid points along the grid vectors) in the XSF files saved by our package, in particular with the OutFz.xsf file. I know about it at least since the discussion under #198, namely, it is related to the problem of repeated points on the boundary of a periodic cell in the XSF files which I discuss in my #198 (comment). However, I needed a specific example to demonstrate the issue, so here it is:
I have simulated an AFM image (without electrostatics, just Lennard-Jones) of a NaCl mono-atomic layer. I will show below two slices (planes of two different heights) through the Q0.00K0.25/OutFz.xsf file obtained as an intermediate result of this simulation. The positions of atoms (represented by blue balls for Na and green balls for Cl) clearly do not align with the symmetry of the force map (in rainbow color scale and black isolines).
I have intentionally used a crude sampling to make the effect visible: The grid is off by just one pixel at most so the problem is not apparent with fine sampling. This is my params.ini file
probeType 8 # atom type of ProbeParticle (to choose L-J potential ),e.g. 8 for CO, 54 for Xe
charge -0.10 # effective charge of probe particle [e]
klat 0.25
krad 20.00 # [N/m] harmonic spring potential (x,y,R) components, x,y is bending stiffnes, R particle-tip bond-length stiffnes,
r0Probe 0.0 0.0 4.00 # [Å] equilibirum position of probe particle (x,y,R) components, R is bond length, x,y introduce tip asymmetry
PBC True # Periodic boundary conditions ? [ True/False ]
nPBC 2 2 2
gridA 4.0000000 0.00000000 0.00000000 # a-vector of unit cell; recomanded format (x,y,0)
gridB 0.000000 4.000000 0.00000000 # b-vector of unit cell; recomanded format (x,y,0)
gridC 0.000000 0.000000 16.00000000 # c-vector of unit cell; recomanded format (0,0,z)
scanMin -4.0 -4.0 6.0 # start of scanning (x,y,z)
scanMax 4.0 4.0 10.0 # end of scanning (x,y,z)
scanStep 0.2 0.2 0.2
Amplitude 1.0 # [Å] oscilation amplitude for conversion Fz->df
and this is the header of LOCPOT.xsf which I have used for input (the content of the grid data in LOCPOT.xsf does not matter since I am using LJ potentials only)
CRYSTAL
PRIMVEC
4.000000 0.000000 0.000000
0.000000 4.000000 0.000000
0.000000 0.000000 16.000000
CONVVEC
4.000000 0.000000 0.000000
0.000000 4.000000 0.000000
0.000000 0.000000 16.000000
PRIMCOORD
2 1
11 0.000000 0.000000 0.000000
17 2.000000 2.000000 0.000000
BEGIN_BLOCK_DATAGRID_3D
LOCPOT_v2xsf
BEGIN_DATAGRID_3D_LOCPOT_v2xsf
49 49 181
0.000000 0.000000 0.000000
4.000000 0.000000 0.000000
0.000000 4.000000 0.000000
0.000000 0.000000 16.000000
Here are the images that show the misalignment of the force with atom positions:


Grid data read by the subsequently called ppafm-plot-results are correct because the way we read the XSF files compensates for the problem we create when writing them. But it is still a problem if anyone needs to analyze OutFz.xsf independently from ppafm-plot-results. In particular for highly symmetric surface structures in which even the small asymmetry intruduced by the misalignment can raise questions whether it is an artifact (which it would be here) or a genuine demonstration of an unexpected asymmetry in the sample.
As a solution, I intend to implement a loadXSF() function that will handle the grid geometry properly. Simultaneously, this function should be able to correctly read XSF files generated by FHI-aims. In fact, I have the function almost ready, the challenge is going to be implementing it into our code without breaking anything.
There is a long standing issue with the geometry of data grid (handling of the cell boundary and number of grid points along the grid vectors) in the XSF files saved by our package, in particular with the
OutFz.xsffile. I know about it at least since the discussion under #198, namely, it is related to the problem of repeated points on the boundary of a periodic cell in the XSF files which I discuss in my #198 (comment). However, I needed a specific example to demonstrate the issue, so here it is:I have simulated an AFM image (without electrostatics, just Lennard-Jones) of a NaCl mono-atomic layer. I will show below two slices (planes of two different heights) through the
Q0.00K0.25/OutFz.xsffile obtained as an intermediate result of this simulation. The positions of atoms (represented by blue balls for Na and green balls for Cl) clearly do not align with the symmetry of the force map (in rainbow color scale and black isolines).I have intentionally used a crude sampling to make the effect visible: The grid is off by just one pixel at most so the problem is not apparent with fine sampling. This is my
params.inifileand this is the header of
LOCPOT.xsfwhich I have used for input (the content of the grid data inLOCPOT.xsfdoes not matter since I am using LJ potentials only)Here are the images that show the misalignment of the force with atom positions:

Grid data read by the subsequently called
ppafm-plot-resultsare correct because the way we read the XSF files compensates for the problem we create when writing them. But it is still a problem if anyone needs to analyzeOutFz.xsfindependently fromppafm-plot-results. In particular for highly symmetric surface structures in which even the small asymmetry intruduced by the misalignment can raise questions whether it is an artifact (which it would be here) or a genuine demonstration of an unexpected asymmetry in the sample.As a solution, I intend to implement a
loadXSF()function that will handle the grid geometry properly. Simultaneously, this function should be able to correctly read XSF files generated byFHI-aims. In fact, I have the function almost ready, the challenge is going to be implementing it into our code without breaking anything.