Probe-Particle / ppafm

Classical force field model for simulating atomic force microscopy images.
MIT License
49 stars 18 forks source link

Enable loading XSF files from FHI-AIMS #217

Open mondracek opened 10 months ago

mondracek commented 10 months ago

The FHI-AIMS code offers to output the grid data either as CUBE or as XSF files. However, the structure of data in those XSF files is somewhat different from what one gets from VASP by applying the v2xsf tool on a LOCPOT or CHGCAR file. The loadXSF and loadXSFGeom functions need to be modified in order to read the FHI-AIMS data correctly. Essentially, the grid data in the FHI-AIMS generated XSF files, including the grid dimensions and the ordering of the data points, are the same as they would be in the corresponding CUBE files (except that lengths are fortunately still expressed in angstrom, not bohr, in XSF). The consequences can be summarized into the following three points:

ondrejkrejci commented 10 months ago

Hi Martin,

Just a quick comment! Do not use XSF from AIMS. Never, ever. There is a mess in the units, in the cell, as you are pointing out, and so on. I have once looked into it, it does not make sense to work with it for us, it is a not-necessary extra work. We should just say it in the manual, that in FHI-aims one should use only cube files.

Ondrej

- Reply to this email directly, view it on GitHubhttps://github.com/Probe-Particle/ppafm/issues/217, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADFZAFI2O266BHY327JTRYLYA7JI5AVCNFSM6AAAAAA6N244KCVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE2TSNBVHA2DSMA. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

mondracek commented 10 months ago

I am working on this issue. In fact, I have already done the greater part of the job, I believe. That is why I could describe the differences in the respective XSF formats in such detail above, I learned most of it along the way. I have pushed the work as a branch xsf-and-cube but it is not ready for merging yet.

When done, it should solve #190 as a side issue too.

The main part of the work on this issue that I still have to do involves proper treatment of the grid origin, as read from the XSF or CUBE file. A byproduct of this effort will be that negative coordinates can be allowed for the scanning area over non-periodic systems, because the origin will not be forced to zero.

mondracek commented 10 months ago

Hi, Ondřej (@ondrejkrejci), I have edited out the copy of my own post from yours in this comment section to keep it more concise. I hope this alteration does not break anything. As for the substance: Well, avoiding the XSF from FHI-AIMS would surely be a solution too, but... The XSF from AIMS is not any worse than the CUBE file as long as you know it comes from AIMS. In other words, the only advantage of CUBE is in fact that we can always assume it comes from FHI-AIMS and handle it accordingly. Other than that, there is not that much difference and in fact the main problem of XSF from AIMS is that it is too similar to CUBE (the exactly same grid as in CUBE, with grid point positions and ordering untypical for the XSF format). There is at least one issue I need to solve because of FHI-AIMS, irrespective whether I am going to use XSF or CUBE files. I do not like the origin of the grid-covered space being forced to the origin of the Cartesian system. As it is now, I have to make sure that the origin of the grid in the CUBE file is always at zero, which means always putting the center of the unit cell to the cube origin line in the control.in, which is a pain.

ondrejkrejci commented 10 months ago

Hi,

“”” The XSF from AIMS is not any worse than the CUBE file as long as you know it comes from AIMS. In other words, the only advantage of CUBE is in fact that we can always assume it comes from FHI-AIMS and handle it accordingly. Other than that, there is not that much difference and in fact the main problem of XSF from AIMS is that it is too similar to CUBE (the exactly same grid as in CUBE, with grid point positions and ordering untypical for the XSF format). “”” I see the main problem in the units conversion that is why I would suggest to omit it. Especially when CUBE is like a nature format for AIMS. My point was to save your time, to not try solve all the problems on the world 😊. Regards, Ondrej

From: Martin Ondráček @.> Sent: tiistai 24. lokakuuta 2023 18.32 To: Probe-Particle/ppafm @.> Cc: Krejci Ondrej @.>; Comment @.> Subject: Re: [Probe-Particle/ppafm] Enable loading XSF files from FHI-AIMS (Issue #217)

Hi, Ondřej, I have edited out the copy of my own post from yours in this comment section to keep it more concise. I hope this alteration does not break anything. As for the substance: Well, avoiding the XSF from FHI-AIMS would surely be a solution too, but... The XSF from AIMS is not any worse than the CUBE file as long as you know it comes from AIMS. In other words, the only advantage of CUBE is in fact that we can always assume it comes from FHI-AIMS and handle it accordingly. Other than that, there is not that much difference and in fact the main problem of XSF from AIMS is that it is too similar to CUBE (the exactly same grid as in CUBE, with grid point positions and ordering untypical for the XSF format). There is at least one issue I need to solve because of FHI-AIMS, irrespective whether I am going to use XSF or CUBE files. I do not like the origin of the grid-covered space being forced to the origin of the Cartesian system. As it is now, I have to make sure that the origin of the grid in the CUBE file is always at zero, which means always putting the center of the unit cell to the cube origin line in the control.in, which is a pain.

— Reply to this email directly, view it on GitHubhttps://github.com/Probe-Particle/ppafm/issues/217#issuecomment-1777493372, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADFZAFPH4GRVE5TYIMJ736DYA7NOVAVCNFSM6AAAAAA6N244KCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZXGQ4TGMZXGI. You are receiving this because you commented.Message ID: @.**@.>>

mondracek commented 10 months ago

Hi everybody. This is just to announce that I am going to finish this work after all. The reasons are that:

A possible argument against implementing this feature: The XSF from FHI-AIMS is indeed rather idiosyncratic. While my idea was that our functions that implement the XSF input should be as general as possible, there will nevertheless have to be a point in the code where it decides "is this XSF from AIMS or not?" and handles the "Yes, from AIMS" branch separately. This is so for two reasons:

  1. The data ordering (ZYX vs XYZ or, if you want, F-contiguous vs C-contiguous) and
  2. the eV vs hartree units for potentials.

The necessity of making such decision is potentially dangerous: If a XSF file were misidentified as created by FHI-AIMS even though it actually originated from elsewhere, that would cause troubles. But I believe I can implement the FHI-AIMS vs non FHI-AIMS input recognition safely.