| [14de469] | 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 |  | 
|---|
| [68cb0f] | 10 | #include "datacreator.hpp" | 
|---|
| [14de469] | 11 | #include "helpers.hpp" | 
|---|
|  | 12 | #include "parser.hpp" | 
|---|
| [68cb0f] | 13 | #include "periodentafel.hpp" | 
|---|
|  | 14 |  | 
|---|
|  | 15 | // include config.h | 
|---|
|  | 16 | #ifdef HAVE_CONFIG_H | 
|---|
|  | 17 | #include <config.h> | 
|---|
|  | 18 | #endif | 
|---|
| [14de469] | 19 |  | 
|---|
|  | 20 |  | 
|---|
|  | 21 | //============================== MAIN ============================= | 
|---|
|  | 22 |  | 
|---|
|  | 23 | int main(int argc, char **argv) | 
|---|
|  | 24 | { | 
|---|
| [68cb0f] | 25 | periodentafel *periode = NULL; // and a period table of all elements | 
|---|
| [14de469] | 26 | EnergyMatrix Energy; | 
|---|
| [390248] | 27 | EnergyMatrix Hcorrection; | 
|---|
| [14de469] | 28 | ForceMatrix Force; | 
|---|
| [68cb0f] | 29 | ForceMatrix Shielding; | 
|---|
|  | 30 | ForceMatrix ShieldingPAS; | 
|---|
| [14de469] | 31 | MatrixContainer Time; | 
|---|
|  | 32 | EnergyMatrix EnergyFragments; | 
|---|
| [390248] | 33 | EnergyMatrix HcorrectionFragments; | 
|---|
| [14de469] | 34 | ForceMatrix ForceFragments; | 
|---|
| [68cb0f] | 35 | ForceMatrix ShieldingFragments; | 
|---|
|  | 36 | ForceMatrix ShieldingPASFragments; | 
|---|
|  | 37 | KeySetsContainer KeySet; | 
|---|
| [14de469] | 38 | ofstream output; | 
|---|
|  | 39 | ofstream output2; | 
|---|
|  | 40 | ofstream output3; | 
|---|
|  | 41 | ofstream output4; | 
|---|
| [68cb0f] | 42 | ifstream input; | 
|---|
| [14de469] | 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; | 
|---|
| [390248] | 49 | stringstream yrange; | 
|---|
|  | 50 | char *dir = NULL; | 
|---|
|  | 51 | bool Hcorrected = true; | 
|---|
|  | 52 | double norm; | 
|---|
|  | 53 |  | 
|---|
| [14de469] | 54 | cout << "ANOVA Analyzer" << endl; | 
|---|
|  | 55 | cout << "==============" << endl; | 
|---|
|  | 56 |  | 
|---|
|  | 57 | // Get the command line options | 
|---|
|  | 58 | if (argc < 4) { | 
|---|
| [68cb0f] | 59 | cout << "Usage: " << argv[0] << " <inputdir> <prefix> <outputdir> [elementsdb]" << endl; | 
|---|
| [14de469] | 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; | 
|---|
| [68cb0f] | 63 | cout << "[elementsdb]\tpath to elements database, needed for shieldings." << endl; | 
|---|
| [14de469] | 64 | return 1; | 
|---|
| [390248] | 65 | } else { | 
|---|
|  | 66 | dir = (char *) Malloc(sizeof(char)*(strlen(argv[2])+2), "main: *dir"); | 
|---|
|  | 67 | strcpy(dir, "/"); | 
|---|
|  | 68 | strcat(dir, argv[2]); | 
|---|
| [14de469] | 69 | } | 
|---|
| [390248] | 70 |  | 
|---|
| [68cb0f] | 71 | if (argc > 4) { | 
|---|
|  | 72 | cout << "Loading periodentafel." << endl; | 
|---|
|  | 73 | periode = new periodentafel; | 
|---|
|  | 74 | periode->LoadPeriodentafel(argv[4]); | 
|---|
|  | 75 | } | 
|---|
| [14de469] | 76 |  | 
|---|
|  | 77 | // Test the given directory | 
|---|
|  | 78 | if (!TestParams(argc, argv)) | 
|---|
|  | 79 | return 1; | 
|---|
|  | 80 |  | 
|---|
|  | 81 | // +++++++++++++++++ PARSING +++++++++++++++++++++++++++++++ | 
|---|
|  | 82 |  | 
|---|
|  | 83 | // ------------- Parse through all Fragment subdirs -------- | 
|---|
| [390248] | 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; | 
|---|
| [68cb0f] | 88 | if (periode != NULL) { // also look for PAS values | 
|---|
| [390248] | 89 | if (!Shielding.ParseMatrix(argv[1], dir, ShieldingSuffix, 1, 0)) return 1; | 
|---|
|  | 90 | if (!ShieldingPAS.ParseMatrix(argv[1], dir, ShieldingPASSuffix, 1, 0)) return 1; | 
|---|
| [68cb0f] | 91 | } | 
|---|
| [14de469] | 92 |  | 
|---|
|  | 93 | // ---------- Parse the TE Factors into an array ----------------- | 
|---|
| [2459b1] | 94 | if (!Energy.ParseIndices()) return 1; | 
|---|
| [390248] | 95 | if (Hcorrected) Hcorrection.ParseIndices(); | 
|---|
| [14de469] | 96 |  | 
|---|
|  | 97 | // ---------- Parse the Force indices into an array --------------- | 
|---|
| [2459b1] | 98 | if (!Force.ParseIndices(argv[1])) return 1; | 
|---|
| [390248] | 99 | if (!ForceFragments.AllocateMatrix(Force.Header, Force.MatrixCounter, Force.RowCounter, Force.ColumnCounter)) return 1; | 
|---|
|  | 100 | if (!ForceFragments.ParseIndices(argv[1])) return 1; | 
|---|
| [14de469] | 101 |  | 
|---|
| [68cb0f] | 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 |  | 
|---|
| [14de469] | 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; | 
|---|
| [68cb0f] | 111 |  | 
|---|
|  | 112 | // ---------- Parse fragment files created by 'joiner' into an array ------------- | 
|---|
| [390248] | 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; | 
|---|
| [68cb0f] | 116 | if (periode != NULL) { // also look for PAS values | 
|---|
| [390248] | 117 | if (!ShieldingFragments.ParseMatrix(argv[1], dir, ShieldingSuffix, 1, 0)) return 1; | 
|---|
|  | 118 | if (!ShieldingPASFragments.ParseMatrix(argv[1], dir, ShieldingPASSuffix, 1, 0)) return 1; | 
|---|
| [68cb0f] | 119 | } | 
|---|
| [14de469] | 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 |  | 
|---|
| [68cb0f] | 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 |  | 
|---|
| [390248] | 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; | 
|---|
| [14de469] | 175 | output.close(); | 
|---|
|  | 176 |  | 
|---|
|  | 177 | // +++++++++++++++ ANALYZING ++++++++++++++++++++++++++++++ | 
|---|
|  | 178 |  | 
|---|
|  | 179 | cout << "Analyzing ..." << endl; | 
|---|
|  | 180 |  | 
|---|
|  | 181 | // ======================================= Creating the data files ============================================================== | 
|---|
|  | 182 |  | 
|---|
| [390248] | 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(); | 
|---|
| [14de469] | 199 |  | 
|---|
|  | 200 | // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in energy to full QM | 
|---|
| [390248] | 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; | 
|---|
| [14de469] | 202 |  | 
|---|
|  | 203 | // +++++++++++++++++++++++++++++++++++Plotting Energies vs. Order | 
|---|
| [390248] | 204 | if (!CreateDataEnergyOrder(EnergyFragments, KeySet, argv[3], "Energies-Order", "Plot of approximated energies versus the Bond Order", datum)) return 1; | 
|---|
| [14de469] | 205 |  | 
|---|
|  | 206 | // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in forces to full QM | 
|---|
| [390248] | 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; | 
|---|
| [14de469] | 217 |  | 
|---|
|  | 218 | // ++++++++++++++++++++++++++++++++++++++Plotting Forces vs. Order | 
|---|
| [390248] | 219 | if (!CreateDataForcesOrderPerAtom(ForceFragments, KeySet, argv[3], "Forces-Order", "Plot of approximated forces versus the Bond Order", datum)) return 1; | 
|---|
| [14de469] | 220 |  | 
|---|
|  | 221 | // min force | 
|---|
| [390248] | 222 | if (!CreateDataForcesOrder(ForceFragments, KeySet, argv[3], "MinForces-Order", "Plot of min approximated forces versus the Bond Order", datum, CreateMinimumForce)) return 1; | 
|---|
| [14de469] | 223 |  | 
|---|
|  | 224 | // mean force | 
|---|
| [390248] | 225 | if (!CreateDataForcesOrder(ForceFragments, KeySet, argv[3], "MeanForces-Order", "Plot of mean approximated forces versus the Bond Order", datum, CreateMeanForce)) return 1; | 
|---|
| [14de469] | 226 |  | 
|---|
|  | 227 | // max force | 
|---|
| [390248] | 228 | if (!CreateDataForcesOrder(ForceFragments, KeySet, argv[3], "MaxForces-Order", "Plot of max approximated forces versus the Bond Order", datum, CreateMaximumForce)) return 1; | 
|---|
| [14de469] | 229 |  | 
|---|
|  | 230 | // ++++++++++++++++++++++++++++++++++++++Plotting vector sum (should be 0) vs. bond order | 
|---|
| [390248] | 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; | 
|---|
| [14de469] | 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 << "]"; | 
|---|
| [390248] | 263 | yrange.str("[1e-8:1e+1]"); | 
|---|
| [14de469] | 264 |  | 
|---|
|  | 265 | // +++++++++++++++++++++++++++++++++++++++ Plotting Simtime vs Bond Order | 
|---|
| [390248] | 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; | 
|---|
| [14de469] | 267 |  | 
|---|
|  | 268 | // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in energy to full QM | 
|---|
| [390248] | 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; | 
|---|
| [14de469] | 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 | 
|---|
| [390248] | 275 | yrange.str("[1e-8:1e+0]"); | 
|---|
| [14de469] | 276 | // min force | 
|---|
| [390248] | 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; | 
|---|
| [14de469] | 278 |  | 
|---|
|  | 279 | // mean force | 
|---|
| [390248] | 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; | 
|---|
| [14de469] | 281 |  | 
|---|
|  | 282 | // max force | 
|---|
| [390248] | 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; | 
|---|
| [14de469] | 284 |  | 
|---|
|  | 285 | // min/mean/max comparison for total force | 
|---|
|  | 286 | if(!OpenOutputFile(output, argv[3], "DeltaMinMeanMaxTotalForce-Order.pyx")) return 1; | 
|---|
| [fa40b5] | 287 | CreatePlotHeader(output, "DeltaMinMeanMaxTotalForce-Order", 1, "bottom left", "y", NULL,  1, 1, "bond order k", "absolute error in total forces [Ht/a.u.]"); | 
|---|
| [14de469] | 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; | 
|---|
| [fa40b5] | 306 | CreatePlotHeader(output, "MinMeanMaxTotalForce-Order", 1, "bottom left", "y", NULL, 1, 1, "bond order k", "absolute total force [Ht/a.u.]"); | 
|---|
| [14de469] | 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 | 
|---|
| [390248] | 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; | 
|---|
| [14de469] | 324 |  | 
|---|
|  | 325 | // +++++++++++++++++++++++++++++++=Ploting min/mean/max forces for each fragment | 
|---|
| [390248] | 326 | yrange.str(""); | 
|---|
|  | 327 | yrange << "[" << ForceFragments.FindMinValue() << ":" << ForceFragments.FindMaxValue()<< "]"; | 
|---|
| [14de469] | 328 | // min | 
|---|
| [390248] | 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; | 
|---|
| [14de469] | 330 |  | 
|---|
|  | 331 | // mean | 
|---|
| [390248] | 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; | 
|---|
| [14de469] | 333 |  | 
|---|
|  | 334 | // max | 
|---|
| [390248] | 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; | 
|---|
| [14de469] | 336 |  | 
|---|
|  | 337 | // +++++++++++++++++++++++++++++++=Ploting min/mean/max forces for each fragment per bond order | 
|---|
|  | 338 | // min | 
|---|
| [390248] | 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; | 
|---|
| [14de469] | 340 |  | 
|---|
|  | 341 | // mean | 
|---|
| [390248] | 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; | 
|---|
| [14de469] | 343 |  | 
|---|
|  | 344 | // max | 
|---|
| [390248] | 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; | 
|---|
| [14de469] | 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 |  | 
|---|
| [68cb0f] | 359 | // ++++++++++++++++ exit ++++++++++++++++++++++++++++++++++ | 
|---|
|  | 360 | delete(periode); | 
|---|
| [390248] | 361 | Free((void **)&dir, "main: *dir"); | 
|---|
| [14de469] | 362 | cout << "done." << endl; | 
|---|
|  | 363 | return 0; | 
|---|
|  | 364 | }; | 
|---|
|  | 365 |  | 
|---|
|  | 366 | //============================ END =========================== | 
|---|