[PATCH] directly look up filenames in datadir
Ole Schütt
o... at schuett.name
Sat May 2 20:00:28 UTC 2015
Hi Michael,
thanks for the patch! I'm, however, not sure if we can include it in its
current form.
The problem is that the data-dir itself has subdirectories. Hence, it
wouldn't work for example with DFTB runs.
I suppose you encounted this problem when picking regtest-inputs as
examples for the Debian package?
I think the best solution for the time being is to just patch the paths in
the input-files directly.
> Finally, I tripped over the fact that -D__DATA_DIR= and $CP2K_DATA_DIR
require a trailing slash, ...
Good point! I will write a routine to properly join paths.
-Ole
Am Freitag, 1. Mai 2015 17:41:16 UTC+2 schrieb Michael:
>
> 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 --------------
An HTML attachment was scrubbed...
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20150502/2c4c13b6/attachment.htm>
More information about the CP2K-user
mailing list