source: src/analyzer.cpp@ 02da9e

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 02da9e was 6ac7ee, checked in by Frederik Heber <heber@…>, 16 years ago

Merge branch 'ConcaveHull' of ../espack2 into ConcaveHull

Conflicts:

molecuilder/src/boundary.cpp
molecuilder/src/boundary.hpp
molecuilder/src/builder.cpp
molecuilder/src/linkedcell.cpp
molecuilder/src/linkedcell.hpp
molecuilder/src/vector.cpp
molecuilder/src/vector.hpp
util/src/NanoCreator.c

Basically, this resulted from a lot of conversions two from spaces to one tab, which is my standard indentation. The mess was caused by eclipse auto-indenting. And in espack2:ConcaveHull was the new stuff, so all from ConcaveHull was replaced in case of doubt.
Additionally, vector had ofstream << operator instead ostream << ...

  • Property mode set to 100755
File size: 25.0 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 if (!ShieldingFragments.AllocateMatrix(Shielding.Header, Shielding.MatrixCounter, Shielding.RowCounter, Shielding.ColumnCounter)) return 1;
108 if (!ShieldingPASFragments.AllocateMatrix(ShieldingPAS.Header, ShieldingPAS.MatrixCounter, ShieldingPAS.RowCounter, ShieldingPAS.ColumnCounter)) return 1;
109 if(!ShieldingFragments.ParseIndices(argv[1])) return 1;
110 if(!ShieldingPASFragments.ParseIndices(argv[1])) return 1;
111 }
112
113 // ---------- Parse the KeySets into an array ---------------
114 if (!KeySet.ParseKeySets(argv[1], Force.RowCounter, Force.MatrixCounter)) return 1;
115 if (!KeySet.ParseManyBodyTerms()) return 1;
116
117 // ---------- Parse fragment files created by 'joiner' into an array -------------
118 if (!EnergyFragments.ParseFragmentMatrix(argv[1], dir, EnergyFragmentSuffix,0,0)) return 1;
119 if (Hcorrected) HcorrectionFragments.ParseFragmentMatrix(argv[1], dir, HcorrectionFragmentSuffix,0,0);
120 if (!ForceFragments.ParseFragmentMatrix(argv[1], dir, ForceFragmentSuffix,0,0)) return 1;
121 if (periode != NULL) { // also look for PAS values
122 if (!ShieldingFragments.ParseFragmentMatrix(argv[1], dir, ShieldingFragmentSuffix, 1, 0)) return 1;
123 if (!ShieldingPASFragments.ParseFragmentMatrix(argv[1], dir, ShieldingPASFragmentSuffix, 1, 0)) return 1;
124 }
125
126 // +++++++++++++++ TESTING ++++++++++++++++++++++++++++++
127
128 // print energy and forces to file
129 filename.str("");
130 filename << argv[3] << "/" << "energy-forces.all";
131 output.open(filename.str().c_str(), ios::out);
132 output << endl << "Total Energy" << endl << "==============" << endl << Energy.Header << endl;
133 for(int j=0;j<Energy.RowCounter[Energy.MatrixCounter];j++) {
134 for(int k=0;k<Energy.ColumnCounter;k++)
135 output << scientific << Energy.Matrix[ Energy.MatrixCounter ][j][k] << "\t";
136 output << endl;
137 }
138 output << endl;
139
140 output << endl << "Total Forces" << endl << "===============" << endl << Force.Header << endl;
141 for(int j=0;j<Force.RowCounter[Force.MatrixCounter];j++) {
142 for(int k=0;k<Force.ColumnCounter;k++)
143 output << scientific << Force.Matrix[ Force.MatrixCounter ][j][k] << "\t";
144 output << endl;
145 }
146 output << endl;
147
148 if (periode != NULL) { // also look for PAS values
149 output << endl << "Total Shieldings" << endl << "===============" << endl << Shielding.Header << endl;
150 for(int j=0;j<Shielding.RowCounter[Shielding.MatrixCounter];j++) {
151 for(int k=0;k<Shielding.ColumnCounter;k++)
152 output << scientific << Shielding.Matrix[ Shielding.MatrixCounter ][j][k] << "\t";
153 output << endl;
154 }
155 output << endl;
156
157 output << endl << "Total Shieldings PAS" << endl << "===============" << endl << ShieldingPAS.Header << endl;
158 for(int j=0;j<ShieldingPAS.RowCounter[ShieldingPAS.MatrixCounter];j++) {
159 for(int k=0;k<ShieldingPAS.ColumnCounter;k++)
160 output << scientific << ShieldingPAS.Matrix[ ShieldingPAS.MatrixCounter ][j][k] << "\t";
161 output << endl;
162 }
163 output << endl;
164 }
165
166 output << endl << "Total Times" << endl << "===============" << endl << Time.Header << endl;
167 for(int j=0;j<Time.RowCounter[Time.MatrixCounter];j++) {
168 for(int k=0;k<Time.ColumnCounter;k++) {
169 output << scientific << Time.Matrix[ Time.MatrixCounter ][j][k] << "\t";
170 }
171 output << endl;
172 }
173 output << endl;
174 output.close();
175 for(int k=0;k<Time.ColumnCounter;k++)
176 Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter] ][k] = Time.Matrix[ Time.MatrixCounter ][Time.RowCounter[Time.MatrixCounter]-1][k];
177
178 // +++++++++++++++ ANALYZING ++++++++++++++++++++++++++++++
179
180 cout << "Analyzing ..." << endl;
181
182 // ======================================= Creating the data files ==============================================================
183
184 // +++++++++++++++++++++++++++++++++++++++ Plotting Simtime vs Bond Order
185 // +++++++++++++++++++++++++++++++++++++++ Plotting Delta Simtime vs Bond Order
186 if (!OpenOutputFile(output, argv[3], "SimTime-Order.dat" )) return false;
187 if (!OpenOutputFile(output2, argv[3], "DeltaSimTime-Order.dat" )) return false;
188 for(int j=Time.RowCounter[Time.MatrixCounter];j--;)
189 for(int k=Time.ColumnCounter;k--;) {
190 Time.Matrix[ Time.MatrixCounter ][j][k] = 0.;
191 }
192 counter = 0;
193 output << "#Order\tFrag.No.\t" << Time.Header << endl;
194 output2 << "#Order\tFrag.No.\t" << Time.Header << endl;
195 for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
196 for(int i=KeySet.FragmentsPerOrder[BondOrder];i--;)
197 for(int j=Time.RowCounter[Time.MatrixCounter];j--;)
198 for(int k=Time.ColumnCounter;k--;) {
199 Time.Matrix[ Time.MatrixCounter ][j][k] += Time.Matrix[ KeySet.OrderSet[BondOrder][i] ][j][k];
200 }
201 counter += KeySet.FragmentsPerOrder[BondOrder];
202 output << BondOrder+1 << "\t" << counter;
203 output2 << BondOrder+1 << "\t" << counter;
204 for(int k=0;k<Time.ColumnCounter;k++) {
205 output << "\t" << scientific << Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter]-1 ][k];
206 if (fabs(Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter] ][k]) > MYEPSILON)
207 output2 << "\t" << scientific << Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter]-1 ][k] / Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter] ][k];
208 else
209 output2 << "\t" << scientific << Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter]-1 ][k];
210 }
211 output << endl;
212 output2 << endl;
213 }
214 output.close();
215 output2.close();
216
217 // +++++++++++++++++++++++++++++++++++++++ Plotting shieldings
218
219 if (periode != NULL) { // also look for PAS values
220 if (!CreateDataDeltaForcesOrderPerAtom(ShieldingPAS, ShieldingPASFragments, KeySet, argv[3], "DeltaShieldingsPAS-Order", "Plot of error between approximated shieldings and full shieldings versus the Bond Order", datum)) return 1;
221 if (!CreateDataForcesOrderPerAtom(ShieldingPASFragments, KeySet, argv[3], "ShieldingsPAS-Order", "Plot of approximated shieldings versus the Bond Order", datum)) return 1;
222 if (!AppendOutputFile(output, argv[3], "ShieldingsPAS-Order.dat" )) return false;
223 output << endl << "# Full" << endl;
224 for(int j=0;j<ShieldingPAS.RowCounter[ShieldingPAS.MatrixCounter];j++) {
225 output << j << "\t";
226 for(int k=0;k<ShieldingPAS.ColumnCounter;k++)
227 output << scientific << ShieldingPAS.Matrix[ ShieldingPAS.MatrixCounter ][j][k] << "\t"; //*(((k>1) && (k<6))? 1.e6 : 1.) << "\t";
228 output << endl;
229 }
230 }
231 output.close();
232
233
234 // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in energy to full QM
235 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;
236
237 // +++++++++++++++++++++++++++++++++++Plotting Energies vs. Order
238 if (!CreateDataEnergyOrder(EnergyFragments, KeySet, argv[3], "Energies-Order", "Plot of approximated energies versus the Bond Order", datum)) return 1;
239
240 // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in forces to full QM
241 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;
242
243 // min force
244 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;
245
246 // mean force
247 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;
248
249 // max force
250 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;
251
252 // ++++++++++++++++++++++++++++++++++++++Plotting Forces vs. Order
253 if (!CreateDataForcesOrderPerAtom(ForceFragments, KeySet, argv[3], "Forces-Order", "Plot of approximated forces versus the Bond Order", datum)) return 1;
254 if (!AppendOutputFile(output, argv[3], "Forces-Order.dat" )) return false;
255 output << endl << "# Full" << endl;
256 for(int j=0;j<Force.RowCounter[Force.MatrixCounter];j++) {
257 output << j << "\t";
258 for(int k=0;k<Force.ColumnCounter;k++)
259 output << scientific << Force.Matrix[ Force.MatrixCounter ][j][k] << "\t";
260 output << endl;
261 }
262 output.close();
263 // min force
264 if (!CreateDataForcesOrder(ForceFragments, KeySet, argv[3], "MinForces-Order", "Plot of min approximated forces versus the Bond Order", datum, CreateMinimumForce)) return 1;
265
266 // mean force
267 if (!CreateDataForcesOrder(ForceFragments, KeySet, argv[3], "MeanForces-Order", "Plot of mean approximated forces versus the Bond Order", datum, CreateMeanForce)) return 1;
268
269 // max force
270 if (!CreateDataForcesOrder(ForceFragments, KeySet, argv[3], "MaxForces-Order", "Plot of max approximated forces versus the Bond Order", datum, CreateMaximumForce)) return 1;
271
272 // ++++++++++++++++++++++++++++++++++++++Plotting vector sum (should be 0) vs. bond order
273 if (!CreateDataForcesOrder(ForceFragments, KeySet, argv[3], "VectorSum-Order", "Plot of vector sum of the approximated forces versus the Bond Order", datum, CreateVectorSumForce)) return 1;
274
275 // +++++++++++++++++++++++++++++++Plotting energyfragments vs. order
276 if (!CreateDataFragment(EnergyFragments, KeySet, argv[3], "Energies-Fragment", "Plot of fragment energy versus the Fragment No", datum, CreateEnergy)) return 1;
277 if (!CreateDataFragment(EnergyFragments, KeySet, argv[3], "Energies-FragmentOrder", "Plot of fragment energy of each Fragment No vs. Bond Order", datum, CreateEnergy)) return 1;
278 if (!CreateDataFragmentOrder(EnergyFragments, KeySet, argv[3], "MaxEnergies-FragmentOrder", "Plot of maximum of fragment energy vs. Bond Order", datum, CreateMaxFragmentOrder)) return 1;
279 if (!CreateDataFragmentOrder(EnergyFragments, KeySet, argv[3], "MinEnergies-FragmentOrder", "Plot of minimum of fragment energy vs. Bond Order", datum, CreateMinFragmentOrder)) return 1;
280
281 // +++++++++++++++++++++++++++++++Ploting min/mean/max forces for each fragment
282 // min force
283 if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MinForces-Fragment", "Plot of min approximated forces versus the Fragment No", datum, CreateMinimumForce)) return 1;
284
285 // mean force
286 if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MeanForces-Fragment", "Plot of mean approximated forces versus the Fragment No", datum, CreateMeanForce)) return 1;
287
288 // max force
289 if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MaxForces-Fragment", "Plot of max approximated forces versus the Fragment No", datum, CreateMaximumForce)) return 1;
290
291 // +++++++++++++++++++++++++++++++Ploting min/mean/max forces for each fragment per order
292 // min force
293 if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MinForces-FragmentOrder", "Plot of min approximated forces of each Fragment No vs. Bond Order", datum, CreateMinimumForce)) return 1;
294
295 // mean force
296 if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MeanForces-FragmentOrder", "Plot of mean approximated forces of each Fragment No vs. Bond Order", datum, CreateMeanForce)) return 1;
297
298 // max force
299 if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MaxForces-FragmentOrder", "Plot of max approximated forces of each Fragment No vs. Bond Order", datum, CreateMaximumForce)) return 1;
300
301 // ======================================= Creating the plot files ==============================================================
302
303 Orderxrange << "[1:" << KeySet.Order << "]";
304 Fragmentxrange << "[0:" << KeySet.FragmentCounter+1 << "]";
305 yrange.str("[1e-8:1e+1]");
306
307 // +++++++++++++++++++++++++++++++++++++++ Plotting Simtime vs Bond Order
308 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;
309
310 // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in energy to full QM
311 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;
312
313 // +++++++++++++++++++++++++++++++++++Plotting Energies vs. Order
314 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;
315
316 // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in forces to full QM
317 yrange.str("[1e-8:1e+0]");
318 // min force
319 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;
320
321 // mean force
322 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;
323
324 // max force
325 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;
326
327 // min/mean/max comparison for total force
328 if(!OpenOutputFile(output, argv[3], "DeltaMinMeanMaxTotalForce-Order.pyx")) return 1;
329 CreatePlotHeader(output, "DeltaMinMeanMaxTotalForce-Order", 1, "bottom left", "y", NULL, 1, 1, "bond order k", "absolute error in total forces [Ht/a.u.]");
330 output << "plot " << Orderxrange.str().c_str() << " [1e-8:1e+0] \\" << endl;
331 output << "'DeltaMinForces-Order.dat' title 'minimum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints, \\" << endl;
332 output << "'DeltaMeanForces-Order.dat' title 'mean' using 1:(abs($" << 8 << ")) with linespoints, \\" << endl;
333 output << "'DeltaMaxForces-Order.dat' title 'maximum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints" << endl;
334 output.close();
335
336 // ++++++++++++++++++++++++++++++++++++++Plotting Forces vs. Order
337 // min force
338 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;
339
340 // mean force
341 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;
342
343 // max force
344 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;
345
346 // min/mean/max comparison for total force
347 if(!OpenOutputFile(output, argv[3],"MinMeanMaxTotalForce-Order.pyx")) return 1;
348 CreatePlotHeader(output, "MinMeanMaxTotalForce-Order", 1, "bottom left", "y", NULL, 1, 1, "bond order k", "absolute total force [Ht/a.u.]");
349 output << "plot "<< Orderxrange.str().c_str() << " [1e-8:1e+0] \\" << endl;
350 output << "'MinForces-Order.dat' title 'minimum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints, \\" << endl;
351 output << "'MeanForces-Order.dat' title 'mean' using 1:(abs($" << 8 << ")) with linespoints, \\" << endl;
352 output << "'MaxForces-Order.dat' title 'maximum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints" << endl;
353 output.close();
354
355 // ++++++++++++++++++++++++++++++++++++++Plotting vector sum vs. Order
356
357 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;
358
359 // +++++++++++++++++++++++++++++++Plotting energyfragments vs. order
360 yrange.str("");
361 yrange << "[" << EnergyFragments.FindMinValue() << ":" << EnergyFragments.FindMaxValue() << "]";
362 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;
363 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;
364 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;
365 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;
366
367 // +++++++++++++++++++++++++++++++=Ploting min/mean/max forces for each fragment
368 yrange.str("");
369 yrange << "[" << ForceFragments.FindMinValue() << ":" << ForceFragments.FindMaxValue()<< "]";
370 // min
371 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;
372
373 // mean
374 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;
375
376 // max
377 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;
378
379 // +++++++++++++++++++++++++++++++=Ploting min/mean/max forces for each fragment per bond order
380 // min
381 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;
382
383 // mean
384 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;
385
386 // max
387 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;
388
389 // +++++++++++++++++++++++++++++++=Ploting approximated and true shielding for each atom
390 if (periode != NULL) { // also look for PAS values
391 if(!OpenOutputFile(output, argv[3], "ShieldingsPAS-Order.pyx")) return 1;
392 if(!OpenOutputFile(output2, argv[3], "DeltaShieldingsPAS-Order.pyx")) return 1;
393 CreatePlotHeader(output, "ShieldingsPAS-Order", 1, "top right", NULL, NULL, 1, 5, "nuclei index", "iso chemical shielding value [ppm]");
394 CreatePlotHeader(output2, "DeltaShieldingsPAS-Order", 1, "top right", NULL, NULL, 1, 5, "nuclei index", "iso chemical shielding value [ppm]");
395 double step=0.8/KeySet.Order;
396 output << "set boxwidth " << step << endl;
397 output << "plot [0:" << ShieldingPAS.RowCounter[ShieldingPAS.MatrixCounter]+10 << "]\\" << endl;
398 output2 << "plot [0:" << ShieldingPAS.RowCounter[ShieldingPAS.MatrixCounter]+10 << "]\\" << endl;
399 for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
400 output << "'ShieldingsPAS-Order.dat' index " << BondOrder << " title 'Order " << BondOrder+1 << "' using ($1+" << step*(double)BondOrder << "):7 with boxes, \\" << endl;
401 output2 << "'DeltaShieldingsPAS-Order.dat' index " << BondOrder << " title 'Order " << BondOrder+1 << "' using ($1):7 with linespoints";
402 if (BondOrder-1 != KeySet.Order)
403 output2 << ", \\" << endl;
404 }
405 output << "'ShieldingsPAS-Order.dat' index " << KeySet.Order << " title 'Full' using ($1+" << step*(double)KeySet.Order << "):7 with boxes" << endl;
406 output.close();
407 output2.close();
408 }
409
410 // create Makefile
411 if(!OpenOutputFile(output, argv[3], "Makefile")) return 1;
412 output << "PYX = $(shell ls *.pyx)" << endl << endl;
413 output << "EPS = $(PYX:.pyx=.eps)" << endl << endl;
414 output << "%.eps: %.pyx" << endl;
415 output << "\t~/build/pyxplot/pyxplot $<" << endl << endl;
416 output << "all: $(EPS)" << endl << endl;
417 output << ".PHONY: clean" << endl;
418 output << "clean:" << endl;
419 output << "\trm -rf $(EPS)" << endl;
420 output.close();
421
422 // ++++++++++++++++ exit ++++++++++++++++++++++++++++++++++
423 delete(periode);
424 Free((void **)&dir, "main: *dir");
425 cout << "done." << endl;
426 return 0;
427};
428
429//============================ END ===========================
Note: See TracBrowser for help on using the repository browser.