[PATCH] directly look up filenames in datadir
Michael Banck
mba... at gmx.net
Fri May 1 15:40:14 UTC 2015
Hi,
the -D__DATA_DIR= and $CP2K_DATA_DIR options are really neat, but most
regressions test ship with relative pathnames to the data files.
In order for those to be more useful, I wrote a small patch so that
strings passed as *_FILE_NAME in input will not only be looked for in
the above two directories (if present) but alternatively also just the
last segment of the string, i.e. the file name without path.
So for "POTENTIAL_FILE_NAME ../../../data/POTENTIAL" and
$CP2K_DATA_DIR=/usr/local/share/cp2k/, it would look up the potential
file in both /usr/local/share/cp2k/../../../data/POTENTIAL and
(new and more useful) /usr/local/share/cp2k/POTENTIAL.
I took the code from [1] (which appears to be in the public domain [2]),
so kept the author, but it is slightly adapted and only a few lines so I
don't think it's even copyrightable. In any case, feel free to rewrite
it to your taste.
Finally, I tripped over the fact that -D__DATA_DIR= and $CP2K_DATA_DIR
require a trailing slash, or else CP2K looks for
"/usr/local/share/cp2kPOTENTIAL". I've inserted that slash as I thought
it wouldn't hurt.
Michael
[1] http://www.cesm.ucar.edu/models/cesm1.3/cesm/cesmBbrowser/html_code/clm/fileutils.F90.html
[2] http://www.cesm.ucar.edu/models/cesm1.3/copyright.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cp2k.diff
Type: text/x-diff
Size: 2393 bytes
Desc: not available
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20150501/7fdf43ac/attachment.diff>
More information about the CP2K-user
mailing list