Skip to content
Snippets Groups Projects
Commit 06f00e03 authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Added FMT to DUMPDERIVATIVES

I had a problem with regtest rt6, probably due to numerical errors
on numerical derivatives. I added the possibility of specifying the format
in DUMPDERIVATIVES so that we can print just a few digits in the regtests.
As a default, I leave the "accurate" choice %15.10f.
parent 500859c0
No related branches found
No related tags found
No related merge requests found
#! FIELDS time parameter ang1 ang1n
0.000000 0 0.0704981645 0.0704980753
0.000000 1 -0.6024278520 -0.6024267897
0.000000 2 0.0227624896 0.0227624588
0.000000 3 -0.0704981645 -0.0704979897
0.000000 4 0.6024278520 0.6024269052
0.000000 5 -0.0227624896 -0.0227625258
0.000000 6 0.0464809710 0.0464811660
0.000000 7 -0.3656386969 -0.3656380624
0.000000 8 -0.1212810755 -0.1212808602
0.000000 9 -0.0464809710 -0.0464808457
0.000000 10 0.3656386969 0.3656381220
0.000000 11 0.1212810755 0.1212815233
0.000000 12 -0.0049637630 -0.0049639327
0.000000 13 0.0415172332 0.0415190896
0.000000 14 0.0022827520 0.0022818019
0.000000 15 0.0415172332 0.0415172500
0.000000 16 -0.3292789557 -0.3292791969
0.000000 17 -0.0967236219 -0.0967258182
0.000000 18 0.0022827520 0.0022830971
0.000000 19 -0.0967236219 -0.0967285212
0.000000 20 0.3342427186 0.3342424914
0.050000 0 0.1134333365 0.1134331338
0.050000 1 -0.5946919406 -0.5946909711
0.050000 2 0.0406227937 0.0406229123
0.050000 3 -0.1134333365 -0.1134337224
0.050000 4 0.5946919406 0.5946909562
0.050000 5 -0.0406227937 -0.0406227298
0.050000 6 0.0783209377 0.0783207901
0.050000 7 -0.3688001068 -0.3687995002
0.050000 8 -0.1205709648 -0.1205707453
0.050000 9 -0.0783209377 -0.0783211738
0.050000 10 0.3688001068 0.3688012362
0.050000 11 0.1205709648 0.1205707639
0.050000 12 -0.0138143848 -0.0138141930
0.050000 13 0.0715684776 0.0715657802
0.050000 14 -0.0019058856 -0.0019070766
0.050000 15 0.0715684776 0.0715721998
0.050000 16 -0.3425522887 -0.3425522598
0.050000 17 -0.0904532610 -0.0904526087
0.050000 18 -0.0019058856 -0.0019020647
0.050000 19 -0.0904532610 -0.0904487419
0.050000 20 0.3563666734 0.3563666780
0.100000 0 0.1587798362 0.1587803774
0.100000 1 -0.5854346352 -0.5854364820
0.100000 2 0.0556431713 0.0556433871
0.100000 3 -0.1587798362 -0.1587795541
0.100000 4 0.5854346352 0.5854336843
0.100000 5 -0.0556431713 -0.0556430630
0.100000 6 0.1113158904 0.1113157272
0.100000 7 -0.3644705197 -0.3644698970
0.100000 8 -0.1129775544 -0.1129773334
0.100000 9 -0.1113158904 -0.1113161854
0.100000 10 0.3644705197 0.3644698970
0.100000 11 0.1129775544 0.1129774190
0.100000 12 -0.0272132776 -0.0272132843
0.100000 13 0.1001222092 0.1001312141
0.100000 14 -0.0088242481 -0.0088238495
0.100000 15 0.1001222092 0.1001240436
0.100000 16 -0.3349839467 -0.3349840958
0.100000 17 -0.0779268069 -0.0779262560
0.100000 18 -0.0088242481 -0.0088245628
0.100000 19 -0.0779268069 -0.0779259556
0.100000 20 0.3621972244 0.3621970422
0.150000 0 0.1979503576 0.1979510188
0.150000 1 -0.5748858667 -0.5748848990
0.150000 2 0.0692392407 0.0692394525
0.150000 3 -0.1979503576 -0.1979500353
0.150000 4 0.5748858667 0.5748849027
0.150000 5 -0.0692392407 -0.0692391247
0.150000 6 0.1379329494 0.1379327327
0.150000 7 -0.3547090407 -0.3547084481
0.150000 8 -0.0998337781 -0.0998336114
0.150000 9 -0.1379329494 -0.1379333921
0.150000 10 0.3547090407 0.3547101654
0.150000 11 0.0998337781 0.0998340808
0.150000 12 -0.0407942582 -0.0407942665
0.150000 13 0.1194723076 0.1194648862
0.150000 14 -0.0174903373 -0.0174930073
0.150000 15 0.1194723076 0.1194753229
0.150000 16 -0.3150241241 -0.3150240545
0.150000 17 -0.0613313856 -0.0613346318
0.150000 18 -0.0174903373 -0.0174916557
0.150000 19 -0.0613313856 -0.0613277053
0.150000 20 0.3558183824 0.3558185463
0.200000 0 0.1941465028 0.1941471100
0.200000 1 -0.5695377309 -0.5695395283
0.200000 2 0.0833716702 0.0833715051
0.200000 3 -0.1941465028 -0.1941461936
0.200000 4 0.5695377309 0.5695367940
0.200000 5 -0.0833716702 -0.0833715685
0.200000 6 0.1368796946 0.1368801259
0.200000 7 -0.3543986865 -0.3543981276
0.200000 8 -0.0901263456 -0.0901262276
0.200000 9 -0.1368796946 -0.1368794739
0.200000 10 0.3543986865 0.3543997779
0.200000 11 0.0901263456 0.0901261643
0.200000 12 -0.0397989898 -0.0397989534
0.200000 13 0.1190371686 0.1190422385
0.200000 14 -0.0243079527 -0.0243094493
0.200000 15 0.1190371686 0.1190330595
0.200000 16 -0.3186200210 -0.3186200136
0.200000 17 -0.0454731155 -0.0454743818
0.200000 18 -0.0243079527 -0.0243117205
0.200000 19 -0.0454731155 -0.0454620117
0.200000 20 0.3584190108 0.3584191735
0.000000 0 0.07050 0.07050
0.000000 1 -0.60243 -0.60243
0.000000 2 0.02276 0.02276
0.000000 3 -0.07050 -0.07050
0.000000 4 0.60243 0.60243
0.000000 5 -0.02276 -0.02276
0.000000 6 0.04648 0.04648
0.000000 7 -0.36564 -0.36564
0.000000 8 -0.12128 -0.12128
0.000000 9 -0.04648 -0.04648
0.000000 10 0.36564 0.36564
0.000000 11 0.12128 0.12128
0.000000 12 -0.00496 -0.00496
0.000000 13 0.04152 0.04152
0.000000 14 0.00228 0.00228
0.000000 15 0.04152 0.04152
0.000000 16 -0.32928 -0.32928
0.000000 17 -0.09672 -0.09673
0.000000 18 0.00228 0.00228
0.000000 19 -0.09672 -0.09673
0.000000 20 0.33424 0.33424
0.050000 0 0.11343 0.11343
0.050000 1 -0.59469 -0.59469
0.050000 2 0.04062 0.04062
0.050000 3 -0.11343 -0.11343
0.050000 4 0.59469 0.59469
0.050000 5 -0.04062 -0.04062
0.050000 6 0.07832 0.07832
0.050000 7 -0.36880 -0.36880
0.050000 8 -0.12057 -0.12057
0.050000 9 -0.07832 -0.07832
0.050000 10 0.36880 0.36880
0.050000 11 0.12057 0.12057
0.050000 12 -0.01381 -0.01381
0.050000 13 0.07157 0.07157
0.050000 14 -0.00191 -0.00191
0.050000 15 0.07157 0.07157
0.050000 16 -0.34255 -0.34255
0.050000 17 -0.09045 -0.09045
0.050000 18 -0.00191 -0.00190
0.050000 19 -0.09045 -0.09045
0.050000 20 0.35637 0.35637
0.100000 0 0.15878 0.15878
0.100000 1 -0.58543 -0.58544
0.100000 2 0.05564 0.05564
0.100000 3 -0.15878 -0.15878
0.100000 4 0.58543 0.58543
0.100000 5 -0.05564 -0.05564
0.100000 6 0.11132 0.11132
0.100000 7 -0.36447 -0.36447
0.100000 8 -0.11298 -0.11298
0.100000 9 -0.11132 -0.11132
0.100000 10 0.36447 0.36447
0.100000 11 0.11298 0.11298
0.100000 12 -0.02721 -0.02721
0.100000 13 0.10012 0.10013
0.100000 14 -0.00882 -0.00882
0.100000 15 0.10012 0.10012
0.100000 16 -0.33498 -0.33498
0.100000 17 -0.07793 -0.07793
0.100000 18 -0.00882 -0.00882
0.100000 19 -0.07793 -0.07793
0.100000 20 0.36220 0.36220
0.150000 0 0.19795 0.19795
0.150000 1 -0.57489 -0.57488
0.150000 2 0.06924 0.06924
0.150000 3 -0.19795 -0.19795
0.150000 4 0.57489 0.57488
0.150000 5 -0.06924 -0.06924
0.150000 6 0.13793 0.13793
0.150000 7 -0.35471 -0.35471
0.150000 8 -0.09983 -0.09983
0.150000 9 -0.13793 -0.13793
0.150000 10 0.35471 0.35471
0.150000 11 0.09983 0.09983
0.150000 12 -0.04079 -0.04079
0.150000 13 0.11947 0.11946
0.150000 14 -0.01749 -0.01749
0.150000 15 0.11947 0.11948
0.150000 16 -0.31502 -0.31502
0.150000 17 -0.06133 -0.06133
0.150000 18 -0.01749 -0.01749
0.150000 19 -0.06133 -0.06133
0.150000 20 0.35582 0.35582
0.200000 0 0.19415 0.19415
0.200000 1 -0.56954 -0.56954
0.200000 2 0.08337 0.08337
0.200000 3 -0.19415 -0.19415
0.200000 4 0.56954 0.56954
0.200000 5 -0.08337 -0.08337
0.200000 6 0.13688 0.13688
0.200000 7 -0.35440 -0.35440
0.200000 8 -0.09013 -0.09013
0.200000 9 -0.13688 -0.13688
0.200000 10 0.35440 0.35440
0.200000 11 0.09013 0.09013
0.200000 12 -0.03980 -0.03980
0.200000 13 0.11904 0.11904
0.200000 14 -0.02431 -0.02431
0.200000 15 0.11904 0.11903
0.200000 16 -0.31862 -0.31862
0.200000 17 -0.04547 -0.04547
0.200000 18 -0.02431 -0.02431
0.200000 19 -0.04547 -0.04546
0.200000 20 0.35842 0.35842
......@@ -5,6 +5,7 @@ DUMPDERIVATIVES ...
STRIDE=10
ARG=ang1,ang1n
FILE=DERIVATIVES
FMT=%8.5f
... DUMPDERIVATIVES
ENDPLUMED
......
......@@ -44,6 +44,7 @@ public ActionPilot,
public ActionWithArguments
{
string file;
string fmt;
FILE* fp;
public:
void calculate(){};
......@@ -59,13 +60,17 @@ GenericDumpDerivatives::GenericDumpDerivatives(const ActionOptions&ao):
Action(ao),
ActionPilot(ao),
ActionWithArguments(ao),
fmt("%15.10f"),
fp(NULL)
{
parse("FILE",file);
assert(file.length()>0);
parse("FMT",fmt);
fmt=" "+fmt;
if(comm.Get_rank()==0){
fp=fopen(file.c_str(),"wa");
log.printf(" on file %s\n",file.c_str());
log.printf(" with format %s\n",fmt.c_str());
fprintf(fp,"%s","#! FIELDS time parameter");
const std::vector<Value*>& arguments(getArguments());
assert(arguments.size()>0);
......@@ -91,7 +96,7 @@ void GenericDumpDerivatives::update(){
fprintf(fp," %f",getTime());
fprintf(fp," %u",ipar);
for(unsigned i=0;i<getNumberOfArguments();i++){
fprintf(fp," %15.10f",arguments[i]->getDerivatives()[ipar]);
fprintf(fp,fmt.c_str(),arguments[i]->getDerivatives()[ipar]);
};
fprintf(fp,"\n");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment