Wannier90 test suite
## Dependencies
The code needs the `configparser` module, that can be installed e.g. via
`pip install --user configparser`.
## How to write a new test
### Writing a new test for wannier90.x
1. Create a new folder for the test inside `test-suite/tests`,
with a short but meaningful name.
The name *must* start with the prefix `testw90_` if it is a Wannier90
test, or `testpost90_` if it is a postw90.x test. This is needed to properly
group tests in categories.
2. modify the file `test-suite/tests/jobconfig` adding a new section,
following the template of existing tests. E.g.:
```
# Testing preconditioner
[testw90_precond_1]
program = WANNIER90_WOUT_OK
inputs_args = ('gaas1.win', '')
output = gaas1.wout
```
where:
- Line 1: comment on what the test is supposed to do or test;
feel free to write a long description spanning multiple lines;
- Line 2: test folder name created above, in square brackets
- Line 3: name of a program that you want to run to test.
The possible program names are defined in `test-suite/tests/userconfig`, discussed
below. The "program" defines which executable to use to run the program,
which parser needs to be used, and which custom tolerances should be used to
compare results of the test with reference results. It also defines if the test
is expected to have the code fail (e.g. to check the code stops for unexpected
inputs).
- Line 4: comma-separated list of tuples of length 2, containing the
`('inputfile', 'cmdline-params')` for each subtest to run. Typically, you
will have only one subtest. The first string is the name of the input file within
the test folder, the second are the command line parameters to pass to the
executable (use an empty string `''` if you don't have any custom parameter).
- Line 5: defines the name of the file to parse.
Additional parameters can be specified: check the
[testcode documentation](http://testcode.readthedocs.io/).
One additional parameter is worth mentioning here:
- `max_nprocs = 0`: this specifies the max number of CPUs that this test
is allowed to run on. Zero means to never call the test with `mpirun`,
a larger number indicates the max number of MPI processes to use. Setting to
zero is useful for tests that can only run in serial (e.g. for the gamma-only
runs).
3. Put all needed input files in the folder (`.win`, `.amn`, `.mmn`, ...), making sure
that the input file has the name you specified above in the `jobconfig` file.
Add the files to the git repository.
Also, add a `.gitignore` file in your test folder for those files that are dynamically
created at runtime and should be ignored. The content of this file is also used by
the `clean_tests` code (described later) to decide if a file can be safely deleted.
4. Compile the code in its most recent version.
5. Run the code (with the same parameters as defined in `jobconfig`)
in the test folder to create a reference output.
`TODO: MAKE THIS AND THE NEXT POINT EASIER TO DO`
6. Open the file in point 5 above, verify that it is the actual expected output,
and copy/move the output file to a file named `benchmark.out.default.inp=<inputfilename>`
(or `benchmark.out.default.inp=<inputfilename>.args=<cmdline_args>` if you have
some command line parameters in your `input_args`). Add this to the git repo.
7. If you have chosen to use one of the existing "programs" already present in `userconfig`,
you are probably already ok: just run the test again to check that the test now passes
without errors.
**STRONG SUGGESTION**: To make sure the tests is working, try to change in the
reference/benchmark file one of the values that should be checked, to verify that
the tests actually fails if the value is unexpected. Remember to put back the correct
value afterwards!
8. If instead you need to parse a different file, or parse additional data:
* for an additional value, edit/improve the python parsing functions;
* to parse a different file, create a new section in the `userconfig` file.
In both cases, see the description below in the `userconfig` section.
### Writing a new test for postw90.x
To write a test for `postw90.x`, you can follow all the steps for a `wannier90.x`
test above. We outline here only the changes/additional steps needed.
- Name your test folder with a `testpostw90_` prefix
- Use the proper "program" in the `jobconfig` file
- You need to start from a checkpoint file. Don't commit directly a .chk file
(as these are in machine-dependent format, so might not be usable on a
different computer). Instead:
* create a new folder inside `test-suite/checkpoints` with a sensible name
* put in the folder all needed inputs for the Wannier90 run. Make sure you
only have one `.win` file
* copy the Makefile from another folder (e.g. `si_geninterp`) in the folder
you created
* if you didn't do already, compile wannier90.x and postw90.x. Moreover,
please also compile `w90chk2chk.x`. To do this, run `make w90chk2chk`
in the top Wannier90 folder.
* Run `make` in the folder you created to run Wannier90, convert the
checkpoint file in a formatted format, and bzip it.
* Go now in your test folder `test-suite/tests/testpostw90_...`.
* Symlink the `<seedname>.chk.fmt.bz2` file that was created in the step
before in here (`ln -s ../checkpoints/<foldername>/<seedname>.chk.fmt.bz2`).
* You will probably need also to copy the other Wannier90 files like the
`.amn`, the `.mmn`, ...
* Copy the `Makefile` file in the `test-suite/tests/testpostw90_si_geninterp`
folder into your test folder. In this way, before running the tests, the
`./run_tests` script will run `make` on all test folders containing a
Makefile. The one we suggest to copy is already ready to do the right job
if you have only one symlink, whose name ends with `.chk.fmt.bz2`.
This should be enough. When you will run the tests with `./run_tests`,
the checkpoint file will be prepared, and then `postw90.x` will be run.
# Parsing new files: the `userconfig` file
The `userconfig` file defines the "programs" to run. Each section
defines (at least) an executable to run and a function to parse the output.
Moreover, additional options can be provided like some custom tolerances.
An example program section looks like this:
```
[POSTW90_GENINTERPDAT_OK]
exe = ../../postw90.x
extract_fn = tools parsers.parse_geninterp_dat.parse
tolerance = ( (1.0e-3, 5.0e-3, 'bandenergy'),
(1.0e-6, 1.0e-6, 'bandidx')))
```
Each line defines the following:
* Line 1: the name of the program in square brackets (that will be used in the `jobconfig` file)
Try to comply to the following syntax: `<CODENAME>_<FILETOPARSE>_<SHOULDFAIL>` where:
* `<CODENAME>` is `POSTW90` or `WANNIER90`
* `<FILETOPARSE>` is a short string defining the type of file that is expected to be
parsed/checked (e.g. `WOUT` or `NNKP`)
* `<SHOULDFAIL>` is `OK` if this is a standard run that should end with error code zero,
or `FAIL` if you expect the code to fail.
* Line 2: specify the executable to run. Typically this is either `../../postw90.x` or
`../../wannier90.x` (the location is with respect to the folder in which `userconfig` is
located)
* Line 3: define the (python) function to parse the output files. In the example above,
the two parameters indicate that the python modules live in the folder `tools` and,
within it, the function `parse` will be called, defined inside
`parsers/parse_geninterp_dat.py`.
To parse a new file, define a new file inside `tools/parsers`, and within it define
a `parse(fname)` python function that accepts a python function and returns
a dictionary in the form `{'testvaluekey': [value1, value2, ...]}` for the values
to test. We strongly suggest that you take inspiration from
没有合适的资源?快使用搜索试试~ 我知道了~
wannier90-3.1.0.tar.gz
5星 · 超过95%的资源 需积分: 39 19 下载量 140 浏览量
2021-01-20
09:34:05
上传
评论
收藏 96.52MB GZ 举报
温馨提示
共1216个文件
win:180个
png:129个
bz2:98个
Linux版wannier90最新3.1.0安装包
资源详情
资源评论
资源推荐
收起资源包目录
wannier90-3.1.0.tar.gz (1216个子文件)
UNK00003.1 469KB
UNK00001.1 469KB
UNK00007.1 469KB
UNK00006.1 469KB
UNK00008.1 469KB
UNK00002.1 469KB
UNK00005.1 469KB
UNK00004.1 469KB
UNK00002.1 469KB
UNK00006.1 469KB
UNK00007.1 469KB
UNK00004.1 469KB
UNK00001.1 469KB
UNK00008.1 469KB
UNK00007.1 469KB
UNK00005.1 469KB
UNK00003.1 469KB
UNK00003.1 469KB
UNK00001.1 469KB
UNK00006.1 469KB
UNK00008.1 469KB
UNK00005.1 469KB
UNK00002.1 469KB
UNK00004.1 469KB
Makefile.2 6KB
make.inc.alpha 84B
silicon.amn 468KB
silicon.amn 468KB
benzene_s_cond.amn 457KB
silicon.amn 330KB
silicon.amn 330KB
silicon.amn 330KB
silicon.amn 330KB
silicon.amn 330KB
silicon.amn 330KB
silicon.amn 330KB
silicon.amn 330KB
silicon.amn 330KB
gaas.amn 312KB
gaas.amn 312KB
gaas.amn 312KB
gaas.amn 312KB
Si.amn 312KB
gaas.amn 312KB
copper.amn 273KB
copper.amn 273KB
Fe.amn 205KB
Fe.amn 205KB
Fe.amn 205KB
Fe.amn 205KB
Fe.amn 205KB
Fe.amn 205KB
Fe.amn 205KB
Fe.amn 205KB
Fe.amn 205KB
Fe.amn 205KB
Fe.amn 205KB
Fe.amn 205KB
Fe.amn 205KB
LaVO3.amn 198KB
wannier.amn 110KB
H3S.amn 98KB
benzene.amn 82KB
GaAs.amn 52KB
diamond.amn 52KB
gaas.amn 52KB
lead.amn 52KB
lead.amn 52KB
lead.amn 52KB
lead.amn 52KB
lead.amn 52KB
benzene_s_val.amn 46KB
Te.amn 44KB
Te.amn 44KB
Te.amn 44KB
Te.amn 44KB
Te.amn 44KB
Te.amn 44KB
Te.amn 44KB
Na_chain.amn 15KB
benzene.amn 12KB
benzene.amn 12KB
wannier.amn 7KB
gaas.amn 7KB
gaas.amn 7KB
gaas.amn 7KB
gaas.amn 7KB
gaas1.amn 6KB
gaas2.amn 6KB
silane.amn 931B
benchmark.out.default.inp=wannier.win.args=-pp 3KB
benchmark.out.default.inp=wannier.win.args=-pp 2KB
benchmark.out.default.inp=wannier.win.args=-pp 2KB
benchmark.out.default.inp=wannier.win.args=-pp 133B
wannier90.bib 29KB
biblio.bib 4KB
Fe.uHu.bz2 10.14MB
Fe.uHu.bz2 10.14MB
Fe.uHu.bz2 10.14MB
Fe.uHu.bz2 10.14MB
共 1216 条
- 1
- 2
- 3
- 4
- 5
- 6
- 13
weixin_41566059
- 粉丝: 0
- 资源: 33
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论5