source: ThirdParty/mpqc_open/src/bin/mpqc/validate/checkccaout.pl@ dabe63

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes
Last change on this file since dabe63 was 860145, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '0b990dfaa8c6007a996d030163a25f7f5fc8a7e7' as 'ThirdParty/mpqc_open'

  • Property mode set to 100644
File size: 5.5 KB
Line 
1#
2eval 'exec perl $0 $*'
3 if 0;
4
5use Getopt::Long;
6
7GetOptions("outputprefix=s" => \$outputprefix,
8 "refprefix=s" => \$refprefix);
9
10$all_passed=1;
11
12foreach(@ARGV) {
13
14 $file = $_;
15 $file =~ s/(\.results)$//;
16
17 # read in results
18 $have_geom = $have_energy = $have_grad = 0;
19 unless( open results, "$outputprefix/$file.results") {
20 print "Couldn't open results for $outputprefix/$file.results\n";
21 }
22
23 $line = <results>;
24 chomp($line);
25
26 if( $line =~ /FINAL GEOMETRY\:/ ) {
27 $have_geom=1;
28 $line = <results>;
29 if( $line =~ /^\n/ ) {
30 print "problem with geometry\n";
31 $have_geom=0; }
32 while( !($line =~ /^\n/) ) {
33 $line =~ /\s*(\S*)\s*(\S*)\s*(\S*)/;
34 push(@geom,$1,$2,$3);
35 $line = <results>;
36 }
37 }
38
39 $line = <results>;
40 if( $line =~ /FINAL ENERGY\:/ ) {
41 $have_energy=1;
42 $line = <results>;
43 if( $line eq "\n" ) {
44 print "problem with energy\n";
45 $have_energy=0; }
46 while( !($line =~ /^\n/) ) {
47 $line =~ /\s*(\S*)/;
48 $energy = $1;
49 if( eof(results) ) {
50 $line = "\n";
51 }
52 else {
53 $line = <results>;
54 }
55 }
56 }
57
58 $line = <results>;
59 if( $line =~ /FINAL GRADIENT\:/ ) {
60 $have_grad=1;
61 $line = <results>;
62 if( $line =~ /^\n/ ) {
63 print "problem with gradient\n";
64 $have_grad=0; }
65 while( !($line =~ /^\n/) ) {
66 $line =~ /\s*(\S*)\s*(\S*)\s*(\S*)/;
67 push(@grad,$1,$2,$3);
68 if( eof(results) ) {
69 $line = "\n";
70 }
71 else {
72 $line = <results>;
73 }
74 }
75 }
76 close(results);
77
78 # read in reference
79 $have_ref_geom = $have_ref_energy = $have_ref_grad = 0;
80 unless( open reference,
81 "$refprefix/$file.results") {
82 print "Couldn't open reference for $refprefix/$file.results\n";
83 }
84 $line = <reference>;
85 chomp($line);
86
87 if( $line =~ /FINAL GEOMETRY\:/ ) {
88 $have_ref_geom = 1;
89 $line = <reference>;
90 if( $line =~ /^\n/ ) {
91 print "problem with reference geometry\n";
92 $have_ref_geom = 0; }
93 while( !($line =~ /^\n/) ) {
94 $line =~ /\s*(\S*)\s*(\S*)\s*(\S*)/;
95 push(@ref_geom,$1,$2,$3);
96 $line = <reference>;
97 }
98 }
99
100 $line = <reference>;
101 if( $line =~ /FINAL ENERGY\:/ ) {
102 $have_ref_energy = 1;
103 $line = <reference>;
104 if( $line =~ /^\n/ ) {
105 print "problem with reference energy\n";
106 $have_ref_energy = 0; }
107 while( !($line =~ /^\n/) ) {
108 $line =~ /\s*(\S*)/;
109 $ref_energy = $1;
110 if( eof(reference) ) {
111 $line = "\n";
112 }
113 else {
114 $line = <reference>;
115 }
116 }
117 }
118 close(reference);
119
120
121 # compare results to references
122 open LOG, ">>$outputprefix/$file.diff" or
123 print "Couldn't write to diff results for $file\n";
124 $geom_passed = 1;
125 if( $have_geom + $have_ref_geom != 2 ) {
126 $geom_passed = 0; }
127 @geom = reverse(@geom);
128 @ref_geom = reverse(@ref_geom);
129 print LOG "GEOMETRY DIFFERENCES WITH REFERENCE:\n";
130 while(defined(@geom[0])) {
131 $diff1 = pop(@geom) - pop(@ref_geom);
132 $diff2 = pop(@geom) - pop(@ref_geom);
133 $diff3 = pop(@geom) - pop(@ref_geom);
134 printf(LOG "%20.9f%20.9f%20.9f\n", $diff1, $diff2, $diff3);
135 if( abs($diff1) > $geom_tol |
136 abs($diff2) > $geom_tol |
137 abs($diff3) > $geom_tol ) {
138 $geom_passed=0;
139 }
140 }
141
142 $energy_passed = 1;
143 if( $have_energy + $have_ref_energy != 2 ) {
144 $energy_passed = 0; }
145 print LOG "\nENERGY DIFFERENCE WITH REFERENCE:\n";
146 $diff1 = $energy - $ref_energy;
147 printf(LOG "%20.9f\n", $diff1);
148 if( abs($diff1) > $energy_tol ) {
149 $energy_passed=0;
150 }
151
152 $grad_passed=1;
153 if( $have_ref_grad ) {
154 if( !$have_grad ) {
155 $grad_passed = 0;
156 }
157 else {
158 @grad = reverse(@grad);
159 @ref_grad = reverse(@ref_grad);
160 print LOG "\nGRADIENT DIFFERENCES WITH REFERENCE:\n";
161 while(defined(@grad[0])) {
162 $diff1 = pop(@grad) - pop(@ref_grad);
163 $diff2 = pop(@grad) - pop(@ref_grad);
164 $diff3 = pop(@grad) - pop(@ref_grad);
165 printf(LOG "%20.9f%20.9f%20.9f\n", $diff1, $diff2, $diff3);
166 if( abs($diff1) > $grad_tol |
167 abs($diff2) > $grad_tol |
168 abs($diff3) > $grad_tol ) {
169 $grad_passed=0;
170 }
171 }
172 }
173 }
174
175 if( ($geom_passed + $energy_passed + $grad_passed) == 3 ) {
176 push(@passed,"$file...passed");
177 }
178 else {
179 push(@passed,"$file...failed");
180 $all_passed = 0;
181 }
182
183 if(!$geom_passed) {
184 print LOG
185 "FAILURE: geometry not found or outside tolerance\n";
186 }
187 if(!$energy_passed) {
188 print LOG
189 "FAILURE: energy not found or outside tolerance\n";
190 }
191 if(!$grad_passed) {
192 print LOG
193 "FAILURE: gradient not found or outside tolerance\n";
194 }
195 close(LOG);
196 @geom = @ref_geom = @grad = @ref_grad = ();
197}
198
199# display results
200print "------------------------------------------------------------\n";
201print "VERIFICATION RESULTS";
202print "\n------------------------------------------------------------";
203
204foreach $pass (@passed) {
205 print "\n$pass";
206}
207
208if($all_passed) {
209 print "\nALL TESTS PASSED\n";
210}
211else {
212 print "\nFAILURE DURING VERIFICATION: examine results files for details\n";
213}
214
215# also output to file
216open REP, ">./report.txt" or
217 print "Couldn't write to report file\n";
218print REP "------------------------------------------------------------\n";
219print REP "VERIFICATION RESULTS";
220print REP "\n------------------------------------------------------------";
221
222foreach $pass (@passed) {
223 print REP "\n$pass";
224}
225
226if($all_passed) {
227 print REP "\nALL TESTS PASSED\n";
228}
229else {
230 print REP
231 "\nFAILURE DURING VERIFICATION: examine results files for details\n";
232}
233close(REP);
234
Note: See TracBrowser for help on using the repository browser.