1 | /** \file analyzer.cpp
|
---|
2 | *
|
---|
3 | * Takes evaluated fragments (energy and forces) and does evaluation of how sensible the BOSSANOVA
|
---|
4 | * approach was, e.g. in the decay of the many-body-contributions.
|
---|
5 | *
|
---|
6 | */
|
---|
7 |
|
---|
8 | //============================ INCLUDES ===========================
|
---|
9 |
|
---|
10 | #include "helpers.hpp"
|
---|
11 | #include "parser.hpp"
|
---|
12 | #include "datacreator.hpp"
|
---|
13 |
|
---|
14 |
|
---|
15 | //============================== MAIN =============================
|
---|
16 |
|
---|
17 | int main(int argc, char **argv)
|
---|
18 | {
|
---|
19 | EnergyMatrix Energy;
|
---|
20 | ForceMatrix Force;
|
---|
21 | MatrixContainer Time;
|
---|
22 | EnergyMatrix EnergyFragments;
|
---|
23 | ForceMatrix ForceFragments;
|
---|
24 | KeySetsContainer KeySet;
|
---|
25 | ofstream output;
|
---|
26 | ofstream output2;
|
---|
27 | ofstream output3;
|
---|
28 | ofstream output4;
|
---|
29 | stringstream filename;
|
---|
30 | time_t t = time(NULL);
|
---|
31 | struct tm *ts = localtime(&t);
|
---|
32 | char *datum = asctime(ts);
|
---|
33 | stringstream Orderxrange;
|
---|
34 | stringstream Fragmentxrange;
|
---|
35 |
|
---|
36 | cout << "ANOVA Analyzer" << endl;
|
---|
37 | cout << "==============" << endl;
|
---|
38 |
|
---|
39 | // Get the command line options
|
---|
40 | if (argc < 4) {
|
---|
41 | cout << "Usage: " << argv[0] << " <inputdir> <prefix> <outputdir>" << endl;
|
---|
42 | cout << "<inputdir>\ttherein the output of a molecuilder fragmentation is expected, each fragment with a subdir containing an energy.all and a forces.all file." << endl;
|
---|
43 | cout << "<prefix>\tprefix of energy and forces file." << endl;
|
---|
44 | cout << "<outputdir>\tcreated plotfiles and datafiles are placed into this directory " << endl;
|
---|
45 | return 1;
|
---|
46 | }
|
---|
47 |
|
---|
48 | // Test the given directory
|
---|
49 | if (!TestParams(argc, argv))
|
---|
50 | return 1;
|
---|
51 |
|
---|
52 | // +++++++++++++++++ PARSING +++++++++++++++++++++++++++++++
|
---|
53 |
|
---|
54 | // ------------- Parse through all Fragment subdirs --------
|
---|
55 | if (!Energy.ParseMatrix(argv[1], argv[2], EnergySuffix,0,0)) return 1;
|
---|
56 | if (!Force.ParseMatrix(argv[1], argv[2], ForcesSuffix,0,0)) return 1;
|
---|
57 | if (!Time.ParseMatrix(argv[1], argv[2], TimeSuffix, 10,1)) return 1;
|
---|
58 |
|
---|
59 | // ---------- Parse the TE Factors into an array -----------------
|
---|
60 | if (!Energy.ParseIndices()) return 1;
|
---|
61 |
|
---|
62 | // ---------- Parse the Force indices into an array ---------------
|
---|
63 | if (!Force.ParseIndices(argv[1])) return 1;
|
---|
64 |
|
---|
65 | // ---------- Parse the KeySets into an array ---------------
|
---|
66 | if (!KeySet.ParseKeySets(argv[1], Force.RowCounter, Force.MatrixCounter)) return 1;
|
---|
67 | if (!KeySet.ParseManyBodyTerms()) return 1;
|
---|
68 | if (!EnergyFragments.ParseMatrix(argv[1], argv[2], EnergyFragmentSuffix,0,0)) return 1;
|
---|
69 | if (!ForceFragments.ParseMatrix(argv[1], argv[2], ForceFragmentSuffix,0,0)) return 1;
|
---|
70 |
|
---|
71 | // +++++++++++++++ TESTING ++++++++++++++++++++++++++++++
|
---|
72 |
|
---|
73 | // print energy and forces to file
|
---|
74 | filename.str("");
|
---|
75 | filename << argv[3] << "/" << "energy-forces.all";
|
---|
76 | output.open(filename.str().c_str(), ios::out);
|
---|
77 | output << endl << "Total Energy" << endl << "==============" << endl << Energy.Header << endl;
|
---|
78 | for(int j=0;j<Energy.RowCounter[Energy.MatrixCounter];j++) {
|
---|
79 | for(int k=0;k<Energy.ColumnCounter;k++)
|
---|
80 | output << scientific << Energy.Matrix[ Energy.MatrixCounter ][j][k] << "\t";
|
---|
81 | output << endl;
|
---|
82 | }
|
---|
83 | output << endl;
|
---|
84 |
|
---|
85 | output << endl << "Total Forces" << endl << "===============" << endl << Force.Header << endl;
|
---|
86 | for(int j=0;j<Force.RowCounter[Force.MatrixCounter];j++) {
|
---|
87 | for(int k=0;k<Force.ColumnCounter;k++)
|
---|
88 | output << scientific << Force.Matrix[ Force.MatrixCounter ][j][k] << "\t";
|
---|
89 | output << endl;
|
---|
90 | }
|
---|
91 | output << endl;
|
---|
92 |
|
---|
93 | output << endl << "Total Times" << endl << "===============" << endl << Time.Header << endl;
|
---|
94 | Time.SetLastMatrix(0., 0);
|
---|
95 | for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++)
|
---|
96 | for(int i=0;i<KeySet.FragmentsPerOrder[BondOrder];i++)
|
---|
97 | for(int j=0;j<Time.RowCounter[Time.MatrixCounter];j++)
|
---|
98 | for(int k=0;k<Time.ColumnCounter;k++) {
|
---|
99 | Time.Matrix[ Time.MatrixCounter ][j][k] += Time.Matrix[ KeySet.OrderSet[BondOrder][i] ][j][k];
|
---|
100 | }
|
---|
101 | for(int j=0;j<Time.RowCounter[Time.MatrixCounter];j++) {
|
---|
102 | for(int k=0;k<Time.ColumnCounter;k++)
|
---|
103 | output << scientific << Time.Matrix[ Time.MatrixCounter ][j][k] << "\t";
|
---|
104 | output << endl;
|
---|
105 | }
|
---|
106 | output << endl;
|
---|
107 | output.close();
|
---|
108 |
|
---|
109 | // +++++++++++++++ ANALYZING ++++++++++++++++++++++++++++++
|
---|
110 |
|
---|
111 | cout << "Analyzing ..." << endl;
|
---|
112 |
|
---|
113 | // ======================================= Creating the data files ==============================================================
|
---|
114 |
|
---|
115 | // +++++++++++++++++++++++++++++++++++++++ Plotting Simtime vs Bond Order
|
---|
116 | if (!OpenOutputFile(output, argv[3], "SimTime-Order.dat" )) return false;
|
---|
117 | Time.SetLastMatrix(0., 0);
|
---|
118 | output << "#Order\tFrag.No.\t" << Time.Header << endl;
|
---|
119 | for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
|
---|
120 | for(int i=0;i<KeySet.FragmentsPerOrder[BondOrder];i++)
|
---|
121 | for(int j=0;j<Time.RowCounter[Time.MatrixCounter];j++)
|
---|
122 | for(int k=0;k<Time.ColumnCounter;k++) {
|
---|
123 | Time.Matrix[ Time.MatrixCounter ][j][k] += Time.Matrix[ KeySet.OrderSet[BondOrder][i] ][j][k];
|
---|
124 | }
|
---|
125 | output << BondOrder+1 << "\t" << KeySet.FragmentsPerOrder[BondOrder];
|
---|
126 | for(int k=0;k<Time.ColumnCounter;k++)
|
---|
127 | output << "\t" << scientific << Time.Matrix[ Time.MatrixCounter ][1][k];
|
---|
128 | output << endl;
|
---|
129 | }
|
---|
130 | output.close();
|
---|
131 |
|
---|
132 | // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in energy to full QM
|
---|
133 | if (!EnergyFragments.SetLastMatrix(Energy.Matrix[Energy.MatrixCounter],0)) return 1;
|
---|
134 | if (!CreateDataEnergyOrder(Energy, EnergyFragments, KeySet, argv[3], "DeltaEnergies-Order", "Plot of error between approximated and full energies energies versus the Bond Order", datum)) return 1;
|
---|
135 |
|
---|
136 | // +++++++++++++++++++++++++++++++++++Plotting Energies vs. Order
|
---|
137 | if (!EnergyFragments.SetLastMatrix(1.,0)) return 1;
|
---|
138 | if (!CreateDataEnergyOrder(Energy, EnergyFragments, KeySet, argv[3], "Energies-Order", "Plot of approximated energies versus the Bond Order", datum)) return 1;
|
---|
139 |
|
---|
140 | // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in forces to full QM
|
---|
141 | if (!ForceFragments.SetLastMatrix(Force.Matrix[Force.MatrixCounter],0)) return 1;
|
---|
142 | if (!OpenOutputFile(output, argv[3], "DeltaForces-Order.dat" )) return false;
|
---|
143 | if (!OpenOutputFile(output2, argv[3], "DeltaMinForces-Order.dat" )) return false;
|
---|
144 | if (!OpenOutputFile(output3, argv[3], "DeltaMeanForces-Order.dat" )) return false;
|
---|
145 | if (!OpenOutputFile(output4, argv[3], "DeltaMaxForces-Order.dat" )) return false;
|
---|
146 | cout << "Plot of per atom and min/mean/max error between approximated forces and full forces versus the Bond Order ... " << endl;
|
---|
147 | output << "# Plot of error between approximated forces and full forces versus the Bond Order, created on " << datum;
|
---|
148 | output << "# AtomNo" << Force.Header << endl;
|
---|
149 | output2 << "# Plot of min error between approximated forces and full forces versus the Bond Order, created on " << datum;
|
---|
150 | output2 << "# Order\tFrag.No.\t" << Force.Header << endl;
|
---|
151 | output3 << "# Plot of mean error between approximated forces and full forces versus the Bond Order, created on " << datum;
|
---|
152 | output3 << "# Order\tFrag.No.\t" << Force.Header << endl;
|
---|
153 | output4 << "# Plot of max error between approximated forces and full forces versus the Bond Order, created on " << datum;
|
---|
154 | output4 << "# Order\tFrag.No.\t" << Force.Header << endl;
|
---|
155 | int FragmentCounter = 0;
|
---|
156 | for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
|
---|
157 | for(int i=0;i<KeySet.FragmentsPerOrder[BondOrder];i++) {
|
---|
158 | for(int l=0;l<Force.RowCounter[ KeySet.OrderSet[BondOrder][i] ];l++) {
|
---|
159 | int j = Force.Indices[ KeySet.OrderSet[BondOrder][i] ][l];
|
---|
160 | if (j > Force.RowCounter[Force.MatrixCounter]) {
|
---|
161 | cerr << "Current force index " << j << " is greater than " << Force.RowCounter[Force.MatrixCounter] << "!" << endl;
|
---|
162 | return 1;
|
---|
163 | }
|
---|
164 | if (j != -1)
|
---|
165 | for(int k=0;k<Force.ColumnCounter;k++) {
|
---|
166 | Force.Matrix[Force.MatrixCounter][j][k] -= ForceFragments.Matrix[ KeySet.OrderSet[BondOrder][i] ][l][k];
|
---|
167 | }
|
---|
168 | }
|
---|
169 | FragmentCounter++;
|
---|
170 | }
|
---|
171 | // errors per atom
|
---|
172 | output << "#Order\t" << BondOrder+1 << endl;
|
---|
173 | for(int j=0;j<Force.RowCounter[ Force.MatrixCounter ];j++) {
|
---|
174 | output << Force.Indices[Force.MatrixCounter][j] << "\t";
|
---|
175 | for (int l=0;l<Force.ColumnCounter;l++)
|
---|
176 | if (fabs(ForceFragments.Matrix[ForceFragments.MatrixCounter][ j ][l]) < MYEPSILON)
|
---|
177 | output << scientific << Force.Matrix[Force.MatrixCounter][ j ][l] << "\t";
|
---|
178 | else
|
---|
179 | output << scientific << (Force.Matrix[Force.MatrixCounter][ j ][l] / ForceFragments.Matrix[ForceFragments.MatrixCounter][ j ][l]) << "\t";
|
---|
180 | output << endl;
|
---|
181 | }
|
---|
182 | output << endl;
|
---|
183 |
|
---|
184 | // min error
|
---|
185 | output2 << BondOrder+1 << "\t" << FragmentCounter;
|
---|
186 | CreateMinimumForce(Force, Force.MatrixCounter);
|
---|
187 | for (int l=0;l<Force.ColumnCounter;l++)
|
---|
188 | if (fabs(ForceFragments.Matrix[ForceFragments.MatrixCounter][ ForceFragments.RowCounter[ForceFragments.MatrixCounter] ][l]) < MYEPSILON)
|
---|
189 | output2 << scientific << "\t" << Force.Matrix[Force.MatrixCounter][ Force.RowCounter[Force.MatrixCounter] ][l];
|
---|
190 | else
|
---|
191 | output2 << scientific << "\t" << (Force.Matrix[Force.MatrixCounter][ Force.RowCounter[Force.MatrixCounter] ][l] / ForceFragments.Matrix[ForceFragments.MatrixCounter][ ForceFragments.RowCounter[ForceFragments.MatrixCounter] ][l]);
|
---|
192 | output2 << endl;
|
---|
193 |
|
---|
194 | // mean error
|
---|
195 | output3 << BondOrder+1 << "\t" << FragmentCounter;
|
---|
196 | CreateMeanForce(Force, Force.MatrixCounter);
|
---|
197 | for (int l=0;l<Force.ColumnCounter;l++)
|
---|
198 | if (fabs(ForceFragments.Matrix[ForceFragments.MatrixCounter][ ForceFragments.RowCounter[ForceFragments.MatrixCounter] ][l]) < MYEPSILON)
|
---|
199 | output3 << scientific << "\t" << Force.Matrix[Force.MatrixCounter][ Force.RowCounter[Force.MatrixCounter] ][l];
|
---|
200 | else
|
---|
201 | output3 << scientific << "\t" << (Force.Matrix[Force.MatrixCounter][ Force.RowCounter[Force.MatrixCounter] ][l] / ForceFragments.Matrix[ForceFragments.MatrixCounter][ ForceFragments.RowCounter[ForceFragments.MatrixCounter] ][l]);
|
---|
202 | output3 << endl;
|
---|
203 |
|
---|
204 | // max error
|
---|
205 | output4 << BondOrder+1 << "\t" << FragmentCounter;
|
---|
206 | CreateMaximumForce(Force, Force.MatrixCounter);
|
---|
207 | for (int l=0;l<Force.ColumnCounter;l++)
|
---|
208 | if (fabs(ForceFragments.Matrix[ForceFragments.MatrixCounter][ ForceFragments.RowCounter[ForceFragments.MatrixCounter] ][l]) < MYEPSILON)
|
---|
209 | output4 << scientific << "\t" << Force.Matrix[Force.MatrixCounter][ Force.RowCounter[Force.MatrixCounter] ][l];
|
---|
210 | else
|
---|
211 | output4 << scientific << "\t" << (Force.Matrix[Force.MatrixCounter][ Force.RowCounter[Force.MatrixCounter] ][l] / ForceFragments.Matrix[ForceFragments.MatrixCounter][ ForceFragments.RowCounter[ForceFragments.MatrixCounter] ][l]);
|
---|
212 | output4 << endl;
|
---|
213 | }
|
---|
214 | output.close();
|
---|
215 | output2.close();
|
---|
216 | output3.close();
|
---|
217 | output4.close();
|
---|
218 |
|
---|
219 | // ++++++++++++++++++++++++++++++++++++++Plotting Forces vs. Order
|
---|
220 | if(!OpenOutputFile(output, argv[3], "Forces-Order.dat")) return 1;
|
---|
221 | cout << "Plot of approximated forces versus the Bond Order ... " << endl;
|
---|
222 | output << "# Plot of approximated forces versus the Bond Order, created on " << datum;
|
---|
223 | output << "# AtomNo" << Force.Header << endl;
|
---|
224 | for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
|
---|
225 | for(int i=0;i<KeySet.FragmentsPerOrder[BondOrder];i++) {
|
---|
226 | for(int l=0;l<Force.RowCounter[ KeySet.OrderSet[BondOrder][i] ];l++) {
|
---|
227 | int j = Force.Indices[ KeySet.OrderSet[BondOrder][i] ][l];
|
---|
228 | if (j > Force.RowCounter[Force.MatrixCounter]) {
|
---|
229 | cerr << "Current force index " << j << " is greater than " << Force.RowCounter[Force.MatrixCounter] << "!" << endl;
|
---|
230 | return 1;
|
---|
231 | }
|
---|
232 | if (j != -1)
|
---|
233 | for(int k=0;k<Force.ColumnCounter;k++) {
|
---|
234 | Force.Matrix[Force.MatrixCounter][j][k] -= ForceFragments.Matrix[ KeySet.OrderSet[BondOrder][i] ][l][k];
|
---|
235 | }
|
---|
236 | }
|
---|
237 | }
|
---|
238 | // errors per atom
|
---|
239 | output << "#Order\t" << BondOrder+1 << endl;
|
---|
240 | for(int j=0;j<Force.RowCounter[ Force.MatrixCounter ];j++) {
|
---|
241 | output << Force.Indices[Force.MatrixCounter][j] << "\t";
|
---|
242 | for (int l=0;l<Force.ColumnCounter;l++)
|
---|
243 | output << Force.Matrix[Force.MatrixCounter][ j ][l] << "\t";
|
---|
244 | output << endl;
|
---|
245 | }
|
---|
246 | output << endl;
|
---|
247 | }
|
---|
248 | output.close();
|
---|
249 |
|
---|
250 | // min force
|
---|
251 | if (!CreateDataForcesOrder(Force, ForceFragments, KeySet, argv[3], "MinForces-Order", "Plot of min approximated forces versus the Bond Order", datum, CreateMinimumForce)) return 1;
|
---|
252 |
|
---|
253 | // mean force
|
---|
254 | if (!CreateDataForcesOrder(Force, ForceFragments, KeySet, argv[3], "MeanForces-Order", "Plot of mean approximated forces versus the Bond Order", datum, CreateMeanForce)) return 1;
|
---|
255 |
|
---|
256 | // max force
|
---|
257 | if (!CreateDataForcesOrder(Force, ForceFragments, KeySet, argv[3], "MaxForces-Order", "Plot of max approximated forces versus the Bond Order", datum, CreateMaximumForce)) return 1;
|
---|
258 |
|
---|
259 | // ++++++++++++++++++++++++++++++++++++++Plotting vector sum (should be 0) vs. bond order
|
---|
260 | if (!CreateDataForcesOrder(Force, ForceFragments, KeySet, argv[3], "VectorSum-Order", "Plot of vector sum of the approximated forces versus the Bond Order", datum, CreateVectorSumForce)) return 1;
|
---|
261 |
|
---|
262 | // +++++++++++++++++++++++++++++++Plotting energyfragments vs. order
|
---|
263 | if (!CreateDataFragment(EnergyFragments, KeySet, argv[3], "Energies-Fragment", "Plot of fragment energy versus the Fragment No", datum, CreateEnergy)) return 1;
|
---|
264 | if (!CreateDataFragment(EnergyFragments, KeySet, argv[3], "Energies-FragmentOrder", "Plot of fragment energy of each Fragment No vs. Bond Order", datum, CreateEnergy)) return 1;
|
---|
265 | if (!CreateDataFragmentOrder(EnergyFragments, KeySet, argv[3], "MaxEnergies-FragmentOrder", "Plot of maximum of fragment energy vs. Bond Order", datum, CreateMaxFragmentOrder)) return 1;
|
---|
266 | if (!CreateDataFragmentOrder(EnergyFragments, KeySet, argv[3], "MinEnergies-FragmentOrder", "Plot of minimum of fragment energy vs. Bond Order", datum, CreateMinFragmentOrder)) return 1;
|
---|
267 |
|
---|
268 | // +++++++++++++++++++++++++++++++Ploting min/mean/max forces for each fragment
|
---|
269 | // min force
|
---|
270 | if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MinForces-Fragment", "Plot of min approximated forces versus the Fragment No", datum, CreateMinimumForce)) return 1;
|
---|
271 |
|
---|
272 | // mean force
|
---|
273 | if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MeanForces-Fragment", "Plot of mean approximated forces versus the Fragment No", datum, CreateMeanForce)) return 1;
|
---|
274 |
|
---|
275 | // max force
|
---|
276 | if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MaxForces-Fragment", "Plot of max approximated forces versus the Fragment No", datum, CreateMaximumForce)) return 1;
|
---|
277 |
|
---|
278 | // +++++++++++++++++++++++++++++++Ploting min/mean/max forces for each fragment per order
|
---|
279 | // min force
|
---|
280 | if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MinForces-FragmentOrder", "Plot of min approximated forces of each Fragment No vs. Bond Order", datum, CreateMinimumForce)) return 1;
|
---|
281 |
|
---|
282 | // mean force
|
---|
283 | if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MeanForces-FragmentOrder", "Plot of mean approximated forces of each Fragment No vs. Bond Order", datum, CreateMeanForce)) return 1;
|
---|
284 |
|
---|
285 | // max force
|
---|
286 | if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MaxForces-FragmentOrder", "Plot of max approximated forces of each Fragment No vs. Bond Order", datum, CreateMaximumForce)) return 1;
|
---|
287 |
|
---|
288 | // ======================================= Creating the plot files ==============================================================
|
---|
289 |
|
---|
290 | Orderxrange << "[1:" << KeySet.Order << "]";
|
---|
291 | Fragmentxrange << "[0:" << KeySet.FragmentCounter+1 << "]";
|
---|
292 |
|
---|
293 | // +++++++++++++++++++++++++++++++++++++++ Plotting Simtime vs Bond Order
|
---|
294 | if (!CreatePlotOrder(Time, KeySet, argv[3], "SimTime-Order", 1, "below", "y", "", 1, 1, "bond order k", "Evaluation time [s]", Orderxrange.str().c_str(), "", "1" , "with linespoints", EnergyPlotLine)) return 1;
|
---|
295 |
|
---|
296 | // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in energy to full QM
|
---|
297 | if (!CreatePlotOrder(Energy, KeySet, argv[3], "DeltaEnergies-Order", 1, "outside", "y", "", 1, 1, "bond order k", "absolute error in energy [Ht]", Orderxrange.str().c_str(), "[1e-8:1e+1]", "1" , "with linespoints", AbsEnergyPlotLine)) return 1;
|
---|
298 |
|
---|
299 | // +++++++++++++++++++++++++++++++++++Plotting Energies vs. Order
|
---|
300 | if (!CreatePlotOrder(Energy, KeySet, argv[3], "Energies-Order", 1, "outside", "", "", 1, 1, "bond order k", "approximate energy [Ht]", Orderxrange.str().c_str(), "", "1" , "with linespoints", EnergyPlotLine)) return 1;
|
---|
301 |
|
---|
302 | // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in forces to full QM
|
---|
303 | // min force
|
---|
304 | if (!CreatePlotOrder(Force, KeySet, argv[3], "DeltaMinForces-Order", 2, "top right", "y", "", 1, 1, "bond order k", "absolute error in min force [Ht/a.u.]", Orderxrange.str().c_str(), "[1e-8:1e+0]", "1" , "with linespoints", ForceMagnitudePlotLine)) return 1;
|
---|
305 |
|
---|
306 | // mean force
|
---|
307 | if (!CreatePlotOrder(Force, KeySet, argv[3], "DeltaMeanForces-Order", 2, "top right", "y", "", 1, 1, "bond order k", "absolute error in mean force [Ht/a.u.]", Orderxrange.str().c_str(), "[1e-8:1e+0]", "1" , "with linespoints", AbsFirstForceValuePlotLine)) return 1;
|
---|
308 |
|
---|
309 | // max force
|
---|
310 | if (!CreatePlotOrder(Force, KeySet, argv[3], "DeltaMaxForces-Order", 2, "top right", "y", "", 1, 1, "bond order k", "absolute error in max force [Ht/a.u.]", Orderxrange.str().c_str(), "[1e-8:1e+0]", "1" , "with linespoints", ForceMagnitudePlotLine)) return 1;
|
---|
311 |
|
---|
312 | // min/mean/max comparison for total force
|
---|
313 | if(!OpenOutputFile(output, argv[3], "DeltaMinMeanMaxTotalForce-Order.pyx")) return 1;
|
---|
314 | CreatePlotHeader(output, "DeltaMinMeanMaxTotalForce-Order", 1, "bottom left", "y", "", 1, 1, "bond order k", "absolute error in total forces [Ht/a.u.]");
|
---|
315 | output << "plot " << Orderxrange.str().c_str() << " [1e-8:1e+0] \\" << endl;
|
---|
316 | output << "'DeltaMinForces-Order.dat' title 'minimum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints, \\" << endl;
|
---|
317 | output << "'DeltaMeanForces-Order.dat' title 'mean' using 1:(abs($" << 8 << ")) with linespoints, \\" << endl;
|
---|
318 | output << "'DeltaMaxForces-Order.dat' title 'maximum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints" << endl;
|
---|
319 | output.close();
|
---|
320 |
|
---|
321 | // ++++++++++++++++++++++++++++++++++++++Plotting Forces vs. Order
|
---|
322 | // min force
|
---|
323 | if (!CreatePlotOrder(Force, KeySet, argv[3], "MinForces-Order", 2, "bottom right", "y", "", 1, 1, "bond order k", "absolute approximated min force [Ht/a.u.]", Orderxrange.str().c_str(), "", "1" , "with linespoints", ForceMagnitudePlotLine)) return 1;
|
---|
324 |
|
---|
325 | // mean force
|
---|
326 | if (!CreatePlotOrder(Force, KeySet, argv[3], "MeanForces-Order", 2, "bottom right", "y", "", 1, 1, "bond order k", "absolute approximated mean force [Ht/a.u.]", Orderxrange.str().c_str(), "", "1" , "with linespoints", AbsFirstForceValuePlotLine)) return 1;
|
---|
327 |
|
---|
328 | // max force
|
---|
329 | if (!CreatePlotOrder(Force, KeySet, argv[3], "MaxForces-Order", 2, "bottom right", "y", "", 1, 1, "bond order k", "absolute approximated max force [Ht/a.u.]", Orderxrange.str().c_str(), "", "1" , "with linespoints", ForceMagnitudePlotLine)) return 1;
|
---|
330 |
|
---|
331 | // min/mean/max comparison for total force
|
---|
332 | if(!OpenOutputFile(output, argv[3],"MinMeanMaxTotalForce-Order.pyx")) return 1;
|
---|
333 | CreatePlotHeader(output, "MinMeanMaxTotalForce-Order", 1, "bottom left", "y", "", 1, 1, "bond order k", "absolute total force [Ht/a.u.]");
|
---|
334 | output << "plot "<< Orderxrange.str().c_str() << " [1e-8:1e+0] \\" << endl;
|
---|
335 | output << "'MinForces-Order.dat' title 'minimum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints, \\" << endl;
|
---|
336 | output << "'MeanForces-Order.dat' title 'mean' using 1:(abs($" << 8 << ")) with linespoints, \\" << endl;
|
---|
337 | output << "'MaxForces-Order.dat' title 'maximum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints" << endl;
|
---|
338 | output.close();
|
---|
339 |
|
---|
340 | // ++++++++++++++++++++++++++++++++++++++Plotting vector sum vs. Order
|
---|
341 |
|
---|
342 | if (!CreatePlotOrder(Force, KeySet, argv[3], "VectorSum-Order", 2, "bottom right", "y" ,"", 1, 1, "bond order k", "vector sum of approximated forces [Ht/a.u.]", Orderxrange.str().c_str(), "", "1" , "with linespoints", ForceMagnitudePlotLine)) return 1;
|
---|
343 |
|
---|
344 | // +++++++++++++++++++++++++++++++Plotting energyfragments vs. order
|
---|
345 | if (!CreatePlotOrder(EnergyFragments, KeySet, argv[3], "Energies-Fragment", 5, "below", "y", "", 1, 5, "fragment number", "Energies of each fragment [Ht]", Fragmentxrange.str().c_str(), "[1e-16:1e+1]", "2" , "with points", AbsEnergyPlotLine)) return 1;
|
---|
346 | if (!CreatePlotOrder(EnergyFragments, KeySet, argv[3], "Energies-FragmentOrder", 5, "below", "y", "", 1, 1, "bond order", "Energies of each fragment [Ht]", Orderxrange.str().c_str(), "[1e-10:1e+1]", "1" , "with points", AbsEnergyPlotLine)) return 1;
|
---|
347 | if (!CreatePlotOrder(EnergyFragments, KeySet, argv[3], "MaxEnergies-FragmentOrder", 5, "below", "y", "", 1, 1, "bond order", "Maximum fragment energy [Ht]", Orderxrange.str().c_str(), "[1e-6:1e+1]", "1" , "with linespoints", AbsEnergyPlotLine)) return 1;
|
---|
348 | if (!CreatePlotOrder(EnergyFragments, KeySet, argv[3], "MinEnergies-FragmentOrder", 5, "below", "y", "", 1, 1, "bond order", "Minimum fragment energy [Ht]", Orderxrange.str().c_str(), "[1e-6:1e+1]", "1" , "with linespoints", AbsEnergyPlotLine)) return 1;
|
---|
349 |
|
---|
350 | // +++++++++++++++++++++++++++++++=Ploting min/mean/max forces for each fragment
|
---|
351 | // min
|
---|
352 | if (!CreatePlotOrder(ForceFragments, KeySet, argv[3], "MinForces-Fragment", 5, "below", "y", "set boxwidth 0.2", 1, 5, "fragment number", "minimum of approximated forces [Ht/a.u.]", Fragmentxrange.str().c_str(), "[1e-16:1e+1]", "2" , "with boxes fillcolor", BoxesForcePlotLine)) return 1;
|
---|
353 |
|
---|
354 | // mean
|
---|
355 | if (!CreatePlotOrder(ForceFragments, KeySet, argv[3], "MeanForces-Fragment", 5, "below", "y", "set boxwidth 0.2", 1, 5, "fragment number", "mean of approximated forces [Ht/a.u.]", Fragmentxrange.str().c_str(), "[1e-16:1e+1]", "2" , "with boxes fillcolor", BoxesFirstForceValuePlotLine)) return 1;
|
---|
356 |
|
---|
357 | // max
|
---|
358 | if (!CreatePlotOrder(ForceFragments, KeySet, argv[3], "MaxForces-Fragment", 5, "below", "y", "set boxwidth 0.2", 1, 5, "fragment number", "maximum of approximated forces [Ht/a.u.]", Fragmentxrange.str().c_str(), "[1e-16:1e+1]", "2" , "with boxes fillcolor", BoxesForcePlotLine)) return 1;
|
---|
359 |
|
---|
360 | // +++++++++++++++++++++++++++++++=Ploting min/mean/max forces for each fragment per bond order
|
---|
361 | // min
|
---|
362 | if (!CreatePlotOrder(ForceFragments, KeySet, argv[3], "MinForces-FragmentOrder", 5, "below", "y", "set boxwidth 0.2", 1, 1, "bond order", "minimum of approximated forces [Ht/a.u.]", Orderxrange.str().c_str(), "[1e-16:1e+1]", "1" , "with boxes fillcolor", BoxesForcePlotLine)) return 1;
|
---|
363 |
|
---|
364 | // mean
|
---|
365 | if (!CreatePlotOrder(ForceFragments, KeySet, argv[3], "MeanForces-FragmentOrder", 5, "below", "y", "set boxwidth 0.2", 1, 1, "bond order", "mean of approximated forces [Ht/a.u.]", Orderxrange.str().c_str(), "[1e-16:1e+1]", "1" , "with boxes fillcolor", BoxesFirstForceValuePlotLine)) return 1;
|
---|
366 |
|
---|
367 | // max
|
---|
368 | if (!CreatePlotOrder(ForceFragments, KeySet, argv[3], "MaxForces-FragmentOrder", 5, "below", "y", "set boxwidth 0.2", 1, 1, "bond order", "maximum of approximated forces [Ht/a.u.]", Orderxrange.str().c_str(), "[1e-16:1e+1]", "1" , "with boxes fillcolor", BoxesForcePlotLine)) return 1;
|
---|
369 |
|
---|
370 | // create Makefile
|
---|
371 | if(!OpenOutputFile(output, argv[3], "Makefile")) return 1;
|
---|
372 | output << "PYX = $(shell ls *.pyx)" << endl << endl;
|
---|
373 | output << "EPS = $(PYX:.pyx=.eps)" << endl << endl;
|
---|
374 | output << "%.eps: %.pyx" << endl;
|
---|
375 | output << "\t~/build/pyxplot/pyxplot $<" << endl << endl;
|
---|
376 | output << "all: $(EPS)" << endl << endl;
|
---|
377 | output << ".PHONY: clean" << endl;
|
---|
378 | output << "clean:" << endl;
|
---|
379 | output << "\trm -rf $(EPS)" << endl;
|
---|
380 | output.close();
|
---|
381 |
|
---|
382 | // ++++++++++++++++ exit ++++++++++++++++++++++++++++++++++
|
---|
383 | cout << "done." << endl;
|
---|
384 | return 0;
|
---|
385 | };
|
---|
386 |
|
---|
387 | //============================ END ===========================
|
---|