Commit 03923378 authored by Daniel Wortmann's avatar Daniel Wortmann

Files missing in 2bb6c537

parent 2bb6c537
#!/usr/bin/perl
use 5.010;
use strict;
use warnings;
use XML::LibXML;
use Cwd;
my $dir=cwd;
$dir=~s/.*\///;
my $fleur=shift;
die "You have to provide the path to a FLEUR executable as an argument" if (! -X $fleur);
my $dom = XML::LibXML->load_xml(location => "inp.xml");
die "No inp.xml file found in current directory" if (!$dom);
#now check for further files in directory
my @all_files=<*>;
#Determine Test Titel
my $title=$dom->findvalue('fleurInput/comment');
$title=~s/\W//g;
print "Test-Title :$title\n";
my @labels=();
#Determine Labels
my $iter=$dom->findvalue('fleurInput/calculationSetup/scfLoop/@itmax');
push @labels,"MultipleIter" if ($iter>1);
my $jspins=$dom->findvalue('fleurInput/calculationSetup/magnetism/@jspins');
push @labels,"Magnetic" if ($jspins>1);
my $noco=$dom->findvalue('fleurInput/calculationSetup/magnetism/@noco');
$noco="F" if (!$noco);
push @labels,"Noco" if ($noco=~/t/i);
my $spinspiral=$dom->findvalue('fleurInput/calculationSetup/nocoParams/@l_ss');
$spinspiral="F" if (!$spinspiral);
push @labels,"SpinSpiral" if ($spinspiral=~/t/i);
my $soc=$dom->findvalue('fleurInput/calculationSetup/soc/@l_soc');
$soc="F" if (!$soc);
push @labels,"SOC" if ($soc=~/t/i);
my $bulk=$dom->findnodes('fleurInput/cell/bulkLattice');
if ($bulk) {
push @labels,"Bulk"
}else{
push @labels,"Film"}
;
my @specieslist=$dom->findnodes('fleurInput/atomSpecies/species');
push @labels,"MultipleSpecies" if (scalar(@specieslist)>1);
my $los=0;
foreach my $species (@specieslist){
$los=1 if ($species=~/\<lo/);
}
push @labels,"LOs" if ($los);
my @atlist=$dom->findnodes('fleurInput/atomGroups/atomGroup');
push @labels,"MultipleAtomGroups" if (scalar(@atlist)>1);
my $invs=0;
if ($dom->findnodes('fleurInput/cell/symmetry')){
$invs=1 if ($dom->findvalue('fleurInput/cell/symmetry/@invs')=~/t/i);
}elsif($dom->findnodes('fleurInput/cell/symmetryFile')){
my $file=$dom->findvalue('fleurInput/cell/symmetryFile/@filename');
open (SYM,"<$file");
my $l=<SYM>;
$l=~/ *([0-9]*)/;
my $nops=$1;
for (my $i=0;$i<$nops;$i++){
<SYM>; #skip line
my $l1=<SYM>;$l1=~s/^ *//;
my $l2=<SYM>;$l2=~s/^ *//;
my $l3=<SYM>;$l3=~s/^ *//;
(my $x,my $y,my $z,my $s)=split(/ +/,$l1);
if (abs($x-1.)+abs($y)+abs($z)+abs($s)<0.000001){
($x,$y,$z,$s)=split(/ +/,$l2);
if (abs($x)+abs($y-1.)+abs($z)+abs($s)<0.000001){
($x,$y,$z,$s)=split(/ +/,$l3);
if (abs($x)+abs($y)+abs($z-1.)+abs($s)<0.000001){
$invs=1;
}
}
}
}
close(SYM);
}else{
foreach my $symop ($dom->findnodes('fleurInput/cell/symmetryOperations/symOp')){
my $l1=$symop->getChildrenByTagName("row-1")->to_literal();$l1=~s/^ *//;
my $l2=$symop->getChildrenByTagName("row-2")->to_literal();$l2=~s/^ *//;
my $l3=$symop->getChildrenByTagName("row-3")->to_literal();$l3=~s/^ *//;
(my $x,my $y,my $z,my $s)=split(/ +/,$l1);
if (abs($x-1.)+abs($y)+abs($z)+abs($s)<0.000001){
($x,$y,$z,$s)=split(/ +/,$l2);
if (abs($x)+abs($y-1.)+abs($z)+abs($s)<0.000001){
($x,$y,$z,$s)=split(/ +/,$l3);
if (abs($x)+abs($y)+abs($z-1.)+abs($s)<0.000001){
$invs=1;
}
}
}
}
}
push @labels,"Inversion" if ($invs);
print "Test Labels:";
foreach my $l (@labels) {
print $l," ";
}
#Now run fleur to generate reference data
print "\n\n Running FLEUR for $title\n";
system("$fleur");
#delete unneeded stuff
my @files=<*>;
foreach my $file (@files){
`rm $file` if (!($file ~~ @all_files) && !($file eq "out"));
}
#find reference values
my @greplines=("new fermi energy","total energy=",
"distance of charge densities for it=",
"qfix",
"total energy=",
"bandgap",
"first approx. to ef",
"mm 1"
);
my @regexp=(".*: *([^ ]*)",".*= *([^ ]*)",
": *([^ ]*)",
"qfix= *([^ ]*)",
".*= *([^ ]*)",
".*: *([^ ]*)",
'.*: *([^ ]*)',
".*mm 1 *([^ ]*)"
);
my @tol=(0.00001,0.00001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001);
my @refval=();
print "tests:",scalar(@greplines),"\n";
for (my $i=0;$i<scalar(@greplines);$i++){
my $l=`grep \"$greplines[$i]\" out`;
$l=~m/$regexp[$i]/s;
if (defined $1){
$refval[$i]=$1;
print "Refvalue $i:$1\n";
}
}
#Now generate the testscript
open(TS,">test.run1");
print TS "#Testscript autogenerated\n\n";
foreach my $file (@all_files){
print TS 'jt::copyfile("',$file,'",$workdir);',"\n";
}
print TS 'jt::testrun("$executable",$workdir);',"\n";
print TS '$result=0;',"\n";
for (my $i=0;$i<scalar(@greplines);$i++){
if (defined $refval[$i]){
print TS '$result+=jt::test_grepnumber("$workdir/out","';
print TS $greplines[$i];
print TS '","';
print TS $regexp[$i];
print TS '",';
print TS $refval[$i],",",$tol[$i],");\n";
}
}
print TS "\n",'jt::stageresult($workdir,$result,"1");',"\n";
close(TS);
#Now generate test.cmake
open(TC,">test.cmake");
print TC "add_test(FLEUR:$title \$\{CMAKE_CURRENT_SOURCE_DIR\}/tests/test_new.pl $dir \$\{CMAKE_BINARY_DIR\}/fleur)\n";
print TC "set_property(TEST FLEUR:$title PROPERTY LABELS ";
foreach my $l (@labels){print TC " $l";};
print TC ")\nif(\$\{FLEUR_USE_MPI\})\n";
print TC "add_test(MPI:$title \$\{CMAKE_CURRENT_SOURCE_DIR\}/tests/test_new.pl $dir \$\{CMAKE_BINARY_DIR\}/fleur_MPI)\n";
print TC "set_property(TEST FLEUR_MPI:$title PROPERTY LABELS ";
foreach my $l (@labels){print TC " $l";};
print TC ")\nendif()\n";
close(TC);
#!/usr/bin/perl
# Driver for cmake testing of FLEUR
# See README.tests for details
use strict;
my $dir;
BEGIN{
$dir=$0;
$dir=~s/test_new.pl//;
}
use lib "$dir/scripts";
use judft_tests;
my $testdir=shift;
my $executable=shift;
#check MPI environment
my $mpi=shift;
if ($mpi){
if ($ENV{"juDFT_MPI"}) {
$mpi=$ENV{"juDFT_MPI"};
}
}
if ($executable=~/_MPI/){
if (!$mpi){
#Try default mpi setting if none was given
$mpi="mpirun -np 2 "
}
}else{
#no mpi executable...
$mpi='';
}
print "MPI:$mpi\n";
my $workdir="$ENV{PWD}/Testing/work";
system("rm $workdir/*");
chdir($dir);
judft_tests::execute_test($testdir,$executable,$mpi,$workdir);
#Loop over testcases subdirectories and add test.cmake
file(GLOB dirs "tests/testcases/*")
foreach(dir ${dirs})
include(${dir}/test.cmake)
endforeach()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment