-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathread_input.l
2176 lines (2054 loc) · 65.4 KB
/
read_input.l
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/***********************************************************************
*
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Carsten Urbach
*
* Modified by Jenifer Gonzalez Lopez 2009/03/27
*
* This file is part of tmLQCD.
*
* tmLQCD is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* tmLQCD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with tmLQCD. If not, see <http://www.gnu.org/licenses/>.
* This is the parser. (Dec 2002)
* The .c-file is generated from .l using flex.
* Please edit read_input.l instead of read_input.c!
* flex should be said to be case insensitive!
*
* After modifiing read_input.l please update read_input.c with
* flex -Ptmlqcd -i -t read_input.l > read_input.c
*
* Autor: Carsten Urbach
***********************************************************************/
SPC [[:blank:]]+
CMD [:][[:space:]]+
RLN [1-9(10)(11)(12)(13)(14)(15)(16)][:]
DIGIT [[:digit:]]
ZT [0-9(10)(11)]
IDXEX ("-"{DIGIT}+)
SIGN ("+"|"-")
FLT {SIGN}?{DIGIT}+(".")?{DIGIT}*(e("-"|"+")?{DIGIT}+)?
FILENAME [a-zA-Z0-9_".""-""/"][a-zA-Z0-9"."_"-""/"]+
NAME [a-zA-Z0-9_]+
CSTR \"[a-zA-Z0-9\-\._]+\"
TYPE [0-9A-Z]+
FLTLIST [0-9"."","" "]*
EQL {SPC}*={SPC}*
%{
#ifdef HAVE_CONFIG_H
# include<config.h>
#endif
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include"global.h"
#include"read_input.h"
#include"default_input_values.h"
#include"monomial.h"
#include"measurements.h"
#include"integrator.h"
#include"operator.h"
#include"phmc.h"
#include<io/params.h>
static inline void rmQuotes(char *str){
char* strsave=str;
while(*str== ' ' || *str == '\t') str++;
if(*str=='\"') *(strsave++)=*( ++str );
else fprintf(stderr,"Error in removing quotes from string:\n %s \n" , str);
++str;
while( !( *str=='\0' || *str == '\"' || *str == '\n') ) *(strsave++)=*(str++);
*strsave='\0';
}
/* Name of the parsing routine */
#define YY_DECL int parse_config()
#define YY_NO_UNPUT
/* helper vars */
char *cstring_to_parse=NULL;
int cstring_caller;
int solver_caller;
/* declaration of input parameters */
int i=0;
int line_of_file = 1;
int current_monomial = -1;
int current_measurement=-1;
int current_operator = -1;
extern int no_monomials;
extern int no_measurements;
monomial * mnl = NULL;
measurement * meas = NULL;
operator * optr = NULL;
int comment_caller;
int name_caller;
int a,b;
double c;
float cs;
int reread = 0;
char name[100];
char * type;
int verbose = 0;
int myverbose = 0;
int startoption;
int Ntherm;
int Nmeas;
int Nsave;
int gmres_m_parameter, gmresdr_nr_ev;
int write_cp_flag;
int cp_interval;
int nstore;
int index_start, index_end;
int random_seed;
int rlxd_level;
char rlxd_input_filename[500];
char gauge_input_filename[500];
int read_source_flag;
int return_check_flag, return_check_interval;
int gauge_precision_read_flag;
int gauge_precision_write_flag;
int g_disable_IO_checks;
int gmres_m_parameter, gmresdr_nr_ev;
int reproduce_randomnumber_flag;
double stout_rho;
int stout_no_iter;
int use_stout_flag;
int phmc_no_flavours;
int phmc_heavy_timescale;
int phmc_exact_poly;
int compute_evs;
int phmc_compute_evs;
double stilde_max;
double stilde_min;
int degree_of_p;
int source_location;
int no_eigenvalues;
double eigenvalue_precision;
int sub_evs_cg_flag;
int even_odd_flag;
int bc_flag;
int online_measurement_flag;
int online_measurement_freq;
int reweighting_flag;
int reweighting_samples;
int no_samples;
int compute_modenumber;
int compute_topsus;
double mstarsq;
int no_sources_z2;
int usegpu_flag;
int max_innersolver_it;
int device_num;
double innersolver_precision;
double innersolver_precision_abs;
double innersolver_precision_rel;
int innersolver_precision_check_abs;
int innersolver_precision_check_rel;
int propagator_comparison;
int nb_cores;
int omp_num_threads;
int nblocks_t;
int nblocks_x;
int nblocks_y;
int nblocks_z;
int dfl_field_iter;
int dfl_poly_iter;
int use_preconditioning;
%}
%option never-interactive
%x STARTCOND
%x THERMSWEEPS
%x NMEAS
%x KAPPA
%x MUBAR
%x EPSBAR
%x MU
%x CSW
%x SEED
%x RLXDLEVEL
%x NSAVE
%x RLXDINPUTFILE
%x GAUGEINPUTFILE
%x GAUGERPREC
%x GAUGEWPREC
%x DSBLIOCHECK
%x DFLSP
%x PRECON
%x WRITECP
%x CPINT
%x NSTORE
%x TT
%x LL
%x LLX
%x LLY
%x LLZ
%x TTBSF
%x NPROCX
%x NPROCY
%x NPROCZ
%x IOPROC
%x IDX
%x CGMAX
%x BCGMAX
%x BOUNDT
%x BOUNDX
%x BOUNDY
%x BOUNDZ
%X READSOURCE
%x SOURCEFORMAT
%x SOURCEFILE
%x SOURCETS
%x SOURCETYPE
%x PROPSPLIT
%x NOSAMPLES
%x RELPREC
%x REVCHECK
%x REVINT
%x DEBUG
%x GMRESM
%x GMRESDRNEV
%x REPRORND
%x SLOPPYPREC
%x USESTOUT
%x STOUTRHO
%x STOUTITER
%x COMPUTEEVS
%x SRCLOC
%x SUBEVCG
%x NOEV
%x PRECEV
%x EO
%x BC
%x WRPROPFLAG
%x PROPTYPE
%x COMPUTEMN
%x COMPUTETS
%x MSTARSQ
%x NOSOURCESZ2
%x INITMEASUREMENT
%x ONLINEMEAS
%x PIONNORMMEAS
%x PLOOP
%x REWEIGH
%x REWSAMPLES
%x INITINTEGRATOR
%x INTEGRATOR
%x GPU
%x INITGPU
%x INITOPERATOR
%x TMOP
%x DBTMOP
%x WILSONOP
%x OVERLAPOP
%x CLOVEROP
%x TMSOLVER
%x DBTMSOLVER
%x OVSOLVER
%x INITMONOMIAL
%x DETMONOMIAL
%x CLDETMONOMIAL
%x CLDETRATMONOMIAL
%x GAUGEMONOMIAL
%x SFGAUGEMONOMIAL
%x NDPOLYMONOMIAL
%x POLYMONOMIAL
%x MNAME
%x MCSTR
%x MSOLVER
%x GTYPE
%x COMMENT
%x ERROR
%x PCOMP
%x NBCORES
%x OMPNUMTHREADS
%x DFLNBLOCKT
%x DFLNBLOCKX
%x DFLNBLOCKY
%x DFLNBLOCKZ
%x DFLFIELDITER
%x DFLPOLYITER
%x PRECONDITIONING
%%
^SourceFilename{EQL} BEGIN(SOURCEFILE);
^T{EQL} BEGIN(TT);
^L{EQL} BEGIN(LL);
^LX{EQL} BEGIN(LLX);
^LY{EQL} BEGIN(LLY);
^LZ{EQL} BEGIN(LLZ);
^g_Tbsf{EQL} BEGIN(TTBSF);
^NRXProcs{EQL} BEGIN(NPROCX);
^NRYProcs{EQL} BEGIN(NPROCY);
^NRZProcs{EQL} BEGIN(NPROCZ);
^kappa{EQL} BEGIN(KAPPA);
^csw{EQL} BEGIN(CSW);
^2KappaMu{EQL} BEGIN(MU);
^2KappaMubar{EQL} BEGIN(MUBAR);
^2KappaEpsBar{EQL} BEGIN(EPSBAR);
^NoEigenvalues{EQL} BEGIN(NOEV);
^EigenvaluePrecision{EQL} BEGIN(PRECEV);
^seed{EQL} BEGIN(SEED);
^StartCondition{EQL} BEGIN(STARTCOND);
^ThermalisationSweeps{EQL} BEGIN(THERMSWEEPS);
^Measurements{EQL} BEGIN(NMEAS);
^NSave{EQL} BEGIN(NSAVE);
^GaugeFieldInFile{EQL} BEGIN(GAUGEINPUTFILE);
^RlxdStateInFile{EQL} BEGIN(RLXDINPUTFILE);
^SubtractEVForCG{EQL} BEGIN(SUBEVCG);
^WriteCheckpoints{EQL} BEGIN(WRITECP);
^CheckpointInterval{EQL} BEGIN(CPINT);
^GaugeConfigInputFile{EQL} BEGIN(GAUGEINPUTFILE);
^RlxdInputFile{EQL} BEGIN(RLXDINPUTFILE);
^InitialStoreCounter{EQL} BEGIN(NSTORE);
^StdIOProcessor{EQL} BEGIN(IOPROC);
^Indices{EQL} BEGIN(IDX);
^BCGstabMaxIter{EQL} BEGIN(BCGMAX);
^CGMaxIter{EQL} BEGIN(CGMAX);
^BCAngleT{EQL} BEGIN(BOUNDT);
^ThetaT{EQL} BEGIN(BOUNDT);
^ThetaX{EQL} BEGIN(BOUNDX);
^ThetaY{EQL} BEGIN(BOUNDY);
^ThetaZ{EQL} BEGIN(BOUNDZ);
^ReadSource{EQL} BEGIN(READSOURCE);
^UseRelativePrecision{EQL} BEGIN(RELPREC);
^ReversibilityCheck{EQL} BEGIN(REVCHECK);
^ReversibilityCheckIntervall{EQL} BEGIN(REVINT);
^DebugLevel{EQL} BEGIN(DEBUG);
^GMRESMParameter{EQL} BEGIN(GMRESM);
^GMRESDRNrEv{EQL} BEGIN(GMRESDRNEV);
^GaugeConfigReadPrecision{EQL} BEGIN(GAUGERPREC);
^GaugeConfigWritePrecision{EQL} BEGIN(GAUGEWPREC);
^DisableIOChecks{EQL} BEGIN(DSBLIOCHECK);
^ReproduceRandomNumbers{EQL} BEGIN(REPRORND);
^UseSloppyPrecision{EQL} BEGIN(SLOPPYPREC);
^UseStoutSmearing{EQL} BEGIN(USESTOUT);
^StoutRho{EQL} BEGIN(STOUTRHO);
^StoutNoIterations{EQL} BEGIN(STOUTITER);
^ComputeEVs{EQL} BEGIN(COMPUTEEVS);
^SourceLocation{EQL} BEGIN(SRCLOC);
^UseEvenOdd{EQL} BEGIN(EO);
^Bc{EQL} BEGIN(BC);
^WritePropagatorFormat{EQL} BEGIN(WRPROPFLAG);
^PropagatorType{EQL} BEGIN(WRPROPFLAG);
^RanluxdLevel{EQL} BEGIN(RLXDLEVEL);
^DeflationSubspaceDimension{EQL} BEGIN(DFLSP);
^GCRPreconditioner{EQL} BEGIN(PRECON);
^ComputeReweightingFactor{EQL} BEGIN(REWEIGH);
^NoReweightingSamples{EQL} BEGIN(REWSAMPLES);
^SourceTimeSlice{EQL} BEGIN(SOURCETS);
^SourceType{EQL} BEGIN(SOURCETYPE);
^NoSamples{EQL} BEGIN(NOSAMPLES);
^SplittedPropagator{EQL} BEGIN(PROPSPLIT);
^UsePreconditioning{EQL} BEGIN(PRECONDITIONING);
^BeginMeasurement{SPC}+ BEGIN(INITMEASUREMENT);
^ComputeModeNumber{EQL} BEGIN(COMPUTEMN);
^ComputeTopSus{EQL} BEGIN(COMPUTETS);
^MStarSq{EQL} BEGIN(MSTARSQ);
^NoSourcesZ2{EQL} BEGIN(NOSOURCESZ2);
^BeginMonomial{SPC}+ BEGIN(INITMONOMIAL);
^BeginInt BEGIN(INITINTEGRATOR);
^BeginOperator{SPC}+ BEGIN(INITOPERATOR);
^PropagatorComparison{EQL} BEGIN(PCOMP);
^NbCoresPerNode{EQL} BEGIN(NBCORES);
^OMPNumThreads{EQL} BEGIN(OMPNUMTHREADS);
^NoBlocksT{EQL} BEGIN(DFLNBLOCKT);
^NoBlocksX{EQL} BEGIN(DFLNBLOCKX);
^NoBlocksY{EQL} BEGIN(DFLNBLOCKY);
^NoBlocksZ{EQL} BEGIN(DFLNBLOCKZ);
^DflFieldIter{EQL} BEGIN(DFLFIELDITER);
^DflPolyIter{EQL} BEGIN(DFLPOLYITER);
^BeginGPU BEGIN(INITGPU);
<INITGPU>Init{SPC}* {
if(myverbose) printf("Initialising GPU line %d\n", line_of_file);
usegpu_flag = 1;
if(myverbose!=0) printf(" Using help of GPU for inversions\n");
BEGIN(GPU);
}
<GPU>{
{SPC}*InnersolverPrecision{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
innersolver_precision = c;
if(myverbose) printf(" Inner solver precision set to %lf line %d\n", c, line_of_file);
}
{SPC}*MaxInnersolverIteration{EQL}{DIGIT}+ {
sscanf(yytext, " %[2a-zA-Z] = %d", name, &a);
max_innersolver_it = a;
if(myverbose) printf(" Inner solver iterations set to %d line %d\n", a, line_of_file);
}
{SPC}*DeviceNum{EQL}{DIGIT}+ {
sscanf(yytext, " %[2a-zA-Z] = %d", name, &a);
device_num = a;
if(myverbose) printf(" Device Number set to %d line %d\n", a, line_of_file);
}
{SPC}*InnersolverPrecisionAbs{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
innersolver_precision_abs = c;
if(myverbose) printf(" innersolver_precision_abs set to %lf line %d\n", c, line_of_file);
}
{SPC}*InnersolverPrecisionRel{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
innersolver_precision_rel = c;
if(myverbose) printf(" innersolver_precision_rel set to %lf line %d\n", c, line_of_file);
}
{SPC}*InnersolverPrecisionCheckAbs{EQL}{DIGIT}+ {
sscanf(yytext, " %[2a-zA-Z] = %d", name, &a);
innersolver_precision_check_abs = a;
if(myverbose) printf(" innersolver_precision_check_abs set to %d line %d\n", a, line_of_file);
}
{SPC}*InnersolverPrecisionCheckRel{EQL}{DIGIT}+ {
sscanf(yytext, " %[2a-zA-Z] = %d", name, &a);
innersolver_precision_check_rel = a;
if(myverbose) printf(" innersolver_precision_check_rel set to %d line %d\n", a, line_of_file);
}
EndGPUInit{SPC}* {
if(myverbose) printf("GPU parsed in line %d\n\n", line_of_file);
BEGIN(0);
}
}
<INITOPERATOR>{TYPE} {
current_operator++;
optr = &operator_list[current_operator];
optr->id = current_operator;
optr->initialised = 0;
if(strcmp(yytext, "WILSON")==0) {
optr->type = WILSON;
}
else if(strcmp(yytext, "TMWILSON")==0) {
optr->type = TMWILSON;
}
else if(strcmp(yytext, "CLOVER")==0) {
optr->type = CLOVER;
}
else if(strcmp(yytext, "DBTMWILSON")==0) {
optr->type = DBTMWILSON;
}
else if(strcmp(yytext, "OVERLAP")==0) {
optr->type = OVERLAP;
}
else {
fprintf(stderr, "Unknown operator type %s in line %d\n", yytext, line_of_file);
exit(1);
}
if(!reread) {
if(add_operator(optr->type) < 0) {
fprintf(stderr, "Something went wrong in adding operators\nAborting...!\n");
exit(1);
}
}
if(myverbose) printf("initialising operator with type %s (%d) line %d\n", yytext, optr->type, line_of_file);
if(myverbose) printf("operator has id %d\n", current_operator);
if(optr->type == WILSON) BEGIN(WILSONOP);
else if(optr->type == CLOVER) BEGIN(CLOVEROP);
else if(optr->type == TMWILSON) BEGIN(TMOP);
else if(optr->type == DBTMWILSON) BEGIN(DBTMOP);
else BEGIN(OVERLAPOP);
}
<WILSONOP,TMOP,OVERLAPOP,DBTMOP,CLOVEROP>{
{SPC}*kappa{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
optr->kappa = c;
if(myverbose) printf(" kappa set to %f line %d operator %d\n", c, line_of_file, current_operator);
}
{SPC}*MaxSolverIterations{EQL}{DIGIT}+ {
sscanf(yytext, " %[a-zA-Z] = %d", name, &a);
optr->maxiter = a;
if(myverbose) printf(" MaxSolverIterations set to %d line %d operator %d\n", a, line_of_file, current_operator);
}
{SPC}*PropagatorPrecision{EQL}32 {
optr->prop_precision = 32;
PropInfo.precision = 32;
if(myverbose) printf(" PropagatorPrecision set to 32 line %d operator %d\n", line_of_file, current_operator);
}
{SPC}*PropagatorPrecision{EQL}64 {
optr->prop_precision = 64;
PropInfo.precision = 64;
if(myverbose) printf(" PropagatorPrecision set to 64 line %d operator %d\n", line_of_file, current_operator);
}
{SPC}*SolverPrecision{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
optr->eps_sq = c;
if(myverbose) printf(" SolverPrecision set to %f line %d operator %d\n", c, line_of_file, current_operator);
}
{SPC}*SolverRelativePrecision{EQL}yes {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
optr->rel_prec = 1;
if(myverbose) printf(" SolverRelativePrecision set to YES line %d operator %d\n", line_of_file, current_operator);
}
{SPC}*SolverRelativePrecision{EQL}no {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
optr->rel_prec = 0;
if(myverbose) printf(" SolverRelativePrecision set to NO line %d operator %d\n", line_of_file, current_operator);
}
{SPC}*ExtraMasses{EQL}{FLTLIST} {
char * token = NULL;
optr->no_extra_masses = 0;
double mass;
if( strtok(yytext,"\n\t =,\\") != NULL ) {
/* Implicitly drop the first token, it is "ExtraMasses" */
token = strtok(NULL," =,\t");
while( token != NULL ) {
if( optr->no_extra_masses >= MAX_EXTRA_MASSES ) {
yy_fatal_error(" CGMMS maximum number of extra masses reached. Increase MAX_EXTRA_MASSES in global.h!");
}
sscanf(token,"%lf",&mass);
optr->extra_masses[optr->no_extra_masses] = mass;
if(myverbose) printf(" CGMMS extra mass %d = %lf (2*kappa*mu) added line %d operator %d\n",optr->no_extra_masses,mass,line_of_file,current_operator);
++(optr->no_extra_masses);
token = strtok(NULL," =,\t");
}
} else {
yy_fatal_error(" CGMMS Failed to read ExtraMasses input line in configuration file!");
}
if( optr->no_extra_masses == 0 ) {
yy_fatal_error(" CGMMS Failed to add any extra masses. Input line must be malformed.");
} else {
if(myverbose) printf(" CGMMS %d extra masses added line %d operator %d\n",optr->no_extra_masses,line_of_file,current_operator);
}
}
{SPC}*ExtraMasses{EQL}{FILENAME} {
FILE * ifs;
double tempmass = 0.0;
optr->no_extra_masses = 0;
char * token = NULL;
if( strtok(yytext,"\n\t =,\\") != NULL ) {
/* drop the first token, it is ExtraMasses" */
token = strtok(NULL," =\t");
if( token != NULL ) {
printf(" CGMMS Reading extra masses input file %s\n",token);
if ((ifs = fopen(token, "r")) != NULL) {
while ( fscanf( ifs, "%lf", &tempmass ) != EOF ) {
if( optr->no_extra_masses >= MAX_EXTRA_MASSES ) {
yy_fatal_error(" CGMMS maximum number of extra masses reached. Increase MAX_EXTRA_MASSES in global.h!");
}
optr->extra_masses[optr->no_extra_masses] = tempmass;
if (myverbose) {
printf(" CGMMS Extra mass %d = %lf (2*kappa*mu) added line %d operator %d\n",
optr->no_extra_masses, optr->extra_masses[optr->no_extra_masses],line_of_file,current_operator);
}
++(optr->no_extra_masses);
}
if( optr->no_extra_masses == 0 ) {
yy_fatal_error(" CGMMS Failed to add any extra masses. Extra masses input file must be malformed!");
}
else {
if(myverbose)
printf(" CGMMS %d extra masses added line %d operator %d\n",optr->no_extra_masses,line_of_file,current_operator);
}
fclose(ifs);
}
else {
fprintf(stderr, "Could not open extra masses input file %s\n",token);
optr->no_extra_masses=0;
}
}
}
}
^EndOperator{SPC}* {
if(myverbose) printf("operator %d parsed line %d\n\n", current_operator, line_of_file);
BEGIN(0);
}
}
<WILSONOP,TMOP>{
{SPC}*Solver{EQL} {
name_caller = YY_START;
BEGIN(TMSOLVER);
}
}
<WILSONOP,TMOP>{
{SPC}*UseEvenOdd{EQL}yes {
if(myverbose) printf(" Use even/odd preconditioning line %d operator %d\n", line_of_file, current_operator);
optr->even_odd_flag = 1;
}
{SPC}*UseEvenOdd{EQL}no {
if(myverbose) printf(" Do not use even/odd preconditioning line %d operator %d\n", line_of_file, current_operator);
optr->even_odd_flag = 0;
}
}
<DBTMOP>{
{SPC}*2KappaMubar{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
optr->mubar = c;
if(myverbose) printf(" 2KappaMubar set to %f line %d operator %d\n", c, line_of_file, current_operator);
}
{SPC}*2KappaEpsbar{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
optr->epsbar = c;
if(myverbose) printf(" 2KappaEpsbar set to %f line %d operator %d\n", c, line_of_file, current_operator);
}
{SPC}*Solver{EQL} {
name_caller = YY_START;
BEGIN(DBTMSOLVER);
}
}
<TMOP,CLOVEROP>{
{SPC}*2KappaMu{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
optr->mu = c;
if(myverbose) printf(" 2KappaMu set to %f line %d operator %d\n", c, line_of_file, current_operator);
}
{SPC}*AddDownPropagator{EQL}yes {
optr->DownProp = 1;
if(myverbose) printf(" Invert for + and - mu set in line %d operator %d\n", line_of_file, current_operator);
}
{SPC}*AddDownPropagator{EQL}no {
optr->DownProp = 0;
if(myverbose) printf(" Don't invert for + and - mu set in line %d operator %d\n", line_of_file, current_operator);
}
}
<CLOVEROP>{
{SPC}*csw{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
optr->c_sw = c;
if(myverbose) printf(" Set c_sw set to %lf in line %d for operator %d\n", optr->c_sw, line_of_file, current_operator);
}
}
<OVERLAPOP>{
{SPC}*Solver{EQL} {
BEGIN(OVSOLVER);
}
{SPC}*m{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
optr->m = c;
if(myverbose) printf(" m set to %f line %d operator %d\n", c, line_of_file, current_operator);
}
{SPC}*s{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
optr->s = c;
if(myverbose) printf(" s set to %f line %d operator %d\n", c, line_of_file, current_operator);
}
{SPC}*DegreeOfPolynomial{EQL}{DIGIT}+ {
sscanf(yytext, " %[a-zA-Z] = %d", name, &a);
optr->deg_poly = a;
if(myverbose) printf(" DegreeOfPolynomial set to %d line %d operator %d\n", a, line_of_file, current_operator);
}
{SPC}*NoKernelEigenvalues{EQL}{DIGIT}+ {
sscanf(yytext, " %[a-zA-Z] = %d", name, &a);
optr->no_ev = a;
if(myverbose) printf(" NoKernelEigenvalues set to %d line %d operator %d\n", a, line_of_file, current_operator);
}
{SPC}*KernelEigenvaluePrecision{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
optr->ev_prec = c;
if(myverbose) printf(" KernelEigenvaluePrecision set to %f line %d operator %d\n", c, line_of_file, current_operator);
}
{SPC}*KernelEigenvectorsReadWrite{EQL}yes {
optr->ev_readwrite = 1;
if(myverbose) printf(" KernelEigenvectorsReadWrite set to 1 line %d operator %d\n", line_of_file, current_operator);
}
{SPC}*KernelEigenvectorsReadWrite{EQL}no {
optr->ev_readwrite = 0;
if(myverbose) printf(" KernelEigenvectorsReadWrite set to 0 line %d operator %d\n", line_of_file, current_operator);
}
}
<DBTMSOLVER,TMSOLVER>{
cg {
optr->solver=1;
if(myverbose) printf(" Solver set to CG line %d operator %d\n", line_of_file, current_operator);
BEGIN(name_caller);
}
}
<TMSOLVER>{
mixedcg {
optr->solver=13;
if(myverbose) printf(" Solver set to MixedCG line %d operator %d\n", line_of_file, current_operator);
BEGIN(name_caller);
}
bicgstab {
optr->solver=0;
if(myverbose) printf(" Solver set to BiCGstab line %d operator %d\n", line_of_file, current_operator);
BEGIN(name_caller);
}
pcg {
optr->solver=9;
if(myverbose) printf(" Solver set to PCG line %d operator %d\n", line_of_file, current_operator);
BEGIN(name_caller);
}
gmres {
optr->solver=2;
if(myverbose) printf(" Solver set to GMRES line %d operator %d\n", line_of_file, current_operator);
BEGIN(name_caller);
}
gcr {
optr->solver=7;
if(myverbose) printf(" Solver set to GCR line %d operator %d\n", line_of_file, current_operator);
BEGIN(name_caller);
}
gmresdr {
optr->solver=8;
if(myverbose) printf(" Solver set to GMRES-DR line %d operator %d\n", line_of_file, current_operator);
BEGIN(name_caller);
}
cgs {
optr->solver=3;
if(myverbose) printf(" Solver set to CGS line %d operator %d\n", line_of_file, current_operator);
BEGIN(name_caller);
}
mr {
optr->solver=4;
if(myverbose) printf(" Solver set to MR line %d operator %d\n", line_of_file, current_operator);
BEGIN(name_caller);
}
fgmres {
optr->solver=6;
if(myverbose) printf(" Solver set to FGMRES line %d operator %d\n", line_of_file, current_operator);
BEGIN(name_caller);
}
dflgcr {
optr->solver=10;
g_dflgcr_flag = 1;
if(myverbose) printf(" Solver set to DFL-GCR line %d operator %d\n", line_of_file, current_operator);
BEGIN(name_caller);
}
dflfgmres {
optr->solver=11;
g_dflgcr_flag = 1;
if(myverbose) printf(" Solver set to DFL-FGMRES line %d operator %d\n", line_of_file, current_operator);
BEGIN(name_caller);
}
cgmms {
optr->solver = 12;
if(myverbose) printf(" Solver set to CGMMS line %d operator %d\n", line_of_file, current_operator);
BEGIN(name_caller);
}
}
<OVSOLVER>{
sumr {
optr->solver = 13;
if(myverbose) printf(" Solver set to SUMR line %d operator %d\n", line_of_file, current_operator);
BEGIN(OVERLAPOP);
}
cg {
optr->solver = 1;
if(myverbose) printf(" Solver set to SUMR line %d operator %d\n", line_of_file, current_operator);
BEGIN(OVERLAPOP);
}
}
<INITMONOMIAL>{TYPE} {
current_monomial++;
mnl = &monomial_list[current_monomial];
mnl->id = current_monomial;
if(strcmp(yytext, "DET")==0) {
mnl->type = DET;
strcpy((*mnl).name, "DET");
}
else if(strcmp(yytext, "CLOVERDET")==0) {
mnl->type = CLOVERDET;
strcpy((*mnl).name, "CLOVERDET");
g_dbw2rand = 1;
}
else if(strcmp(yytext, "CLOVERDETRATIO")==0) {
mnl->type = CLOVERDETRATIO;
strcpy((*mnl).name, "CLOVERDETRATIO");
g_dbw2rand = 1;
}
else if(strcmp(yytext, "DETRATIO")==0) {
mnl->type = DETRATIO;
strcpy((*mnl).name, "DETRATIO");
}
else if(strcmp(yytext, "NDDETRATIO")==0) {
mnl->type = NDDETRATIO;
strcpy((*mnl).name, "NDDETRATIO");
g_running_phmc = 1;
}
else if(strcmp(yytext, "NDPOLY")==0) {
mnl->type = NDPOLY;
strcpy((*mnl).name, "NDPOLY");
g_running_phmc = 1;
}
else if(strcmp(yytext, "POLY")==0) {
mnl->type = POLY;
strcpy((*mnl).name, "POLY");
}
else if(strcmp(yytext, "POLYDETRATIO")==0) {
mnl->type = POLYDETRATIO;
strcpy((*mnl).name, "POLYDETRATIO");
}
else if(strcmp(yytext, "GAUGE")==0) {
mnl->type = GAUGE;
mnl->gtype = 3;
strcpy((*mnl).name, "GAUGE");
}
else if(strcmp(yytext, "SFGAUGE")==0) {
mnl->type = SFGAUGE;
mnl->gtype = 6;
strcpy((*mnl).name, "SFGAUGE");
}
else {
fprintf(stderr, "Unknown monomial type %s in line %d\n", yytext, line_of_file);
exit(1);
}
if(!reread) {
if(add_monomial(mnl->type) < 0) {
fprintf(stderr, "Something went wrong in adding monomials\nAborting...!\n");
exit(1);
}
}
if(myverbose) printf("initialising monomial with type %s %d line %d\n", yytext, mnl->type, line_of_file);
if(myverbose) printf("monomial has id %d\n", current_monomial);
if(mnl->type == GAUGE) BEGIN(GAUGEMONOMIAL);
else if(mnl->type == SFGAUGE) BEGIN(SFGAUGEMONOMIAL);
else if(mnl->type == NDPOLY) BEGIN(NDPOLYMONOMIAL);
else if(mnl->type == POLY || mnl->type == POLYDETRATIO) {
fprintf(stderr,"starting to parse poly(detratio) monomial\n");
BEGIN(POLYMONOMIAL);
}
else if(mnl->type == CLOVERDET) BEGIN(CLDETMONOMIAL);
else if(mnl->type == CLOVERDETRATIO) BEGIN(CLDETRATMONOMIAL);
else BEGIN(DETMONOMIAL);
}
<DETMONOMIAL,GAUGEMONOMIAL,SFGAUGEMONOMIAL,NDPOLYMONOMIAL,POLYMONOMIAL,CLDETMONOMIAL,CLDETRATMONOMIAL>{
{SPC}*Timescale{EQL}{DIGIT}+ {
if(mnl->type == NDDETRATIO) {
mnl->timescale = -5;
if(myverbose) printf(" timescales set to %d line %d monomial %d since NDDETRATIO is not for MD evolution\n", a, line_of_file, current_monomial);
}
else {
sscanf(yytext, " %[a-zA-Z] = %d", name, &a);
mnl->timescale = a;
if(myverbose) printf(" timescales set to %d line %d monomial %d\n", a, line_of_file, current_monomial);
}
}
{SPC}*Name{EQL} {
name_caller = YY_START;
BEGIN(MNAME);
}
^EndMonomial{SPC}* {
if(myverbose) printf("monomial %d parsed line %d\n\n", current_monomial, line_of_file);
BEGIN(0);
}
}
<CLDETMONOMIAL,CLDETRATMONOMIAL>{
{SPC}*CSW{EQL}{FLT} {
sscanf(yytext, " %[a-zA-Z] = %lf", name, &c);
mnl->c_sw = c;
if(myverbose) printf(" CSW set to %f line %d monomial %d\n", c, line_of_file, current_monomial);
}
{SPC}*rho{EQL}{FLT} {
sscanf(yytext, " %[a-zA-Z] = %lf", name, &c);
mnl->rho = c;
if(myverbose) printf(" mass shift rho set to %f line %d monomial %d\n", c, line_of_file, current_monomial);
}
}
<CLDETRATMONOMIAL>{
{SPC}*rho2{EQL}{FLT} {
sscanf(yytext, " %[a-zA-Z]2 = %lf", name, &c);
mnl->rho2 = c;
if(myverbose) printf(" mass shift rho2 set to %f line %d monomial %d\n", c, line_of_file, current_monomial);
}
}
<DETMONOMIAL,POLYMONOMIAL>{
{SPC}*2KappaMu2{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
mnl->mu2 = c;
if(myverbose) printf(" 2KappaMu2 set to %f line %d monomial %d\n", c, line_of_file, current_monomial);
}
{SPC}*Kappa2{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
mnl->kappa2 = c;
if(myverbose) printf(" kappa2 set to %f line %d monomial %d\n", c, line_of_file, current_monomial);
}
{SPC}*2KappaMubar{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
mnl->mubar = c;
if(myverbose) printf(" 2KappaMubar set to %f line %d monomial %d\n", c, line_of_file, current_monomial);
}
{SPC}*2KappaMubar2{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
mnl->mubar2 = c;
if(myverbose) printf(" 2KappaMubar2 set to %f line %d monomial %d\n", c, line_of_file, current_monomial);
}
{SPC}*2KappaEpsbar{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
mnl->epsbar = c;
if(myverbose) printf(" 2KappaEpsbar set to %f line %d monomial %d\n", c, line_of_file, current_monomial);
}
{SPC}*2KappaEpsbar2{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
mnl->epsbar2 = c;
if(myverbose) printf(" 2KappaEpsbar2 set to %f line %d monomial %d\n", c, line_of_file, current_monomial);
}
}
<DETMONOMIAL,POLYMONOMIAL,CLDETMONOMIAL,CLDETRATMONOMIAL>{
{SPC}*2KappaMu{EQL}{FLT} {
sscanf(yytext, " %[2a-zA-Z] = %lf", name, &c);
mnl->mu = c;
if(myverbose) printf(" 2KappaMu set to %f line %d monomial %d\n", c, line_of_file, current_monomial);
}
{SPC}*Kappa{EQL}{FLT} {
sscanf(yytext, " %[a-zA-Z] = %lf", name, &c);
mnl->kappa = c;
if(myverbose) printf(" Kappa set to %f line %d monomial %d\n", c, line_of_file, current_monomial);
}
{SPC}*CSGHistory{EQL}{DIGIT}+ {
sscanf(yytext, " %[a-zA-Z] = %d", name, &a);
mnl->csg_N = a;
if(myverbose) printf(" csg history length set to %d line %d monomial %d\n", a, line_of_file, current_monomial);
}
{SPC}*CSGHistory2{EQL}{DIGIT}+ {
sscanf(yytext, " %[a-zA-Z2] = %d", name , &a);
mnl->csg_N2 = a;
if(myverbose) printf(" csg history2 length (for bicgstab) set to %d line %d monomial %d\n",
a, line_of_file, current_monomial);
}
{SPC}*ForcePrecision{EQL}{FLT} {
sscanf(yytext, " %[a-zA-Z] = %lf",name , &c);
mnl->forceprec = c;
if(myverbose) printf(" ForcePrecision set to %e line %d monomial %d\n", c, line_of_file, current_monomial);
}
{SPC}*AcceptancePrecision{EQL}{FLT} {
sscanf(yytext, " %[a-zA-Z] = %lf",name , &c);
mnl->accprec = c;
if(myverbose) printf(" AcceptancePrecision set to %e line %d monomial %d\n", c, line_of_file, current_monomial);
}
{SPC}*MaxSolverIterations{EQL}{DIGIT}+ {
sscanf(yytext, " %[a-zA-Z] = %d", name, &a);
mnl->maxiter = a;
if(myverbose) printf(" MaxSolverIterations set to %d line %d monomial %d\n", a, line_of_file, current_monomial);
}
{SPC}*Solver{EQL} {
solver_caller=YY_START;
BEGIN(MSOLVER);
}
}
<GAUGEMONOMIAL>{
{SPC}*Type{EQL} BEGIN(GTYPE);
{SPC}*UseRectangleStaples{EQL}yes {
mnl->use_rectangles = 1;
g_dbw2rand = 1;
if(myverbose) printf(" UseRectangleStaples set to true line %d monomial %d\n", line_of_file, current_monomial);
}
{SPC}*UseRectangleStaples{EQL}no {
mnl->use_rectangles = 0;
/* g_dbw2rand = 0; */
mnl->c1 = 0.;
g_rgi_C1 = 0.;
if(myverbose) printf(" UseRectangleStaples set to false line %d monomial %d\n", line_of_file, current_monomial);
}
{SPC}*Beta{EQL}{FLT} {
sscanf(yytext, " %[a-zA-Z] = %lf",name , &c);
mnl->beta = c;
g_beta = c;