source: src/analyzer.cpp@ fb9364

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 fb9364 was 390248, checked in by Frederik Heber <heber@…>, 17 years ago

BIG change: Hcorrection included and bugfix of analyzer (wrt forces)

  • Hcorrection is supplied via molecuilder which gives correction values if hydrogen atoms are to close and thus already feel each other's influence. This correction energy matrix is also parsed ans subtracted from the approximated energy matrix generated from the fragments. This impacts both on joiner, analyzer and molecuilder
  • Forces were not working which had multiple causes:
    • first, we stepped back down to absolute errors which rather gives a feel about convergence (1e-6 is simply small and neglegible)
    • there may have been bugs where (either in Force or in ForceFragments) adding up took place, this is cleaned up
    • more routines have been abstracted from analyzer into datacreator functions
      • the order of ions had changed, re-run with current molecuilder, calculation and subsequent joining/analyzing brought correct results finally
  • plots were bad still due to wrong axes (two more functions finding max/min values), use of wrong columns in plot file
  • Property mode set to 100644
File size: 21.4 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 MatrixContainer 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
54 cout << "ANOVA Analyzer" << endl;
55 cout << "==============" << endl;
56
57 // Get the command line options
58 if (argc < 4) {
59 cout << "Usage: " << argv[0] << " <inputdir> <prefix> <outputdir> [elementsdb]" << endl;
60 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;
61 cout << "<prefix>\tprefix of energy and forces file." << endl;
62 cout << "<outputdir>\tcreated plotfiles and datafiles are placed into this directory " << endl;
63 cout << "[elementsdb]\tpath to elements database, needed for shieldings." << endl;
64 return 1;
65 } else {
66 dir = (char *) Malloc(sizeof(char)*(strlen(argv[2])+2), "main: *dir");
67 strcpy(dir, "/");
68 strcat(dir, argv[2]);
69 }
70
71 if (argc > 4) {
72 cout << "Loading periodentafel." << endl;
73 periode = new periodentafel;
74 periode->LoadPeriodentafel(argv[4]);
75 }
76
77 // Test the given directory
78 if (!TestParams(argc, argv))
79 return 1;
80
81 // +++++++++++++++++ PARSING +++++++++++++++++++++++++++++++
82
83 // ------------- Parse through all Fragment subdirs --------
84 if (!Energy.ParseMatrix(argv[1], dir, EnergySuffix,0,0)) return 1;
85 Hcorrected = Hcorrection.ParseMatrix(argv[1], "", HCORRECTIONSUFFIX,0,0);
86 if (!Force.ParseMatrix(argv[1], dir, ForcesSuffix,0,0)) return 1;
87 //if (!Time.ParseMatrix(argv[1], dir, TimeSuffix, 10,1)) return 1;
88 if (periode != NULL) { // also look for PAS values
89 if (!Shielding.ParseMatrix(argv[1], dir, ShieldingSuffix, 1, 0)) return 1;
90 if (!ShieldingPAS.ParseMatrix(argv[1], dir, ShieldingPASSuffix, 1, 0)) return 1;
91 }
92
93 // ---------- Parse the TE Factors into an array -----------------
94 if (!Energy.ParseIndices()) return 1;
95 if (Hcorrected) Hcorrection.ParseIndices();
96
97 // ---------- Parse the Force indices into an array ---------------
98 if (!Force.ParseIndices(argv[1])) return 1;
99 if (!ForceFragments.AllocateMatrix(Force.Header, Force.MatrixCounter, Force.RowCounter, Force.ColumnCounter)) return 1;
100 if (!ForceFragments.ParseIndices(argv[1])) return 1;
101
102 // ---------- Parse the shielding indices into an array ---------------
103 if (periode != NULL) { // also look for PAS values
104 if(!Shielding.ParseIndices(argv[1])) return 1;
105 if(!ShieldingPAS.ParseIndices(argv[1])) return 1;
106 }
107
108 // ---------- Parse the KeySets into an array ---------------
109 if (!KeySet.ParseKeySets(argv[1], Force.RowCounter, Force.MatrixCounter)) return 1;
110 if (!KeySet.ParseManyBodyTerms()) return 1;
111
112 // ---------- Parse fragment files created by 'joiner' into an array -------------
113 if (!EnergyFragments.ParseMatrix(argv[1], dir, EnergyFragmentSuffix,0,0)) return 1;
114 if (Hcorrected) HcorrectionFragments.ParseMatrix(argv[1], dir, HcorrectionFragmentSuffix,0,0);
115 if (!ForceFragments.ParseMatrix(argv[1], dir, ForceFragmentSuffix,0,0)) return 1;
116 if (periode != NULL) { // also look for PAS values
117 if (!ShieldingFragments.ParseMatrix(argv[1], dir, ShieldingSuffix, 1, 0)) return 1;
118 if (!ShieldingPASFragments.ParseMatrix(argv[1], dir, ShieldingPASSuffix, 1, 0)) return 1;
119 }
120
121 // +++++++++++++++ TESTING ++++++++++++++++++++++++++++++
122
123 // print energy and forces to file
124 filename.str("");
125 filename << argv[3] << "/" << "energy-forces.all";
126 output.open(filename.str().c_str(), ios::out);
127 output << endl << "Total Energy" << endl << "==============" << endl << Energy.Header << endl;
128 for(int j=0;j<Energy.RowCounter[Energy.MatrixCounter];j++) {
129 for(int k=0;k<Energy.ColumnCounter;k++)
130 output << scientific << Energy.Matrix[ Energy.MatrixCounter ][j][k] << "\t";
131 output << endl;
132 }
133 output << endl;
134
135 output << endl << "Total Forces" << endl << "===============" << endl << Force.Header << endl;
136 for(int j=0;j<Force.RowCounter[Force.MatrixCounter];j++) {
137 for(int k=0;k<Force.ColumnCounter;k++)
138 output << scientific << Force.Matrix[ Force.MatrixCounter ][j][k] << "\t";
139 output << endl;
140 }
141 output << endl;
142
143 if (periode != NULL) { // also look for PAS values
144 output << endl << "Total Shieldings" << endl << "===============" << endl << Shielding.Header << endl;
145 for(int j=0;j<Shielding.RowCounter[Shielding.MatrixCounter];j++) {
146 for(int k=0;k<Shielding.ColumnCounter;k++)
147 output << scientific << Shielding.Matrix[ Shielding.MatrixCounter ][j][k] << "\t";
148 output << endl;
149 }
150 output << endl;
151
152 output << endl << "Total Shieldings PAS" << endl << "===============" << endl << ShieldingPAS.Header << endl;
153 for(int j=0;j<ShieldingPAS.RowCounter[ShieldingPAS.MatrixCounter];j++) {
154 for(int k=0;k<ShieldingPAS.ColumnCounter;k++)
155 output << scientific << ShieldingPAS.Matrix[ ShieldingPAS.MatrixCounter ][j][k] << "\t";
156 output << endl;
157 }
158 output << endl;
159 }
160
161// output << endl << "Total Times" << endl << "===============" << endl << Time.Header << endl;
162// Time.SetLastMatrix(0., 0);
163// for (int BondOrder=KeySet.Order;BondOrder--;)
164// for(int i=KeySet.FragmentsPerOrder[BondOrder];i--;)
165// for(int j=Time.RowCounter[Time.MatrixCounter];j--;)
166// for(int k=Time.ColumnCounter;k--;) {
167// Time.Matrix[ Time.MatrixCounter ][j][k] += Time.Matrix[ KeySet.OrderSet[BondOrder][i] ][j][k];
168// }
169// for(int j=0;j<Time.RowCounter[Time.MatrixCounter];j++) {
170// for(int k=0;k<Time.ColumnCounter;k++)
171// output << scientific << Time.Matrix[ Time.MatrixCounter ][j][k] << "\t";
172// output << endl;
173// }
174// output << endl;
175 output.close();
176
177 // +++++++++++++++ ANALYZING ++++++++++++++++++++++++++++++
178
179 cout << "Analyzing ..." << endl;
180
181 // ======================================= Creating the data files ==============================================================
182
183// // +++++++++++++++++++++++++++++++++++++++ Plotting Simtime vs Bond Order
184// if (!OpenOutputFile(output, argv[3], "SimTime-Order.dat" )) return false;
185// Time.SetLastMatrix(0., 0);
186// output << "#Order\tFrag.No.\t" << Time.Header << endl;
187// for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
188// for(int i=KeySet.FragmentsPerOrder[BondOrder];i--;)
189// for(int j=Time.RowCounter[Time.MatrixCounter];j--;)
190// for(int k=Time.ColumnCounter;k--;) {
191// Time.Matrix[ Time.MatrixCounter ][j][k] += Time.Matrix[ KeySet.OrderSet[BondOrder][i] ][j][k];
192// }
193// output << BondOrder+1 << "\t" << KeySet.FragmentsPerOrder[BondOrder];
194// for(int k=0;k<Time.ColumnCounter;k++)
195// output << "\t" << scientific << Time.Matrix[ Time.MatrixCounter ][1][k];
196// output << endl;
197// }
198// output.close();
199
200 // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in energy to full QM
201 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;
202
203 // +++++++++++++++++++++++++++++++++++Plotting Energies vs. Order
204 if (!CreateDataEnergyOrder(EnergyFragments, KeySet, argv[3], "Energies-Order", "Plot of approximated energies versus the Bond Order", datum)) return 1;
205
206 // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in forces to full QM
207 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;
208
209 // min force
210 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;
211
212 // mean force
213 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;
214
215 // max force
216 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;
217
218 // ++++++++++++++++++++++++++++++++++++++Plotting Forces vs. Order
219 if (!CreateDataForcesOrderPerAtom(ForceFragments, KeySet, argv[3], "Forces-Order", "Plot of approximated forces versus the Bond Order", datum)) return 1;
220
221 // min force
222 if (!CreateDataForcesOrder(ForceFragments, KeySet, argv[3], "MinForces-Order", "Plot of min approximated forces versus the Bond Order", datum, CreateMinimumForce)) return 1;
223
224 // mean force
225 if (!CreateDataForcesOrder(ForceFragments, KeySet, argv[3], "MeanForces-Order", "Plot of mean approximated forces versus the Bond Order", datum, CreateMeanForce)) return 1;
226
227 // max force
228 if (!CreateDataForcesOrder(ForceFragments, KeySet, argv[3], "MaxForces-Order", "Plot of max approximated forces versus the Bond Order", datum, CreateMaximumForce)) return 1;
229
230 // ++++++++++++++++++++++++++++++++++++++Plotting vector sum (should be 0) vs. bond order
231 if (!CreateDataForcesOrder(ForceFragments, KeySet, argv[3], "VectorSum-Order", "Plot of vector sum of the approximated forces versus the Bond Order", datum, CreateVectorSumForce)) return 1;
232
233 // +++++++++++++++++++++++++++++++Plotting energyfragments vs. order
234 if (!CreateDataFragment(EnergyFragments, KeySet, argv[3], "Energies-Fragment", "Plot of fragment energy versus the Fragment No", datum, CreateEnergy)) return 1;
235 if (!CreateDataFragment(EnergyFragments, KeySet, argv[3], "Energies-FragmentOrder", "Plot of fragment energy of each Fragment No vs. Bond Order", datum, CreateEnergy)) return 1;
236 if (!CreateDataFragmentOrder(EnergyFragments, KeySet, argv[3], "MaxEnergies-FragmentOrder", "Plot of maximum of fragment energy vs. Bond Order", datum, CreateMaxFragmentOrder)) return 1;
237 if (!CreateDataFragmentOrder(EnergyFragments, KeySet, argv[3], "MinEnergies-FragmentOrder", "Plot of minimum of fragment energy vs. Bond Order", datum, CreateMinFragmentOrder)) return 1;
238
239 // +++++++++++++++++++++++++++++++Ploting min/mean/max forces for each fragment
240 // min force
241 if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MinForces-Fragment", "Plot of min approximated forces versus the Fragment No", datum, CreateMinimumForce)) return 1;
242
243 // mean force
244 if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MeanForces-Fragment", "Plot of mean approximated forces versus the Fragment No", datum, CreateMeanForce)) return 1;
245
246 // max force
247 if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MaxForces-Fragment", "Plot of max approximated forces versus the Fragment No", datum, CreateMaximumForce)) return 1;
248
249 // +++++++++++++++++++++++++++++++Ploting min/mean/max forces for each fragment per order
250 // min force
251 if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MinForces-FragmentOrder", "Plot of min approximated forces of each Fragment No vs. Bond Order", datum, CreateMinimumForce)) return 1;
252
253 // mean force
254 if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MeanForces-FragmentOrder", "Plot of mean approximated forces of each Fragment No vs. Bond Order", datum, CreateMeanForce)) return 1;
255
256 // max force
257 if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MaxForces-FragmentOrder", "Plot of max approximated forces of each Fragment No vs. Bond Order", datum, CreateMaximumForce)) return 1;
258
259 // ======================================= Creating the plot files ==============================================================
260
261 Orderxrange << "[1:" << KeySet.Order << "]";
262 Fragmentxrange << "[0:" << KeySet.FragmentCounter+1 << "]";
263 yrange.str("[1e-8:1e+1]");
264
265 // +++++++++++++++++++++++++++++++++++++++ Plotting Simtime vs Bond Order
266 //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;
267
268 // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in energy to full QM
269 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;
270
271 // +++++++++++++++++++++++++++++++++++Plotting Energies vs. Order
272 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;
273
274 // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in forces to full QM
275 yrange.str("[1e-8:1e+0]");
276 // min force
277 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;
278
279 // mean force
280 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;
281
282 // max force
283 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;
284
285 // min/mean/max comparison for total force
286 if(!OpenOutputFile(output, argv[3], "DeltaMinMeanMaxTotalForce-Order.pyx")) return 1;
287 CreatePlotHeader(output, "DeltaMinMeanMaxTotalForce-Order", 1, "bottom left", "y", NULL, 1, 1, "bond order k", "absolute error in total forces [Ht/a.u.]");
288 output << "plot " << Orderxrange.str().c_str() << " [1e-8:1e+0] \\" << endl;
289 output << "'DeltaMinForces-Order.dat' title 'minimum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints, \\" << endl;
290 output << "'DeltaMeanForces-Order.dat' title 'mean' using 1:(abs($" << 8 << ")) with linespoints, \\" << endl;
291 output << "'DeltaMaxForces-Order.dat' title 'maximum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints" << endl;
292 output.close();
293
294 // ++++++++++++++++++++++++++++++++++++++Plotting Forces vs. Order
295 // min force
296 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;
297
298 // mean force
299 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;
300
301 // max force
302 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;
303
304 // min/mean/max comparison for total force
305 if(!OpenOutputFile(output, argv[3],"MinMeanMaxTotalForce-Order.pyx")) return 1;
306 CreatePlotHeader(output, "MinMeanMaxTotalForce-Order", 1, "bottom left", "y", NULL, 1, 1, "bond order k", "absolute total force [Ht/a.u.]");
307 output << "plot "<< Orderxrange.str().c_str() << " [1e-8:1e+0] \\" << endl;
308 output << "'MinForces-Order.dat' title 'minimum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints, \\" << endl;
309 output << "'MeanForces-Order.dat' title 'mean' using 1:(abs($" << 8 << ")) with linespoints, \\" << endl;
310 output << "'MaxForces-Order.dat' title 'maximum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints" << endl;
311 output.close();
312
313 // ++++++++++++++++++++++++++++++++++++++Plotting vector sum vs. Order
314
315 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;
316
317 // +++++++++++++++++++++++++++++++Plotting energyfragments vs. order
318 yrange.str("");
319 yrange << "[" << EnergyFragments.FindMinValue() << ":" << EnergyFragments.FindMaxValue() << "]";
320 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;
321 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;
322 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;
323 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;
324
325 // +++++++++++++++++++++++++++++++=Ploting min/mean/max forces for each fragment
326 yrange.str("");
327 yrange << "[" << ForceFragments.FindMinValue() << ":" << ForceFragments.FindMaxValue()<< "]";
328 // min
329 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;
330
331 // mean
332 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;
333
334 // max
335 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;
336
337 // +++++++++++++++++++++++++++++++=Ploting min/mean/max forces for each fragment per bond order
338 // min
339 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;
340
341 // mean
342 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;
343
344 // max
345 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;
346
347 // create Makefile
348 if(!OpenOutputFile(output, argv[3], "Makefile")) return 1;
349 output << "PYX = $(shell ls *.pyx)" << endl << endl;
350 output << "EPS = $(PYX:.pyx=.eps)" << endl << endl;
351 output << "%.eps: %.pyx" << endl;
352 output << "\t~/build/pyxplot/pyxplot $<" << endl << endl;
353 output << "all: $(EPS)" << endl << endl;
354 output << ".PHONY: clean" << endl;
355 output << "clean:" << endl;
356 output << "\trm -rf $(EPS)" << endl;
357 output.close();
358
359 // ++++++++++++++++ exit ++++++++++++++++++++++++++++++++++
360 delete(periode);
361 Free((void **)&dir, "main: *dir");
362 cout << "done." << endl;
363 return 0;
364};
365
366//============================ END ===========================
Note: See TracBrowser for help on using the repository browser.