forked from yzhphy/NeatIBP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAllMissionCompleteQ.wl
102 lines (60 loc) · 2.88 KB
/
AllMissionCompleteQ.wl
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
(* ::Package:: *)
commandLineMode=True
If[commandLineMode,
(*workingPath=Directory[]<>"/";*)
packagePath=DirectoryName[$InputFileName];
AbsMissionInput=$CommandLine[[-1]];
workingPath=DirectoryName[AbsMissionInput];
missionInput=FileNameSplit[AbsMissionInput][[-1]];
MathematicaCommand=Import[packagePath<>"/preload/MathematicaCommand.txt"];
ShellProcessor=Import[packagePath<>"/preload/ShellProcessor.txt"];
,
Print["WARNING: program is not running in command line mode!"];
workingPath=NotebookDirectory[]<>"examples/dbox/";
packagePath=NotebookDirectory[];
missionInput="inputs_and_config.txt"
(*LoopMomenta={l1,l2};
ExternalMomenta={k1,k2,k4};
Propagators={l1^2,(l1-k1)^2,(l1-k1-k2)^2,(l2+k1+k2)^2,(l2-k4)^2,l2^2,(l1+l2)^2,(l1+k4)^2,(l2+k1)^2};
Kinematics={k1^2->0,k2^2->0,k4^2->0,k1 k2->s/2,k1 k4->t/2,k2 k4->(-s/2-t/2)};
GenericPoint={s->-1,t->-3};
TargetIntegrals={G[1,1,1,1,1,1,1,-5,0],G[1,1,1,1,1,1,1,-4,-1],G[1,1,1,1,1,1,1,-1,-4]}*)
]
(*AppendTo[$Path,workingPath];*)
If[Get[packagePath<>"default_settings.txt"]===$Failed,Exit[0]]
If[Get[workingPath<>missionInput]===$Failed,Print["Unable to open config file "<>workingPath<>missionInput<>". Exiting.";Exit[]]]
If[Get[kinematicsFile]===$Failed,Print["Unable to open kinematics file "<>kinematicsFile<>". Exiting.";Exit[]]]
TargetIntegrals=Get[targetIntegralsFile]
If[TargetIntegrals===$Failed,Print["Unable to open target intergals file "<>targetIntegralsFile<>". Exiting.";Exit[]]]
(*getSparseRREF=True
getSparseRREF=<<SparseRREF`*)
If[outputPath===Automatic,
outputPath=workingPath<>"outputs/"<>ReductionOutputName<>"/";
]
If[Intersection[StringSplit[outputPath,""],{" ","\t","\n","?","@","#","$","*","&","(",")","\"","\'","|"}]=!={},
Print["echo \"Path "<>outputPath<>" is illegal. Exiting.\""];
Exit[0];
]
If[StringSplit[outputPath,""][[-1]]=!="/",outputPath=outputPath<>"/"]
tmpPath=outputPath<>"tmp/"
If[!FileExistsQ[tmpPath<>"initialized.txt"],
Export[tmpPath<>"initialization_failed.txt",""];
Print["echo \"Initialization failed, cannot start missions.\""];
Exit[0];
]
missionStatusFolder=outputPath<>"tmp/mission_status/"
SectorNumberToSectorIndex//ClearAll
SectorNumberToSectorIndex[num_]:=IntegerDigits[num,2,Length[Propagators]]//Reverse
missionStatus={ToExpression[StringReplace[FileNameSplit[#][[-1]],".txt"->""]]//SectorNumberToSectorIndex,Get[#]}&/@FileNames[All,missionStatusFolder]
If[!FileExistsQ[tmpPath<>"spanning_cuts_mode.txt"],
If[DeleteCases[Union[missionStatus[[All,2]]],"ComputationFinished"]==={},
script="echo \"All mission finished!\"\n"
,
script=MathematicaCommand<>" -script "<>packagePath<>"MissionStatusChecker.wl "<>AbsMissionInput<>" | "<>ShellProcessor
]
,
script=MathematicaCommand<>" -script "<>packagePath<>"PrepareForSpanningCuts.wl "<>AbsMissionInput<>" \n"<>
tmpPath<>"run_all_cuts.sh"
]
Print[script]
Run["echo \""<>script<>"\" >> "<>outputPath<>"tmp/log3.txt"]