source: src/analyzer.cpp@ 3ccc3e

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since 3ccc3e was f05407, checked in by Frederik Heber <heber@…>, 16 years ago

analyzer has been adapted to the aforementioned change in the calling scheme.

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