| [bcf653] | 1 | /*
 | 
|---|
 | 2 |  * Project: MoleCuilder
 | 
|---|
 | 3 |  * Description: creates and alters molecular systems
 | 
|---|
 | 4 |  * Copyright (C)  2010 University of Bonn. All rights reserved.
 | 
|---|
 | 5 |  * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
 | 
|---|
 | 6 |  */
 | 
|---|
 | 7 | 
 | 
|---|
| [14de469] | 8 | /** \file analyzer.cpp
 | 
|---|
 | 9 |  *
 | 
|---|
 | 10 |  * Takes evaluated fragments (energy and forces) and does evaluation of how sensible the BOSSANOVA
 | 
|---|
 | 11 |  * approach was, e.g. in the decay of the many-body-contributions.
 | 
|---|
| [6ac7ee] | 12 |  *
 | 
|---|
| [14de469] | 13 |  */
 | 
|---|
 | 14 | 
 | 
|---|
 | 15 | //============================ INCLUDES ===========================
 | 
|---|
 | 16 | 
 | 
|---|
| [bf3817] | 17 | // include config.h
 | 
|---|
 | 18 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 19 | #include <config.h>
 | 
|---|
 | 20 | #endif
 | 
|---|
 | 21 | 
 | 
|---|
| [ad011c] | 22 | #include "CodePatterns/MemDebug.hpp"
 | 
|---|
| [112b09] | 23 | 
 | 
|---|
| [49e1ae] | 24 | #include <cstring>
 | 
|---|
| [b60804] | 25 | #include <sstream>
 | 
|---|
 | 26 | #include <fstream>
 | 
|---|
| [255829] | 27 | #include <cmath>
 | 
|---|
| [49e1ae] | 28 | 
 | 
|---|
| [68cb0f] | 29 | #include "datacreator.hpp"
 | 
|---|
| [3bdb6d] | 30 | #include "Element/periodentafel.hpp"
 | 
|---|
| [a9b86d] | 31 | #include "Fragmentation/defs.hpp"
 | 
|---|
 | 32 | #include "Fragmentation/EnergyMatrix.hpp"
 | 
|---|
 | 33 | #include "Fragmentation/ForceMatrix.hpp"
 | 
|---|
 | 34 | #include "Fragmentation/helpers.hpp"
 | 
|---|
 | 35 | #include "Fragmentation/HessianMatrix.hpp"
 | 
|---|
 | 36 | #include "Fragmentation/KeySetsContainer.hpp"
 | 
|---|
| [255829] | 37 | #include "CodePatterns/Log.hpp"
 | 
|---|
| [ad011c] | 38 | #include "CodePatterns/Verbose.hpp"
 | 
|---|
| [68cb0f] | 39 | 
 | 
|---|
| [14de469] | 40 | //============================== MAIN =============================
 | 
|---|
 | 41 | 
 | 
|---|
 | 42 | int main(int argc, char **argv)
 | 
|---|
 | 43 | {
 | 
|---|
| [68cb0f] | 44 |   periodentafel *periode = NULL; // and a period table of all elements
 | 
|---|
| [14de469] | 45 |   EnergyMatrix Energy;
 | 
|---|
| [b12a35] | 46 |   EnergyMatrix EnergyFragments;
 | 
|---|
| [14de469] | 47 |   ForceMatrix Force;
 | 
|---|
| [b12a35] | 48 |   ForceMatrix ForceFragments;
 | 
|---|
 | 49 |   HessianMatrix Hessian;
 | 
|---|
 | 50 |   HessianMatrix HessianFragments;
 | 
|---|
 | 51 |   EnergyMatrix Hcorrection;
 | 
|---|
 | 52 |   EnergyMatrix HcorrectionFragments;
 | 
|---|
| [68cb0f] | 53 |   ForceMatrix Shielding;
 | 
|---|
 | 54 |   ForceMatrix ShieldingPAS;
 | 
|---|
| [674220] | 55 |   ForceMatrix Chi;
 | 
|---|
 | 56 |   ForceMatrix ChiPAS;
 | 
|---|
| [f05407] | 57 |   EnergyMatrix Time;
 | 
|---|
| [68cb0f] | 58 |   ForceMatrix ShieldingFragments;
 | 
|---|
 | 59 |   ForceMatrix ShieldingPASFragments;
 | 
|---|
| [674220] | 60 |   ForceMatrix ChiFragments;
 | 
|---|
 | 61 |   ForceMatrix ChiPASFragments;
 | 
|---|
| [68cb0f] | 62 |   KeySetsContainer KeySet;
 | 
|---|
| [b60804] | 63 |   std::ofstream output;
 | 
|---|
 | 64 |   std::ofstream output2;
 | 
|---|
 | 65 |   std::ofstream output3;
 | 
|---|
 | 66 |   std::ofstream output4;
 | 
|---|
 | 67 |   std::ifstream input;
 | 
|---|
 | 68 |   std::stringstream filename;
 | 
|---|
| [14de469] | 69 |   time_t t = time(NULL);
 | 
|---|
 | 70 |   struct tm *ts = localtime(&t);
 | 
|---|
 | 71 |   char *datum = asctime(ts);
 | 
|---|
| [b60804] | 72 |   std::stringstream Orderxrange;
 | 
|---|
 | 73 |   std::stringstream Fragmentxrange;
 | 
|---|
 | 74 |   std::stringstream yrange;
 | 
|---|
| [390248] | 75 |   char *dir = NULL;
 | 
|---|
| [b12a35] | 76 |   bool NoHessian = false;
 | 
|---|
 | 77 |   bool NoTime = false;
 | 
|---|
| [d067d45] | 78 |   bool NoHCorrection = true;
 | 
|---|
| [ad37ab] | 79 |   int counter = 0;
 | 
|---|
| [437922] | 80 | 
 | 
|---|
| [a67d19] | 81 |   DoLog(0) && (Log() << Verbose(0) << "ANOVA Analyzer" << endl);
 | 
|---|
 | 82 |   DoLog(0) && (Log() << Verbose(0) << "==============" << endl);
 | 
|---|
| [437922] | 83 | 
 | 
|---|
| [14de469] | 84 |   // Get the command line options
 | 
|---|
 | 85 |   if (argc < 4) {
 | 
|---|
| [a67d19] | 86 |     DoLog(0) && (Log() << Verbose(0) << "Usage: " << argv[0] << " <inputdir> <prefix> <outputdir> [elementsdb]" << endl);
 | 
|---|
 | 87 |     DoLog(0) && (Log() << Verbose(0) << "<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);
 | 
|---|
 | 88 |     DoLog(0) && (Log() << Verbose(0) << "<prefix>\tprefix of energy and forces file." << endl);
 | 
|---|
 | 89 |     DoLog(0) && (Log() << Verbose(0) << "<outputdir>\tcreated plotfiles and datafiles are placed into this directory " << endl);
 | 
|---|
 | 90 |     DoLog(0) && (Log() << Verbose(0) << "[elementsdb]\tpath to elements database, needed for shieldings." << endl);
 | 
|---|
| [14de469] | 91 |     return 1;
 | 
|---|
| [390248] | 92 |   } else {
 | 
|---|
| [920c70] | 93 |     dir = new char[strlen(argv[2]) + 2];
 | 
|---|
| [390248] | 94 |     strcpy(dir, "/");
 | 
|---|
 | 95 |     strcat(dir, argv[2]);
 | 
|---|
| [14de469] | 96 |   }
 | 
|---|
| [437922] | 97 | 
 | 
|---|
| [68cb0f] | 98 |   if (argc > 4) {
 | 
|---|
| [a67d19] | 99 |     DoLog(0) && (Log() << Verbose(0) << "Loading periodentafel." << endl);
 | 
|---|
| [920c70] | 100 |     periode = new periodentafel;
 | 
|---|
| [68cb0f] | 101 |     periode->LoadPeriodentafel(argv[4]);
 | 
|---|
 | 102 |   }
 | 
|---|
| [437922] | 103 | 
 | 
|---|
| [14de469] | 104 |   // Test the given directory
 | 
|---|
 | 105 |   if (!TestParams(argc, argv))
 | 
|---|
 | 106 |     return 1;
 | 
|---|
 | 107 | 
 | 
|---|
 | 108 |   // +++++++++++++++++ PARSING +++++++++++++++++++++++++++++++
 | 
|---|
| [437922] | 109 | 
 | 
|---|
| [14de469] | 110 |   // ------------- Parse through all Fragment subdirs --------
 | 
|---|
| [f05407] | 111 |   if (!Energy.ParseFragmentMatrix(argv[1], dir, EnergySuffix,0,0)) return 1;
 | 
|---|
| [b12a35] | 112 |   if (!Hcorrection.ParseFragmentMatrix(argv[1], "", HCORRECTIONSUFFIX,0,0)) {
 | 
|---|
 | 113 |     NoHCorrection = true;
 | 
|---|
| [58ed4a] | 114 |     DoeLog(2) && (eLog()<< Verbose(2) << "No HCorrection file found, skipping these." << endl);
 | 
|---|
| [b12a35] | 115 |   }
 | 
|---|
 | 116 |   
 | 
|---|
| [f05407] | 117 |   if (!Force.ParseFragmentMatrix(argv[1], dir, ForcesSuffix,0,0)) return 1;
 | 
|---|
| [b12a35] | 118 |   if (!Hessian.ParseFragmentMatrix(argv[1], dir, HessianSuffix,0,0)) {
 | 
|---|
 | 119 |     NoHessian = true;
 | 
|---|
| [58ed4a] | 120 |     DoeLog(2) && (eLog()<< Verbose(2) << "No Hessian file found, skipping these." << endl);
 | 
|---|
| [b12a35] | 121 |   }
 | 
|---|
 | 122 |   if (!Time.ParseFragmentMatrix(argv[1], dir, TimeSuffix, 10,1)) {
 | 
|---|
 | 123 |     NoTime = true;
 | 
|---|
| [58ed4a] | 124 |     DoeLog(2) && (eLog()<< Verbose(2) << "No speed file found, skipping these." << endl);
 | 
|---|
| [b12a35] | 125 |   }
 | 
|---|
| [68cb0f] | 126 |   if (periode != NULL) { // also look for PAS values
 | 
|---|
| [f05407] | 127 |     if (!Shielding.ParseFragmentMatrix(argv[1], dir, ShieldingSuffix, 1, 0)) return 1;
 | 
|---|
 | 128 |     if (!ShieldingPAS.ParseFragmentMatrix(argv[1], dir, ShieldingPASSuffix, 1, 0)) return 1;
 | 
|---|
| [674220] | 129 |     if (!Chi.ParseFragmentMatrix(argv[1], dir, ChiSuffix, 1, 0)) return 1;
 | 
|---|
 | 130 |     if (!ChiPAS.ParseFragmentMatrix(argv[1], dir, ChiPASSuffix, 1, 0)) return 1;
 | 
|---|
| [68cb0f] | 131 |   }
 | 
|---|
| [14de469] | 132 | 
 | 
|---|
 | 133 |   // ---------- Parse the TE Factors into an array -----------------
 | 
|---|
| [437922] | 134 |   if (!Energy.ParseIndices()) return 1;
 | 
|---|
| [d067d45] | 135 |   if (!NoHCorrection) Hcorrection.ParseIndices();
 | 
|---|
| [437922] | 136 | 
 | 
|---|
| [14de469] | 137 |   // ---------- Parse the Force indices into an array ---------------
 | 
|---|
| [2459b1] | 138 |   if (!Force.ParseIndices(argv[1])) return 1;
 | 
|---|
| [390248] | 139 |   if (!ForceFragments.AllocateMatrix(Force.Header, Force.MatrixCounter, Force.RowCounter, Force.ColumnCounter)) return 1;
 | 
|---|
| [b12a35] | 140 |   if (!ForceFragments.InitialiseIndices((class MatrixContainer *)&Force)) return 1;
 | 
|---|
 | 141 | 
 | 
|---|
 | 142 |   // ---------- Parse hessian indices into an array -----------------
 | 
|---|
 | 143 |   if (!NoHessian) {
 | 
|---|
 | 144 |     if (!Hessian.InitialiseIndices((class MatrixContainer *)&Force)) return 1;
 | 
|---|
 | 145 |     if (!HessianFragments.AllocateMatrix(Hessian.Header, Hessian.MatrixCounter, Hessian.RowCounter, Hessian.ColumnCounter)) return 1;
 | 
|---|
 | 146 |     if (!HessianFragments.InitialiseIndices((class MatrixContainer *)&Force)) return 1;
 | 
|---|
 | 147 |   }
 | 
|---|
| [14de469] | 148 | 
 | 
|---|
| [68cb0f] | 149 |   // ---------- Parse the shielding indices into an array ---------------
 | 
|---|
 | 150 |   if (periode != NULL) { // also look for PAS values
 | 
|---|
 | 151 |     if(!Shielding.ParseIndices(argv[1])) return 1;
 | 
|---|
 | 152 |     if(!ShieldingPAS.ParseIndices(argv[1])) return 1;
 | 
|---|
| [95634f] | 153 |     if (!ShieldingFragments.AllocateMatrix(Shielding.Header, Shielding.MatrixCounter, Shielding.RowCounter, Shielding.ColumnCounter)) return 1;
 | 
|---|
 | 154 |     if (!ShieldingPASFragments.AllocateMatrix(ShieldingPAS.Header, ShieldingPAS.MatrixCounter, ShieldingPAS.RowCounter, ShieldingPAS.ColumnCounter)) return 1;
 | 
|---|
 | 155 |     if(!ShieldingFragments.ParseIndices(argv[1])) return 1;
 | 
|---|
 | 156 |     if(!ShieldingPASFragments.ParseIndices(argv[1])) return 1;
 | 
|---|
| [674220] | 157 |     if(!Chi.ParseIndices(argv[1])) return 1;
 | 
|---|
 | 158 |     if(!ChiPAS.ParseIndices(argv[1])) return 1;
 | 
|---|
 | 159 |     if (!ChiFragments.AllocateMatrix(Chi.Header, Chi.MatrixCounter, Chi.RowCounter, Chi.ColumnCounter)) return 1;
 | 
|---|
 | 160 |     if (!ChiPASFragments.AllocateMatrix(ChiPAS.Header, ChiPAS.MatrixCounter, ChiPAS.RowCounter, ChiPAS.ColumnCounter)) return 1;
 | 
|---|
 | 161 |     if(!ChiFragments.ParseIndices(argv[1])) return 1;
 | 
|---|
 | 162 |     if(!ChiPASFragments.ParseIndices(argv[1])) return 1;
 | 
|---|
| [68cb0f] | 163 |   }
 | 
|---|
 | 164 | 
 | 
|---|
| [14de469] | 165 |   // ---------- Parse the KeySets into an array ---------------
 | 
|---|
 | 166 |   if (!KeySet.ParseKeySets(argv[1], Force.RowCounter, Force.MatrixCounter)) return 1;
 | 
|---|
 | 167 |   if (!KeySet.ParseManyBodyTerms()) return 1;
 | 
|---|
| [437922] | 168 | 
 | 
|---|
| [68cb0f] | 169 |   // ---------- Parse fragment files created by 'joiner' into an array -------------
 | 
|---|
| [f05407] | 170 |   if (!EnergyFragments.ParseFragmentMatrix(argv[1], dir, EnergyFragmentSuffix,0,0)) return 1;
 | 
|---|
| [b12a35] | 171 |   if (!NoHCorrection) 
 | 
|---|
 | 172 |     HcorrectionFragments.ParseFragmentMatrix(argv[1], dir, HcorrectionFragmentSuffix,0,0);
 | 
|---|
| [f05407] | 173 |   if (!ForceFragments.ParseFragmentMatrix(argv[1], dir, ForceFragmentSuffix,0,0)) return 1;
 | 
|---|
| [b12a35] | 174 |   if (!NoHessian)
 | 
|---|
 | 175 |     if (!HessianFragments.ParseFragmentMatrix(argv[1], dir, HessianFragmentSuffix,0,0)) return 1;
 | 
|---|
| [68cb0f] | 176 |   if (periode != NULL) { // also look for PAS values
 | 
|---|
| [95634f] | 177 |     if (!ShieldingFragments.ParseFragmentMatrix(argv[1], dir, ShieldingFragmentSuffix, 1, 0)) return 1;
 | 
|---|
 | 178 |     if (!ShieldingPASFragments.ParseFragmentMatrix(argv[1], dir, ShieldingPASFragmentSuffix, 1, 0)) return 1;
 | 
|---|
| [674220] | 179 |     if (!ChiFragments.ParseFragmentMatrix(argv[1], dir, ChiFragmentSuffix, 1, 0)) return 1;
 | 
|---|
 | 180 |     if (!ChiPASFragments.ParseFragmentMatrix(argv[1], dir, ChiPASFragmentSuffix, 1, 0)) return 1;
 | 
|---|
| [68cb0f] | 181 |   }
 | 
|---|
| [14de469] | 182 | 
 | 
|---|
 | 183 |   // +++++++++++++++ TESTING ++++++++++++++++++++++++++++++
 | 
|---|
| [437922] | 184 | 
 | 
|---|
| [14de469] | 185 |   // print energy and forces to file
 | 
|---|
 | 186 |   filename.str("");
 | 
|---|
 | 187 |   filename << argv[3] << "/" << "energy-forces.all";
 | 
|---|
 | 188 |   output.open(filename.str().c_str(), ios::out);
 | 
|---|
| [b12a35] | 189 |   output << endl << "Total Energy" << endl << "==============" << endl << Energy.Header[Energy.MatrixCounter] << endl;
 | 
|---|
| [14de469] | 190 |   for(int j=0;j<Energy.RowCounter[Energy.MatrixCounter];j++) {
 | 
|---|
| [f731ae] | 191 |     for(int k=0;k<Energy.ColumnCounter[Energy.MatrixCounter];k++)
 | 
|---|
| [14de469] | 192 |       output << scientific << Energy.Matrix[ Energy.MatrixCounter ][j][k] << "\t";
 | 
|---|
 | 193 |     output << endl;
 | 
|---|
 | 194 |   }
 | 
|---|
 | 195 |   output << endl;
 | 
|---|
 | 196 |   
 | 
|---|
| [b12a35] | 197 |   output << endl << "Total Forces" << endl << "===============" << endl << Force.Header[Force.MatrixCounter] << endl;
 | 
|---|
| [14de469] | 198 |   for(int j=0;j<Force.RowCounter[Force.MatrixCounter];j++) {
 | 
|---|
| [f731ae] | 199 |     for(int k=0;k<Force.ColumnCounter[Force.MatrixCounter];k++)
 | 
|---|
| [14de469] | 200 |       output << scientific << Force.Matrix[ Force.MatrixCounter ][j][k] << "\t";
 | 
|---|
 | 201 |     output << endl;
 | 
|---|
 | 202 |   }
 | 
|---|
 | 203 |   output << endl;
 | 
|---|
 | 204 | 
 | 
|---|
| [b12a35] | 205 |   if (!NoHessian) {
 | 
|---|
 | 206 |     output << endl << "Total Hessian" << endl << "===============" << endl << Hessian.Header[Hessian.MatrixCounter] << endl;
 | 
|---|
 | 207 |     for(int j=0;j<Hessian.RowCounter[Hessian.MatrixCounter];j++) {
 | 
|---|
 | 208 |       for(int k=0;k<Hessian.ColumnCounter[Hessian.MatrixCounter];k++)
 | 
|---|
 | 209 |         output << scientific << Hessian.Matrix[ Hessian.MatrixCounter ][j][k] << "\t";
 | 
|---|
 | 210 |       output << endl;
 | 
|---|
 | 211 |     }
 | 
|---|
 | 212 |     output << endl;
 | 
|---|
 | 213 |   }
 | 
|---|
 | 214 | 
 | 
|---|
| [68cb0f] | 215 |   if (periode != NULL) { // also look for PAS values
 | 
|---|
| [b12a35] | 216 |     output << endl << "Total Shieldings" << endl << "===============" << endl << Shielding.Header[Hessian.MatrixCounter] << endl;
 | 
|---|
| [68cb0f] | 217 |     for(int j=0;j<Shielding.RowCounter[Shielding.MatrixCounter];j++) {
 | 
|---|
| [f731ae] | 218 |       for(int k=0;k<Shielding.ColumnCounter[Shielding.MatrixCounter];k++)
 | 
|---|
| [68cb0f] | 219 |         output << scientific << Shielding.Matrix[ Shielding.MatrixCounter ][j][k] << "\t";
 | 
|---|
 | 220 |       output << endl;
 | 
|---|
 | 221 |     }
 | 
|---|
 | 222 |     output << endl;
 | 
|---|
 | 223 |   
 | 
|---|
| [b12a35] | 224 |     output << endl << "Total Shieldings PAS" << endl << "===============" << endl << ShieldingPAS.Header[ShieldingPAS.MatrixCounter] << endl;
 | 
|---|
| [68cb0f] | 225 |     for(int j=0;j<ShieldingPAS.RowCounter[ShieldingPAS.MatrixCounter];j++) {
 | 
|---|
| [f731ae] | 226 |       for(int k=0;k<ShieldingPAS.ColumnCounter[ShieldingPAS.MatrixCounter];k++)
 | 
|---|
| [68cb0f] | 227 |         output << scientific << ShieldingPAS.Matrix[ ShieldingPAS.MatrixCounter ][j][k] << "\t";
 | 
|---|
 | 228 |       output << endl;
 | 
|---|
 | 229 |     }
 | 
|---|
 | 230 |     output << endl;
 | 
|---|
| [674220] | 231 | 
 | 
|---|
| [5bc4d0] | 232 |     output << endl << "Total Chis" << endl << "===============" << endl << Chi.Header[Chi.MatrixCounter] << endl;
 | 
|---|
| [674220] | 233 |     for(int j=0;j<Chi.RowCounter[Chi.MatrixCounter];j++) {
 | 
|---|
| [631dcb] | 234 |       for(int k=0;k<Chi.ColumnCounter[Chi.MatrixCounter];k++)
 | 
|---|
| [674220] | 235 |         output << scientific << Chi.Matrix[ Chi.MatrixCounter ][j][k] << "\t";
 | 
|---|
 | 236 |       output << endl;
 | 
|---|
 | 237 |     }
 | 
|---|
 | 238 |     output << endl;
 | 
|---|
 | 239 |   
 | 
|---|
 | 240 |     output << endl << "Total Chis PAS" << endl << "===============" << endl << ChiPAS.Header[ChiPAS.MatrixCounter] << endl;
 | 
|---|
 | 241 |     for(int j=0;j<ChiPAS.RowCounter[ChiPAS.MatrixCounter];j++) {
 | 
|---|
| [234af2] | 242 |       for(int k=0;k<ChiPAS.ColumnCounter[ChiPAS.MatrixCounter];k++)
 | 
|---|
| [674220] | 243 |         output << scientific << ChiPAS.Matrix[ ChiPAS.MatrixCounter ][j][k] << "\t";
 | 
|---|
 | 244 |       output << endl;
 | 
|---|
 | 245 |     }
 | 
|---|
 | 246 |     output << endl;
 | 
|---|
| [68cb0f] | 247 |   }
 | 
|---|
 | 248 |   
 | 
|---|
| [b12a35] | 249 |   if (!NoTime) {
 | 
|---|
 | 250 |     output << endl << "Total Times" << endl << "===============" << endl << Time.Header[Time.MatrixCounter] << endl;
 | 
|---|
 | 251 |     for(int j=0;j<Time.RowCounter[Time.MatrixCounter];j++) {
 | 
|---|
 | 252 |       for(int k=0;k<Time.ColumnCounter[Time.MatrixCounter];k++) {
 | 
|---|
 | 253 |         output << scientific << Time.Matrix[ Time.MatrixCounter ][j][k] << "\t";
 | 
|---|
 | 254 |       }
 | 
|---|
 | 255 |       output << endl;
 | 
|---|
| [f05407] | 256 |     }
 | 
|---|
| [b4b7c3] | 257 |     output << endl;
 | 
|---|
 | 258 |   }
 | 
|---|
| [14de469] | 259 |   output.close();
 | 
|---|
| [b12a35] | 260 |   if (!NoTime)
 | 
|---|
 | 261 |     for(int k=0;k<Time.ColumnCounter[Time.MatrixCounter];k++)
 | 
|---|
 | 262 |       Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter] ][k] = Time.Matrix[ Time.MatrixCounter ][Time.RowCounter[Time.MatrixCounter]-1][k];
 | 
|---|
| [14de469] | 263 | 
 | 
|---|
 | 264 |   // +++++++++++++++ ANALYZING ++++++++++++++++++++++++++++++
 | 
|---|
| [437922] | 265 | 
 | 
|---|
| [a67d19] | 266 |   DoLog(0) && (Log() << Verbose(0) << "Analyzing ..." << endl);
 | 
|---|
| [14de469] | 267 | 
 | 
|---|
 | 268 |   // ======================================= Creating the data files ==============================================================
 | 
|---|
 | 269 | 
 | 
|---|
| [b4b7c3] | 270 |   // +++++++++++++++++++++++++++++++++++++++ Plotting Simtime vs Bond Order
 | 
|---|
| [f05407] | 271 |   // +++++++++++++++++++++++++++++++++++++++ Plotting Delta Simtime vs Bond Order
 | 
|---|
| [b12a35] | 272 |   if (!NoTime) {
 | 
|---|
 | 273 |     if (!OpenOutputFile(output, argv[3], "SimTime-Order.dat" )) return false;
 | 
|---|
 | 274 |     if (!OpenOutputFile(output2, argv[3], "DeltaSimTime-Order.dat" )) return false;
 | 
|---|
 | 275 |     for(int j=Time.RowCounter[Time.MatrixCounter];j--;)
 | 
|---|
 | 276 |       for(int k=Time.ColumnCounter[Time.MatrixCounter];k--;) {
 | 
|---|
 | 277 |         Time.Matrix[ Time.MatrixCounter ][j][k] = 0.;
 | 
|---|
 | 278 |       }
 | 
|---|
 | 279 |     counter = 0;
 | 
|---|
 | 280 |     output << "#Order\tFrag.No.\t" << Time.Header[Time.MatrixCounter] << endl;
 | 
|---|
 | 281 |     output2 << "#Order\tFrag.No.\t" << Time.Header[Time.MatrixCounter] << endl;
 | 
|---|
 | 282 |     for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
 | 
|---|
 | 283 |       for(int i=KeySet.FragmentsPerOrder[BondOrder];i--;)
 | 
|---|
 | 284 |         for(int j=Time.RowCounter[Time.MatrixCounter];j--;)
 | 
|---|
 | 285 |           for(int k=Time.ColumnCounter[Time.MatrixCounter];k--;) {
 | 
|---|
 | 286 |             Time.Matrix[ Time.MatrixCounter ][j][k] += Time.Matrix[ KeySet.OrderSet[BondOrder][i] ][j][k];
 | 
|---|
 | 287 |           }
 | 
|---|
 | 288 |       counter += KeySet.FragmentsPerOrder[BondOrder];
 | 
|---|
 | 289 |       output << BondOrder+1 << "\t" << counter;
 | 
|---|
 | 290 |       output2 << BondOrder+1 << "\t" << counter;
 | 
|---|
 | 291 |       for(int k=0;k<Time.ColumnCounter[Time.MatrixCounter];k++) {
 | 
|---|
 | 292 |         output << "\t" << scientific << Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter]-1 ][k];
 | 
|---|
 | 293 |         if (fabs(Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter] ][k]) > MYEPSILON)
 | 
|---|
 | 294 |           output2 << "\t" << scientific << Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter]-1 ][k] / Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter] ][k];
 | 
|---|
 | 295 |         else
 | 
|---|
 | 296 |           output2 << "\t" << scientific << Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter]-1 ][k];
 | 
|---|
 | 297 |       }
 | 
|---|
 | 298 |       output << endl;
 | 
|---|
 | 299 |       output2 << endl;
 | 
|---|
| [f05407] | 300 |     }
 | 
|---|
| [b12a35] | 301 |     output.close();
 | 
|---|
 | 302 |     output2.close();
 | 
|---|
 | 303 |   }
 | 
|---|
 | 304 | 
 | 
|---|
 | 305 |   if (!NoHessian) {
 | 
|---|
 | 306 |     // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in hessian to full QM
 | 
|---|
 | 307 |     if (!CreateDataDeltaHessianOrderPerAtom(Hessian, HessianFragments, KeySet, argv[3], "DeltaHessian_xx-Order", "Plot of error between approximated hessian and full hessian versus the Bond Order", datum)) return 1;
 | 
|---|
 | 308 | 
 | 
|---|
| [72744a] | 309 |     if (!CreateDataDeltaFrobeniusOrderPerAtom(Hessian, HessianFragments, KeySet, argv[3], "DeltaFrobeniusHessian_xx-Order", "Plot of error between approximated hessian and full hessian in the frobenius norm versus the Bond Order", datum)) return 1;
 | 
|---|
 | 310 | 
 | 
|---|
| [b12a35] | 311 |     // ++++++++++++++++++++++++++++++++++++++Plotting Hessian vs. Order
 | 
|---|
 | 312 |     if (!CreateDataHessianOrderPerAtom(HessianFragments, KeySet, argv[3], "Hessian_xx-Order", "Plot of approximated hessian versus the Bond Order", datum)) return 1;
 | 
|---|
 | 313 |     if (!AppendOutputFile(output, argv[3], "Hessian_xx-Order.dat" )) return false;
 | 
|---|
 | 314 |     output << endl << "# Full" << endl;
 | 
|---|
 | 315 |     for(int j=0;j<Hessian.RowCounter[Hessian.MatrixCounter];j++) {
 | 
|---|
 | 316 |       output << j << "\t";
 | 
|---|
 | 317 |       for(int k=0;k<Hessian.ColumnCounter[Force.MatrixCounter];k++)
 | 
|---|
 | 318 |         output << scientific <<  Hessian.Matrix[ Hessian.MatrixCounter ][j][k] << "\t";
 | 
|---|
 | 319 |       output << endl;
 | 
|---|
| [f05407] | 320 |     }
 | 
|---|
| [b12a35] | 321 |     output.close();
 | 
|---|
| [b4b7c3] | 322 |   }
 | 
|---|
| [f05407] | 323 | 
 | 
|---|
| [95634f] | 324 |   // +++++++++++++++++++++++++++++++++++++++ Plotting shieldings
 | 
|---|
 | 325 |   if (periode != NULL) { // also look for PAS values
 | 
|---|
 | 326 |     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;
 | 
|---|
 | 327 |     if (!CreateDataForcesOrderPerAtom(ShieldingPASFragments, KeySet, argv[3], "ShieldingsPAS-Order", "Plot of approximated shieldings versus the Bond Order", datum)) return 1;
 | 
|---|
 | 328 |     if (!AppendOutputFile(output, argv[3], "ShieldingsPAS-Order.dat" )) return false;
 | 
|---|
 | 329 |     output << endl << "# Full" << endl;
 | 
|---|
 | 330 |     for(int j=0;j<ShieldingPAS.RowCounter[ShieldingPAS.MatrixCounter];j++) {
 | 
|---|
 | 331 |       output << j << "\t";
 | 
|---|
| [f731ae] | 332 |       for(int k=0;k<ShieldingPAS.ColumnCounter[ShieldingPAS.MatrixCounter];k++)
 | 
|---|
| [95634f] | 333 |         output << scientific <<  ShieldingPAS.Matrix[ ShieldingPAS.MatrixCounter ][j][k] << "\t"; //*(((k>1) && (k<6))? 1.e6 : 1.) << "\t";
 | 
|---|
 | 334 |       output << endl;
 | 
|---|
 | 335 |     }
 | 
|---|
| [674220] | 336 |     output.close();
 | 
|---|
 | 337 |     if (!CreateDataDeltaForcesOrderPerAtom(ChiPAS, ChiPASFragments, KeySet, argv[3], "DeltaChisPAS-Order", "Plot of error between approximated Chis and full Chis versus the Bond Order", datum)) return 1;
 | 
|---|
 | 338 |     if (!CreateDataForcesOrderPerAtom(ChiPASFragments, KeySet, argv[3], "ChisPAS-Order", "Plot of approximated Chis versus the Bond Order", datum)) return 1;
 | 
|---|
 | 339 |     if (!AppendOutputFile(output, argv[3], "ChisPAS-Order.dat" )) return false;
 | 
|---|
 | 340 |     output << endl << "# Full" << endl;
 | 
|---|
 | 341 |     for(int j=0;j<ChiPAS.RowCounter[ChiPAS.MatrixCounter];j++) {
 | 
|---|
 | 342 |       output << j << "\t";
 | 
|---|
| [631dcb] | 343 |       for(int k=0;k<ChiPAS.ColumnCounter[ChiPAS.MatrixCounter];k++)
 | 
|---|
| [674220] | 344 |         output << scientific <<  ChiPAS.Matrix[ ChiPAS.MatrixCounter ][j][k] << "\t"; //*(((k>1) && (k<6))? 1.e6 : 1.) << "\t";
 | 
|---|
 | 345 |       output << endl;
 | 
|---|
 | 346 |     }
 | 
|---|
 | 347 |     output.close();
 | 
|---|
| [95634f] | 348 |   }
 | 
|---|
 | 349 | 
 | 
|---|
| [437922] | 350 | 
 | 
|---|
| [14de469] | 351 |   // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in energy to full QM
 | 
|---|
| [390248] | 352 |   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;
 | 
|---|
| [437922] | 353 | 
 | 
|---|
| [14de469] | 354 |   // +++++++++++++++++++++++++++++++++++Plotting Energies vs. Order
 | 
|---|
| [390248] | 355 |   if (!CreateDataEnergyOrder(EnergyFragments, KeySet, argv[3], "Energies-Order", "Plot of approximated energies versus the Bond Order", datum)) return 1;
 | 
|---|
| [437922] | 356 | 
 | 
|---|
| [14de469] | 357 |   // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in forces to full QM
 | 
|---|
| [390248] | 358 |   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;
 | 
|---|
 | 359 | 
 | 
|---|
 | 360 |   // min force
 | 
|---|
 | 361 |   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;
 | 
|---|
 | 362 | 
 | 
|---|
 | 363 |   // mean force
 | 
|---|
 | 364 |   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;
 | 
|---|
 | 365 | 
 | 
|---|
 | 366 |   // max force
 | 
|---|
 | 367 |   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] | 368 | 
 | 
|---|
 | 369 |   // ++++++++++++++++++++++++++++++++++++++Plotting Forces vs. Order
 | 
|---|
| [390248] | 370 |   if (!CreateDataForcesOrderPerAtom(ForceFragments, KeySet, argv[3], "Forces-Order", "Plot of approximated forces versus the Bond Order", datum)) return 1;
 | 
|---|
| [95634f] | 371 |   if (!AppendOutputFile(output, argv[3], "Forces-Order.dat" )) return false;
 | 
|---|
 | 372 |   output << endl << "# Full" << endl;
 | 
|---|
 | 373 |   for(int j=0;j<Force.RowCounter[Force.MatrixCounter];j++) {
 | 
|---|
 | 374 |     output << j << "\t";
 | 
|---|
| [f731ae] | 375 |     for(int k=0;k<Force.ColumnCounter[Force.MatrixCounter];k++)
 | 
|---|
| [95634f] | 376 |       output << scientific <<  Force.Matrix[ Force.MatrixCounter ][j][k] << "\t";
 | 
|---|
 | 377 |     output << endl;
 | 
|---|
 | 378 |   }
 | 
|---|
 | 379 |   output.close();
 | 
|---|
| [14de469] | 380 |   // min force
 | 
|---|
| [390248] | 381 |   if (!CreateDataForcesOrder(ForceFragments, KeySet, argv[3], "MinForces-Order", "Plot of min approximated forces versus the Bond Order", datum, CreateMinimumForce)) return 1;
 | 
|---|
| [14de469] | 382 | 
 | 
|---|
 | 383 |   // mean force
 | 
|---|
| [390248] | 384 |   if (!CreateDataForcesOrder(ForceFragments, KeySet, argv[3], "MeanForces-Order", "Plot of mean approximated forces versus the Bond Order", datum, CreateMeanForce)) return 1;
 | 
|---|
| [14de469] | 385 | 
 | 
|---|
 | 386 |   // max force
 | 
|---|
| [390248] | 387 |   if (!CreateDataForcesOrder(ForceFragments, KeySet, argv[3], "MaxForces-Order", "Plot of max approximated forces versus the Bond Order", datum, CreateMaximumForce)) return 1;
 | 
|---|
| [14de469] | 388 | 
 | 
|---|
 | 389 |   // ++++++++++++++++++++++++++++++++++++++Plotting vector sum (should be 0) vs. bond order
 | 
|---|
| [390248] | 390 |   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] | 391 | 
 | 
|---|
 | 392 |   // +++++++++++++++++++++++++++++++Plotting energyfragments vs. order
 | 
|---|
 | 393 |   if (!CreateDataFragment(EnergyFragments, KeySet, argv[3], "Energies-Fragment", "Plot of fragment energy versus the Fragment No", datum, CreateEnergy)) return 1;
 | 
|---|
 | 394 |   if (!CreateDataFragment(EnergyFragments, KeySet, argv[3], "Energies-FragmentOrder", "Plot of fragment energy of each Fragment No vs. Bond Order", datum, CreateEnergy)) return 1;
 | 
|---|
 | 395 |   if (!CreateDataFragmentOrder(EnergyFragments, KeySet, argv[3], "MaxEnergies-FragmentOrder", "Plot of maximum of fragment energy vs. Bond Order", datum, CreateMaxFragmentOrder)) return 1;
 | 
|---|
 | 396 |   if (!CreateDataFragmentOrder(EnergyFragments, KeySet, argv[3], "MinEnergies-FragmentOrder", "Plot of minimum of fragment energy vs. Bond Order", datum, CreateMinFragmentOrder)) return 1;
 | 
|---|
 | 397 | 
 | 
|---|
 | 398 |   // +++++++++++++++++++++++++++++++Ploting min/mean/max forces for each fragment
 | 
|---|
 | 399 |   // min force
 | 
|---|
 | 400 |   if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MinForces-Fragment", "Plot of min approximated forces versus the Fragment No", datum, CreateMinimumForce)) return 1;
 | 
|---|
 | 401 | 
 | 
|---|
 | 402 |   // mean force
 | 
|---|
 | 403 |   if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MeanForces-Fragment", "Plot of mean approximated forces versus the Fragment No", datum, CreateMeanForce)) return 1;
 | 
|---|
 | 404 | 
 | 
|---|
 | 405 |   // max force
 | 
|---|
 | 406 |   if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MaxForces-Fragment", "Plot of max approximated forces versus the Fragment No", datum, CreateMaximumForce)) return 1;
 | 
|---|
 | 407 | 
 | 
|---|
 | 408 |   // +++++++++++++++++++++++++++++++Ploting min/mean/max forces for each fragment per order
 | 
|---|
 | 409 |   // min force
 | 
|---|
 | 410 |   if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MinForces-FragmentOrder", "Plot of min approximated forces of each Fragment No vs. Bond Order", datum, CreateMinimumForce)) return 1;
 | 
|---|
 | 411 | 
 | 
|---|
 | 412 |   // mean force
 | 
|---|
 | 413 |   if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MeanForces-FragmentOrder", "Plot of mean approximated forces of each Fragment No vs. Bond Order", datum, CreateMeanForce)) return 1;
 | 
|---|
 | 414 | 
 | 
|---|
 | 415 |   // max force
 | 
|---|
 | 416 |   if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MaxForces-FragmentOrder", "Plot of max approximated forces of each Fragment No vs. Bond Order", datum, CreateMaximumForce)) return 1;
 | 
|---|
 | 417 | 
 | 
|---|
 | 418 |   // ======================================= Creating the plot files ==============================================================
 | 
|---|
| [437922] | 419 | 
 | 
|---|
| [14de469] | 420 |   Orderxrange << "[1:" << KeySet.Order << "]";
 | 
|---|
 | 421 |   Fragmentxrange << "[0:" << KeySet.FragmentCounter+1 << "]";
 | 
|---|
| [390248] | 422 |   yrange.str("[1e-8:1e+1]");
 | 
|---|
| [14de469] | 423 |   
 | 
|---|
| [b12a35] | 424 |   if (!NoTime) {
 | 
|---|
 | 425 |     // +++++++++++++++++++++++++++++++++++++++ Plotting Simtime vs Bond Order
 | 
|---|
 | 426 |     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;
 | 
|---|
 | 427 |   }
 | 
|---|
| [14de469] | 428 |   
 | 
|---|
 | 429 |   // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in energy to full QM
 | 
|---|
| [390248] | 430 |   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;
 | 
|---|
| [437922] | 431 | 
 | 
|---|
| [14de469] | 432 |   // +++++++++++++++++++++++++++++++++++Plotting Energies vs. Order
 | 
|---|
 | 433 |   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;
 | 
|---|
 | 434 | 
 | 
|---|
 | 435 |   // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in forces to full QM
 | 
|---|
| [390248] | 436 |   yrange.str("[1e-8:1e+0]");
 | 
|---|
| [14de469] | 437 |   // min force
 | 
|---|
| [390248] | 438 |   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] | 439 | 
 | 
|---|
 | 440 |   // mean force
 | 
|---|
| [390248] | 441 |   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] | 442 | 
 | 
|---|
 | 443 |   // max force
 | 
|---|
| [390248] | 444 |   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] | 445 | 
 | 
|---|
 | 446 |   // min/mean/max comparison for total force
 | 
|---|
 | 447 |   if(!OpenOutputFile(output, argv[3], "DeltaMinMeanMaxTotalForce-Order.pyx")) return 1;
 | 
|---|
| [fa40b5] | 448 |   CreatePlotHeader(output, "DeltaMinMeanMaxTotalForce-Order", 1, "bottom left", "y", NULL,  1, 1, "bond order k", "absolute error in total forces [Ht/a.u.]");
 | 
|---|
| [437922] | 449 |   output << "plot " << Orderxrange.str().c_str() << " [1e-8:1e+0] \\" << endl;
 | 
|---|
| [14de469] | 450 |   output << "'DeltaMinForces-Order.dat' title 'minimum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints, \\" << endl;
 | 
|---|
 | 451 |   output << "'DeltaMeanForces-Order.dat' title 'mean' using 1:(abs($" << 8 << ")) with linespoints, \\" << endl;
 | 
|---|
 | 452 |   output << "'DeltaMaxForces-Order.dat' title 'maximum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints" << endl;
 | 
|---|
| [437922] | 453 |   output.close();
 | 
|---|
| [14de469] | 454 | 
 | 
|---|
 | 455 |   // ++++++++++++++++++++++++++++++++++++++Plotting Forces vs. Order
 | 
|---|
 | 456 |   // min force
 | 
|---|
 | 457 |   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;
 | 
|---|
 | 458 | 
 | 
|---|
 | 459 |   // mean force
 | 
|---|
 | 460 |   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;
 | 
|---|
 | 461 | 
 | 
|---|
 | 462 |   // max force
 | 
|---|
 | 463 |   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;
 | 
|---|
 | 464 | 
 | 
|---|
 | 465 |   // min/mean/max comparison for total force
 | 
|---|
 | 466 |   if(!OpenOutputFile(output, argv[3],"MinMeanMaxTotalForce-Order.pyx")) return 1;
 | 
|---|
| [fa40b5] | 467 |   CreatePlotHeader(output, "MinMeanMaxTotalForce-Order", 1, "bottom left", "y", NULL, 1, 1, "bond order k", "absolute total force [Ht/a.u.]");
 | 
|---|
| [437922] | 468 |   output << "plot "<< Orderxrange.str().c_str() << " [1e-8:1e+0] \\" << endl;
 | 
|---|
| [14de469] | 469 |   output << "'MinForces-Order.dat' title 'minimum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints, \\" << endl;
 | 
|---|
 | 470 |   output << "'MeanForces-Order.dat' title 'mean' using 1:(abs($" << 8 << ")) with linespoints, \\" << endl;
 | 
|---|
 | 471 |   output << "'MaxForces-Order.dat' title 'maximum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints" << endl;
 | 
|---|
| [437922] | 472 |   output.close();
 | 
|---|
| [14de469] | 473 | 
 | 
|---|
 | 474 |   // ++++++++++++++++++++++++++++++++++++++Plotting vector sum vs. Order
 | 
|---|
 | 475 | 
 | 
|---|
 | 476 |   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;
 | 
|---|
 | 477 | 
 | 
|---|
 | 478 |   // +++++++++++++++++++++++++++++++Plotting energyfragments vs. order
 | 
|---|
| [390248] | 479 |   yrange.str("");
 | 
|---|
 | 480 |   yrange << "[" << EnergyFragments.FindMinValue() << ":" << EnergyFragments.FindMaxValue() << "]";
 | 
|---|
 | 481 |   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;
 | 
|---|
 | 482 |   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;
 | 
|---|
 | 483 |   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;
 | 
|---|
 | 484 |   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] | 485 | 
 | 
|---|
 | 486 |   // +++++++++++++++++++++++++++++++=Ploting min/mean/max forces for each fragment
 | 
|---|
| [390248] | 487 |   yrange.str("");
 | 
|---|
 | 488 |   yrange << "[" << ForceFragments.FindMinValue() << ":" << ForceFragments.FindMaxValue()<< "]";
 | 
|---|
| [14de469] | 489 |   // min
 | 
|---|
| [390248] | 490 |   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;
 | 
|---|
| [437922] | 491 | 
 | 
|---|
| [14de469] | 492 |   // mean
 | 
|---|
| [390248] | 493 |   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;
 | 
|---|
| [437922] | 494 | 
 | 
|---|
| [14de469] | 495 |   // max
 | 
|---|
| [390248] | 496 |   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] | 497 | 
 | 
|---|
 | 498 |   // +++++++++++++++++++++++++++++++=Ploting min/mean/max forces for each fragment per bond order
 | 
|---|
 | 499 |   // min
 | 
|---|
| [390248] | 500 |   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;
 | 
|---|
| [437922] | 501 | 
 | 
|---|
| [14de469] | 502 |   // mean
 | 
|---|
| [390248] | 503 |   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;
 | 
|---|
| [437922] | 504 | 
 | 
|---|
| [14de469] | 505 |   // max
 | 
|---|
| [390248] | 506 |   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;
 | 
|---|
| [437922] | 507 | 
 | 
|---|
| [95634f] | 508 |   // +++++++++++++++++++++++++++++++=Ploting approximated and true shielding for each atom
 | 
|---|
 | 509 |   if (periode != NULL) { // also look for PAS values
 | 
|---|
 | 510 |     if(!OpenOutputFile(output, argv[3], "ShieldingsPAS-Order.pyx")) return 1;
 | 
|---|
| [4ee3df] | 511 |     if(!OpenOutputFile(output2, argv[3], "DeltaShieldingsPAS-Order.pyx")) return 1;
 | 
|---|
| [95634f] | 512 |     CreatePlotHeader(output, "ShieldingsPAS-Order", 1, "top right", NULL, NULL,  1, 5, "nuclei index", "iso chemical shielding value [ppm]");
 | 
|---|
| [4ee3df] | 513 |     CreatePlotHeader(output2, "DeltaShieldingsPAS-Order", 1, "top right", NULL, NULL,  1, 5, "nuclei index", "iso chemical shielding value [ppm]");
 | 
|---|
| [95634f] | 514 |     double step=0.8/KeySet.Order;
 | 
|---|
 | 515 |     output << "set boxwidth " << step << endl;
 | 
|---|
 | 516 |     output << "plot [0:" << ShieldingPAS.RowCounter[ShieldingPAS.MatrixCounter]+10 << "]\\" << endl;
 | 
|---|
| [4ee3df] | 517 |     output2 << "plot [0:" << ShieldingPAS.RowCounter[ShieldingPAS.MatrixCounter]+10 << "]\\" << endl;
 | 
|---|
| [95634f] | 518 |     for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
 | 
|---|
 | 519 |       output << "'ShieldingsPAS-Order.dat' index " << BondOrder << " title 'Order " << BondOrder+1 << "' using ($1+" << step*(double)BondOrder << "):7 with boxes, \\" << endl;
 | 
|---|
| [4ee3df] | 520 |       output2 << "'DeltaShieldingsPAS-Order.dat' index " << BondOrder << " title 'Order " << BondOrder+1 << "' using ($1):7 with linespoints";
 | 
|---|
 | 521 |       if (BondOrder-1 != KeySet.Order)
 | 
|---|
 | 522 |         output2 << ", \\" << endl;
 | 
|---|
| [95634f] | 523 |     }
 | 
|---|
 | 524 |     output << "'ShieldingsPAS-Order.dat' index " << KeySet.Order << " title 'Full' using ($1+" << step*(double)KeySet.Order << "):7 with boxes" << endl;
 | 
|---|
| [4ee3df] | 525 |     output2.close();  
 | 
|---|
| [674220] | 526 | 
 | 
|---|
 | 527 |     if(!OpenOutputFile(output, argv[3], "ChisPAS-Order.pyx")) return 1;
 | 
|---|
 | 528 |     if(!OpenOutputFile(output2, argv[3], "DeltaChisPAS-Order.pyx")) return 1;
 | 
|---|
 | 529 |     CreatePlotHeader(output, "ChisPAS-Order", 1, "top right", NULL, NULL,  1, 5, "nuclei index", "iso chemical Chi value [ppm]");
 | 
|---|
 | 530 |     CreatePlotHeader(output2, "DeltaChisPAS-Order", 1, "top right", NULL, NULL,  1, 5, "nuclei index", "iso chemical Chi value [ppm]");
 | 
|---|
 | 531 |     output << "set boxwidth " << step << endl;
 | 
|---|
 | 532 |     output << "plot [0:" << ChiPAS.RowCounter[ChiPAS.MatrixCounter]+10 << "]\\" << endl;
 | 
|---|
 | 533 |     output2 << "plot [0:" << ChiPAS.RowCounter[ChiPAS.MatrixCounter]+10 << "]\\" << endl;
 | 
|---|
 | 534 |     for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
 | 
|---|
 | 535 |       output << "'ChisPAS-Order.dat' index " << BondOrder << " title 'Order " << BondOrder+1 << "' using ($1+" << step*(double)BondOrder << "):7 with boxes, \\" << endl;
 | 
|---|
 | 536 |       output2 << "'DeltaChisPAS-Order.dat' index " << BondOrder << " title 'Order " << BondOrder+1 << "' using ($1):7 with linespoints";
 | 
|---|
| [71e7c7] | 537 |       if (BondOrder-1 != KeySet.Order)
 | 
|---|
 | 538 |         output2 << ", \\" << endl;
 | 
|---|
 | 539 |     }
 | 
|---|
 | 540 |     output << "'ChisPAS-Order.dat' index " << KeySet.Order << " title 'Full' using ($1+" << step*(double)KeySet.Order << "):7 with boxes" << endl;
 | 
|---|
| [95634f] | 541 |     output.close();  
 | 
|---|
| [4ee3df] | 542 |     output2.close();  
 | 
|---|
| [234af2] | 543 | 
 | 
|---|
 | 544 |     if(!OpenOutputFile(output, argv[3], "ChisPAS-Order.pyx")) return 1;
 | 
|---|
 | 545 |     if(!OpenOutputFile(output2, argv[3], "DeltaChisPAS-Order.pyx")) return 1;
 | 
|---|
 | 546 |     CreatePlotHeader(output, "ChisPAS-Order", 1, "top right", NULL, NULL,  1, 5, "nuclei index", "iso chemical Chi value [ppm]");
 | 
|---|
 | 547 |     CreatePlotHeader(output2, "DeltaChisPAS-Order", 1, "top right", NULL, NULL,  1, 5, "nuclei index", "iso chemical Chi value [ppm]");
 | 
|---|
 | 548 |     output << "set boxwidth " << step << endl;
 | 
|---|
 | 549 |     output << "plot [0:" << ChiPAS.RowCounter[ChiPAS.MatrixCounter]+10 << "]\\" << endl;
 | 
|---|
 | 550 |     output2 << "plot [0:" << ChiPAS.RowCounter[ChiPAS.MatrixCounter]+10 << "]\\" << endl;
 | 
|---|
 | 551 |     for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
 | 
|---|
 | 552 |       output << "'ChisPAS-Order.dat' index " << BondOrder << " title 'Order " << BondOrder+1 << "' using ($1+" << step*(double)BondOrder << "):7 with boxes, \\" << endl;
 | 
|---|
 | 553 |       output2 << "'DeltaChisPAS-Order.dat' index " << BondOrder << " title 'Order " << BondOrder+1 << "' using ($1):7 with linespoints";
 | 
|---|
| [674220] | 554 |       if (BondOrder-1 != KeySet.Order)
 | 
|---|
 | 555 |         output2 << ", \\" << endl;
 | 
|---|
 | 556 |     }
 | 
|---|
 | 557 |     output << "'ChisPAS-Order.dat' index " << KeySet.Order << " title 'Full' using ($1+" << step*(double)KeySet.Order << "):7 with boxes" << endl;
 | 
|---|
 | 558 |     output.close();  
 | 
|---|
 | 559 |     output2.close();  
 | 
|---|
| [95634f] | 560 |   }
 | 
|---|
 | 561 | 
 | 
|---|
| [14de469] | 562 |   // create Makefile
 | 
|---|
 | 563 |   if(!OpenOutputFile(output, argv[3], "Makefile")) return 1;
 | 
|---|
 | 564 |   output << "PYX = $(shell ls *.pyx)" << endl << endl;
 | 
|---|
 | 565 |   output << "EPS = $(PYX:.pyx=.eps)" << endl << endl;
 | 
|---|
 | 566 |   output << "%.eps: %.pyx" << endl;
 | 
|---|
 | 567 |   output << "\t~/build/pyxplot/pyxplot $<" << endl << endl;
 | 
|---|
 | 568 |   output << "all: $(EPS)" << endl << endl;
 | 
|---|
 | 569 |   output << ".PHONY: clean" << endl;
 | 
|---|
 | 570 |   output << "clean:" << endl;
 | 
|---|
 | 571 |   output << "\trm -rf $(EPS)" << endl;
 | 
|---|
 | 572 |   output.close();
 | 
|---|
| [437922] | 573 | 
 | 
|---|
| [68cb0f] | 574 |   // ++++++++++++++++ exit ++++++++++++++++++++++++++++++++++
 | 
|---|
 | 575 |   delete(periode);
 | 
|---|
| [920c70] | 576 |   delete[](dir);
 | 
|---|
| [a67d19] | 577 |   DoLog(0) && (Log() << Verbose(0) << "done." << endl);
 | 
|---|
| [14de469] | 578 |   return 0;
 | 
|---|
 | 579 | };
 | 
|---|
 | 580 | 
 | 
|---|
 | 581 | //============================ END ===========================
 | 
|---|