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