|
|
Regression Tests
|
|
|
====================
|
|
|
|
|
|
We use a set of regression tests to determine the correctness of a FLEUR binary.
|
|
|
|
|
|
These tests are designed to run in a very short time and to reproduce some number in the 'out' file that can be used to ensure that FLEUR still works correctly. These test usually use small cut-off parameters, few k-points, no self-consistency etc. to ensure rapid execution.
|
|
|
|
|
|
# Adding new test
|
|
|
|
|
|
**You are strongly encouraged to add new tests.**
|
|
|
|
|
|
Short guide to create tests:
|
|
|
* create a new directory in tests/tests with a suitable name for your test
|
|
|
* create a file called test.desc in this directory.
|
|
|
* create one ore more files "test.run1", "test.run2",...
|
|
|
* store the needed inp.xml and similar files (usually in a subdirectory files of your test directory)
|
|
|
* add the test to the file tests/tests_old.cmake
|
|
|
|
|
|
## The test.desc file
|
|
|
This file should look like this:
|
|
|
```
|
|
|
$test_name="GaAs: displaced atoms with U parameters and forces";
|
|
|
$test_code="Fleur";
|
|
|
$test_stages=3;
|
|
|
$test_desc=<<EOF
|
|
|
Simple test of Fleur with three steps:
|
|
|
1.Generate a starting density and run 1 iteration
|
|
|
2.Remove Broyden files, last line of n_mmp_mat and run 12 iterations
|
|
|
3.Calculate forces
|
|
|
Uses: LDA+U,forces
|
|
|
EOF
|
|
|
;
|
|
|
```
|
|
|
As you can see this is a simple perl file which defines a couple of variables:
|
|
|
|
|
|
* test_name: A name for your test
|
|
|
* test_code: should be "Fleur"
|
|
|
* test_stages: number of stages to run. For each you have to specify a test.runX file (see below)
|
|
|
* dest_desc: a somewhat useful description of the test
|
|
|
|
|
|
## The test.runX files
|
|
|
For each stage you define in the test.desc file you need to provide a test.run1, test.run2 ... file. These should look similar to
|
|
|
```
|
|
|
jt::copyfile("files/inp-2.xml","$workdir/inp.xml");
|
|
|
jt::copyfile("files/n_mmp_mat",$workdir);
|
|
|
|
|
|
jt::testrun("rm mixing_*",$workdir);
|
|
|
jt::testrun($executable,$workdir);
|
|
|
|
|
|
#now test output
|
|
|
$result=jt::test_grepexists("$workdir/out","it= 12 is completed");
|
|
|
$result+=jt::test_grepnumber("$workdir/out","first approx. to ef",".*: *([^ ]*)",0.125,0.001);
|
|
|
$result+=jt::test_grepnumber("$workdir/out","total energy=",".*= *([^ ]*)",-4204.7140,0.0001);
|
|
|
|
|
|
jt::stageresult($workdir,$result,"2");
|
|
|
```
|
|
|
|
|
|
The testscript can and should contain the following elements:
|
|
|
|
|
|
* ```jt::copyfile(FILENAME RELATIVE TO YOUR TESTDIR,FILENAME TO COPY TO)``` use this to copy the needed files in the workdir (USE $workdir!)
|
|
|
* ```jt::testrun(EXECUTABLE,WORKDIR)``` run a command. Do not specify the executable to be tested here but use ```$executable``` instead. You can also specify commands needed to prepare the workdir here.
|
|
|
* a Series of expressions to test for (see below)
|
|
|
* finally a call to ```jt:stageresult($workdir,$result,STAGE)``` where STAGE is the current stage of the test.
|
|
|
|
|
|
You can use the following functions to test your run.
|
|
|
* ```jt::test_fileexists(FILE)``` check if a particular file is present
|
|
|
* ```jt::test_grepexists(FILE,EXPR)``` check if EXPR can be found in FILE
|
|
|
* ```it::test_grepnumber(FILE,EXPR,REGEXPR,VALUE,TOL)``` first we search for the (first) line in FILE containing EXPR. Then the regular expression is matched against this line. This regular expression should contain a subexpression in ```()``` that will then be compared against VALUE with the given tolerance TOL.
|
|
|
* ```it::test_grep_lastnumber(FILE,EXPR,REGEXPR,VALUE,TOL)``` same as before but use last occurance of EXPR.
|
|
|
All these functions return a ```0``` if the test is performed successful. Hence the results can be added into a results variable that will be zero if all tests are OK.
|
|
|
|
|
|
|
|
|
# List of tests:
|
|
|
* [Bulk Cu test](Testing/Cu-Bulk) |
|
|
\ No newline at end of file |