| [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)) { | 
|---|
|  | 121 | delete dir; | 
|---|
|  | 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 --------------- | 
|---|
|  | 184 | if (!KeySet.ParseKeySets(argv[1], Force.RowCounter, Force.MatrixCounter)) return 1; | 
|---|
|  | 185 | if (!KeySet.ParseManyBodyTerms()) return 1; | 
|---|
| [437922] | 186 |  | 
|---|
| [68cb0f] | 187 | // ---------- Parse fragment files created by 'joiner' into an array ------------- | 
|---|
| [f05407] | 188 | if (!EnergyFragments.ParseFragmentMatrix(argv[1], dir, EnergyFragmentSuffix,0,0)) return 1; | 
|---|
| [b12a35] | 189 | if (!NoHCorrection) | 
|---|
|  | 190 | HcorrectionFragments.ParseFragmentMatrix(argv[1], dir, HcorrectionFragmentSuffix,0,0); | 
|---|
| [f05407] | 191 | if (!ForceFragments.ParseFragmentMatrix(argv[1], dir, ForceFragmentSuffix,0,0)) return 1; | 
|---|
| [b12a35] | 192 | if (!NoHessian) | 
|---|
|  | 193 | if (!HessianFragments.ParseFragmentMatrix(argv[1], dir, HessianFragmentSuffix,0,0)) return 1; | 
|---|
| [68cb0f] | 194 | if (periode != NULL) { // also look for PAS values | 
|---|
| [95634f] | 195 | if (!ShieldingFragments.ParseFragmentMatrix(argv[1], dir, ShieldingFragmentSuffix, 1, 0)) return 1; | 
|---|
|  | 196 | if (!ShieldingPASFragments.ParseFragmentMatrix(argv[1], dir, ShieldingPASFragmentSuffix, 1, 0)) return 1; | 
|---|
| [674220] | 197 | if (!ChiFragments.ParseFragmentMatrix(argv[1], dir, ChiFragmentSuffix, 1, 0)) return 1; | 
|---|
|  | 198 | if (!ChiPASFragments.ParseFragmentMatrix(argv[1], dir, ChiPASFragmentSuffix, 1, 0)) return 1; | 
|---|
| [68cb0f] | 199 | } | 
|---|
| [14de469] | 200 |  | 
|---|
|  | 201 | // +++++++++++++++ TESTING ++++++++++++++++++++++++++++++ | 
|---|
| [437922] | 202 |  | 
|---|
| [14de469] | 203 | // print energy and forces to file | 
|---|
|  | 204 | filename.str(""); | 
|---|
|  | 205 | filename << argv[3] << "/" << "energy-forces.all"; | 
|---|
|  | 206 | output.open(filename.str().c_str(), ios::out); | 
|---|
| [b12a35] | 207 | output << endl << "Total Energy" << endl << "==============" << endl << Energy.Header[Energy.MatrixCounter] << endl; | 
|---|
| [14de469] | 208 | for(int j=0;j<Energy.RowCounter[Energy.MatrixCounter];j++) { | 
|---|
| [f731ae] | 209 | for(int k=0;k<Energy.ColumnCounter[Energy.MatrixCounter];k++) | 
|---|
| [14de469] | 210 | output << scientific << Energy.Matrix[ Energy.MatrixCounter ][j][k] << "\t"; | 
|---|
|  | 211 | output << endl; | 
|---|
|  | 212 | } | 
|---|
|  | 213 | output << endl; | 
|---|
|  | 214 |  | 
|---|
| [b12a35] | 215 | output << endl << "Total Forces" << endl << "===============" << endl << Force.Header[Force.MatrixCounter] << endl; | 
|---|
| [14de469] | 216 | for(int j=0;j<Force.RowCounter[Force.MatrixCounter];j++) { | 
|---|
| [f731ae] | 217 | for(int k=0;k<Force.ColumnCounter[Force.MatrixCounter];k++) | 
|---|
| [14de469] | 218 | output << scientific << Force.Matrix[ Force.MatrixCounter ][j][k] << "\t"; | 
|---|
|  | 219 | output << endl; | 
|---|
|  | 220 | } | 
|---|
|  | 221 | output << endl; | 
|---|
|  | 222 |  | 
|---|
| [b12a35] | 223 | if (!NoHessian) { | 
|---|
|  | 224 | output << endl << "Total Hessian" << endl << "===============" << endl << Hessian.Header[Hessian.MatrixCounter] << endl; | 
|---|
|  | 225 | for(int j=0;j<Hessian.RowCounter[Hessian.MatrixCounter];j++) { | 
|---|
|  | 226 | for(int k=0;k<Hessian.ColumnCounter[Hessian.MatrixCounter];k++) | 
|---|
|  | 227 | output << scientific << Hessian.Matrix[ Hessian.MatrixCounter ][j][k] << "\t"; | 
|---|
|  | 228 | output << endl; | 
|---|
|  | 229 | } | 
|---|
|  | 230 | output << endl; | 
|---|
|  | 231 | } | 
|---|
|  | 232 |  | 
|---|
| [68cb0f] | 233 | if (periode != NULL) { // also look for PAS values | 
|---|
| [b12a35] | 234 | output << endl << "Total Shieldings" << endl << "===============" << endl << Shielding.Header[Hessian.MatrixCounter] << endl; | 
|---|
| [68cb0f] | 235 | for(int j=0;j<Shielding.RowCounter[Shielding.MatrixCounter];j++) { | 
|---|
| [f731ae] | 236 | for(int k=0;k<Shielding.ColumnCounter[Shielding.MatrixCounter];k++) | 
|---|
| [68cb0f] | 237 | output << scientific << Shielding.Matrix[ Shielding.MatrixCounter ][j][k] << "\t"; | 
|---|
|  | 238 | output << endl; | 
|---|
|  | 239 | } | 
|---|
|  | 240 | output << endl; | 
|---|
|  | 241 |  | 
|---|
| [b12a35] | 242 | output << endl << "Total Shieldings PAS" << endl << "===============" << endl << ShieldingPAS.Header[ShieldingPAS.MatrixCounter] << endl; | 
|---|
| [68cb0f] | 243 | for(int j=0;j<ShieldingPAS.RowCounter[ShieldingPAS.MatrixCounter];j++) { | 
|---|
| [f731ae] | 244 | for(int k=0;k<ShieldingPAS.ColumnCounter[ShieldingPAS.MatrixCounter];k++) | 
|---|
| [68cb0f] | 245 | output << scientific << ShieldingPAS.Matrix[ ShieldingPAS.MatrixCounter ][j][k] << "\t"; | 
|---|
|  | 246 | output << endl; | 
|---|
|  | 247 | } | 
|---|
|  | 248 | output << endl; | 
|---|
| [674220] | 249 |  | 
|---|
| [5bc4d0] | 250 | output << endl << "Total Chis" << endl << "===============" << endl << Chi.Header[Chi.MatrixCounter] << endl; | 
|---|
| [674220] | 251 | for(int j=0;j<Chi.RowCounter[Chi.MatrixCounter];j++) { | 
|---|
| [631dcb] | 252 | for(int k=0;k<Chi.ColumnCounter[Chi.MatrixCounter];k++) | 
|---|
| [674220] | 253 | output << scientific << Chi.Matrix[ Chi.MatrixCounter ][j][k] << "\t"; | 
|---|
|  | 254 | output << endl; | 
|---|
|  | 255 | } | 
|---|
|  | 256 | output << endl; | 
|---|
|  | 257 |  | 
|---|
|  | 258 | output << endl << "Total Chis PAS" << endl << "===============" << endl << ChiPAS.Header[ChiPAS.MatrixCounter] << endl; | 
|---|
|  | 259 | for(int j=0;j<ChiPAS.RowCounter[ChiPAS.MatrixCounter];j++) { | 
|---|
| [234af2] | 260 | for(int k=0;k<ChiPAS.ColumnCounter[ChiPAS.MatrixCounter];k++) | 
|---|
| [674220] | 261 | output << scientific << ChiPAS.Matrix[ ChiPAS.MatrixCounter ][j][k] << "\t"; | 
|---|
|  | 262 | output << endl; | 
|---|
|  | 263 | } | 
|---|
|  | 264 | output << endl; | 
|---|
| [68cb0f] | 265 | } | 
|---|
|  | 266 |  | 
|---|
| [b12a35] | 267 | if (!NoTime) { | 
|---|
|  | 268 | output << endl << "Total Times" << endl << "===============" << endl << Time.Header[Time.MatrixCounter] << endl; | 
|---|
|  | 269 | for(int j=0;j<Time.RowCounter[Time.MatrixCounter];j++) { | 
|---|
|  | 270 | for(int k=0;k<Time.ColumnCounter[Time.MatrixCounter];k++) { | 
|---|
|  | 271 | output << scientific << Time.Matrix[ Time.MatrixCounter ][j][k] << "\t"; | 
|---|
|  | 272 | } | 
|---|
|  | 273 | output << endl; | 
|---|
| [f05407] | 274 | } | 
|---|
| [b4b7c3] | 275 | output << endl; | 
|---|
|  | 276 | } | 
|---|
| [14de469] | 277 | output.close(); | 
|---|
| [b12a35] | 278 | if (!NoTime) | 
|---|
|  | 279 | for(int k=0;k<Time.ColumnCounter[Time.MatrixCounter];k++) | 
|---|
|  | 280 | Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter] ][k] = Time.Matrix[ Time.MatrixCounter ][Time.RowCounter[Time.MatrixCounter]-1][k]; | 
|---|
| [14de469] | 281 |  | 
|---|
|  | 282 | // +++++++++++++++ ANALYZING ++++++++++++++++++++++++++++++ | 
|---|
| [437922] | 283 |  | 
|---|
| [47d041] | 284 | LOG(0, "Analyzing ..."); | 
|---|
| [14de469] | 285 |  | 
|---|
|  | 286 | // ======================================= Creating the data files ============================================================== | 
|---|
|  | 287 |  | 
|---|
| [b4b7c3] | 288 | // +++++++++++++++++++++++++++++++++++++++ Plotting Simtime vs Bond Order | 
|---|
| [f05407] | 289 | // +++++++++++++++++++++++++++++++++++++++ Plotting Delta Simtime vs Bond Order | 
|---|
| [b12a35] | 290 | if (!NoTime) { | 
|---|
|  | 291 | if (!OpenOutputFile(output, argv[3], "SimTime-Order.dat" )) return false; | 
|---|
|  | 292 | if (!OpenOutputFile(output2, argv[3], "DeltaSimTime-Order.dat" )) return false; | 
|---|
|  | 293 | for(int j=Time.RowCounter[Time.MatrixCounter];j--;) | 
|---|
|  | 294 | for(int k=Time.ColumnCounter[Time.MatrixCounter];k--;) { | 
|---|
|  | 295 | Time.Matrix[ Time.MatrixCounter ][j][k] = 0.; | 
|---|
|  | 296 | } | 
|---|
|  | 297 | counter = 0; | 
|---|
|  | 298 | output << "#Order\tFrag.No.\t" << Time.Header[Time.MatrixCounter] << endl; | 
|---|
|  | 299 | output2 << "#Order\tFrag.No.\t" << Time.Header[Time.MatrixCounter] << endl; | 
|---|
|  | 300 | for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) { | 
|---|
|  | 301 | for(int i=KeySet.FragmentsPerOrder[BondOrder];i--;) | 
|---|
|  | 302 | for(int j=Time.RowCounter[Time.MatrixCounter];j--;) | 
|---|
|  | 303 | for(int k=Time.ColumnCounter[Time.MatrixCounter];k--;) { | 
|---|
|  | 304 | Time.Matrix[ Time.MatrixCounter ][j][k] += Time.Matrix[ KeySet.OrderSet[BondOrder][i] ][j][k]; | 
|---|
|  | 305 | } | 
|---|
|  | 306 | counter += KeySet.FragmentsPerOrder[BondOrder]; | 
|---|
|  | 307 | output << BondOrder+1 << "\t" << counter; | 
|---|
|  | 308 | output2 << BondOrder+1 << "\t" << counter; | 
|---|
|  | 309 | for(int k=0;k<Time.ColumnCounter[Time.MatrixCounter];k++) { | 
|---|
|  | 310 | output << "\t" << scientific << Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter]-1 ][k]; | 
|---|
|  | 311 | if (fabs(Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter] ][k]) > MYEPSILON) | 
|---|
|  | 312 | output2 << "\t" << scientific << Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter]-1 ][k] / Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter] ][k]; | 
|---|
|  | 313 | else | 
|---|
|  | 314 | output2 << "\t" << scientific << Time.Matrix[ Time.MatrixCounter ][ Time.RowCounter[Time.MatrixCounter]-1 ][k]; | 
|---|
|  | 315 | } | 
|---|
|  | 316 | output << endl; | 
|---|
|  | 317 | output2 << endl; | 
|---|
| [f05407] | 318 | } | 
|---|
| [b12a35] | 319 | output.close(); | 
|---|
|  | 320 | output2.close(); | 
|---|
|  | 321 | } | 
|---|
|  | 322 |  | 
|---|
|  | 323 | if (!NoHessian) { | 
|---|
|  | 324 | // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in hessian to full QM | 
|---|
|  | 325 | 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; | 
|---|
|  | 326 |  | 
|---|
| [72744a] | 327 | 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; | 
|---|
|  | 328 |  | 
|---|
| [b12a35] | 329 | // ++++++++++++++++++++++++++++++++++++++Plotting Hessian vs. Order | 
|---|
|  | 330 | if (!CreateDataHessianOrderPerAtom(HessianFragments, KeySet, argv[3], "Hessian_xx-Order", "Plot of approximated hessian versus the Bond Order", datum)) return 1; | 
|---|
|  | 331 | if (!AppendOutputFile(output, argv[3], "Hessian_xx-Order.dat" )) return false; | 
|---|
|  | 332 | output << endl << "# Full" << endl; | 
|---|
|  | 333 | for(int j=0;j<Hessian.RowCounter[Hessian.MatrixCounter];j++) { | 
|---|
|  | 334 | output << j << "\t"; | 
|---|
|  | 335 | for(int k=0;k<Hessian.ColumnCounter[Force.MatrixCounter];k++) | 
|---|
|  | 336 | output << scientific <<  Hessian.Matrix[ Hessian.MatrixCounter ][j][k] << "\t"; | 
|---|
|  | 337 | output << endl; | 
|---|
| [f05407] | 338 | } | 
|---|
| [b12a35] | 339 | output.close(); | 
|---|
| [b4b7c3] | 340 | } | 
|---|
| [f05407] | 341 |  | 
|---|
| [95634f] | 342 | // +++++++++++++++++++++++++++++++++++++++ Plotting shieldings | 
|---|
|  | 343 | if (periode != NULL) { // also look for PAS values | 
|---|
|  | 344 | 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; | 
|---|
|  | 345 | if (!CreateDataForcesOrderPerAtom(ShieldingPASFragments, KeySet, argv[3], "ShieldingsPAS-Order", "Plot of approximated shieldings versus the Bond Order", datum)) return 1; | 
|---|
|  | 346 | if (!AppendOutputFile(output, argv[3], "ShieldingsPAS-Order.dat" )) return false; | 
|---|
|  | 347 | output << endl << "# Full" << endl; | 
|---|
|  | 348 | for(int j=0;j<ShieldingPAS.RowCounter[ShieldingPAS.MatrixCounter];j++) { | 
|---|
|  | 349 | output << j << "\t"; | 
|---|
| [f731ae] | 350 | for(int k=0;k<ShieldingPAS.ColumnCounter[ShieldingPAS.MatrixCounter];k++) | 
|---|
| [95634f] | 351 | output << scientific <<  ShieldingPAS.Matrix[ ShieldingPAS.MatrixCounter ][j][k] << "\t"; //*(((k>1) && (k<6))? 1.e6 : 1.) << "\t"; | 
|---|
|  | 352 | output << endl; | 
|---|
|  | 353 | } | 
|---|
| [674220] | 354 | output.close(); | 
|---|
|  | 355 | 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; | 
|---|
|  | 356 | if (!CreateDataForcesOrderPerAtom(ChiPASFragments, KeySet, argv[3], "ChisPAS-Order", "Plot of approximated Chis versus the Bond Order", datum)) return 1; | 
|---|
|  | 357 | if (!AppendOutputFile(output, argv[3], "ChisPAS-Order.dat" )) return false; | 
|---|
|  | 358 | output << endl << "# Full" << endl; | 
|---|
|  | 359 | for(int j=0;j<ChiPAS.RowCounter[ChiPAS.MatrixCounter];j++) { | 
|---|
|  | 360 | output << j << "\t"; | 
|---|
| [631dcb] | 361 | for(int k=0;k<ChiPAS.ColumnCounter[ChiPAS.MatrixCounter];k++) | 
|---|
| [674220] | 362 | output << scientific <<  ChiPAS.Matrix[ ChiPAS.MatrixCounter ][j][k] << "\t"; //*(((k>1) && (k<6))? 1.e6 : 1.) << "\t"; | 
|---|
|  | 363 | output << endl; | 
|---|
|  | 364 | } | 
|---|
|  | 365 | output.close(); | 
|---|
| [95634f] | 366 | } | 
|---|
|  | 367 |  | 
|---|
| [437922] | 368 |  | 
|---|
| [14de469] | 369 | // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in energy to full QM | 
|---|
| [390248] | 370 | 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] | 371 |  | 
|---|
| [14de469] | 372 | // +++++++++++++++++++++++++++++++++++Plotting Energies vs. Order | 
|---|
| [390248] | 373 | if (!CreateDataEnergyOrder(EnergyFragments, KeySet, argv[3], "Energies-Order", "Plot of approximated energies versus the Bond Order", datum)) return 1; | 
|---|
| [437922] | 374 |  | 
|---|
| [14de469] | 375 | // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in forces to full QM | 
|---|
| [390248] | 376 | 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; | 
|---|
|  | 377 |  | 
|---|
|  | 378 | // min force | 
|---|
|  | 379 | 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; | 
|---|
|  | 380 |  | 
|---|
|  | 381 | // mean force | 
|---|
|  | 382 | 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; | 
|---|
|  | 383 |  | 
|---|
|  | 384 | // max force | 
|---|
|  | 385 | 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] | 386 |  | 
|---|
|  | 387 | // ++++++++++++++++++++++++++++++++++++++Plotting Forces vs. Order | 
|---|
| [390248] | 388 | if (!CreateDataForcesOrderPerAtom(ForceFragments, KeySet, argv[3], "Forces-Order", "Plot of approximated forces versus the Bond Order", datum)) return 1; | 
|---|
| [95634f] | 389 | if (!AppendOutputFile(output, argv[3], "Forces-Order.dat" )) return false; | 
|---|
|  | 390 | output << endl << "# Full" << endl; | 
|---|
|  | 391 | for(int j=0;j<Force.RowCounter[Force.MatrixCounter];j++) { | 
|---|
|  | 392 | output << j << "\t"; | 
|---|
| [f731ae] | 393 | for(int k=0;k<Force.ColumnCounter[Force.MatrixCounter];k++) | 
|---|
| [95634f] | 394 | output << scientific <<  Force.Matrix[ Force.MatrixCounter ][j][k] << "\t"; | 
|---|
|  | 395 | output << endl; | 
|---|
|  | 396 | } | 
|---|
|  | 397 | output.close(); | 
|---|
| [14de469] | 398 | // min force | 
|---|
| [390248] | 399 | if (!CreateDataForcesOrder(ForceFragments, KeySet, argv[3], "MinForces-Order", "Plot of min approximated forces versus the Bond Order", datum, CreateMinimumForce)) return 1; | 
|---|
| [14de469] | 400 |  | 
|---|
|  | 401 | // mean force | 
|---|
| [390248] | 402 | if (!CreateDataForcesOrder(ForceFragments, KeySet, argv[3], "MeanForces-Order", "Plot of mean approximated forces versus the Bond Order", datum, CreateMeanForce)) return 1; | 
|---|
| [14de469] | 403 |  | 
|---|
|  | 404 | // max force | 
|---|
| [390248] | 405 | if (!CreateDataForcesOrder(ForceFragments, KeySet, argv[3], "MaxForces-Order", "Plot of max approximated forces versus the Bond Order", datum, CreateMaximumForce)) return 1; | 
|---|
| [14de469] | 406 |  | 
|---|
|  | 407 | // ++++++++++++++++++++++++++++++++++++++Plotting vector sum (should be 0) vs. bond order | 
|---|
| [390248] | 408 | 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] | 409 |  | 
|---|
|  | 410 | // +++++++++++++++++++++++++++++++Plotting energyfragments vs. order | 
|---|
|  | 411 | if (!CreateDataFragment(EnergyFragments, KeySet, argv[3], "Energies-Fragment", "Plot of fragment energy versus the Fragment No", datum, CreateEnergy)) return 1; | 
|---|
|  | 412 | if (!CreateDataFragment(EnergyFragments, KeySet, argv[3], "Energies-FragmentOrder", "Plot of fragment energy of each Fragment No vs. Bond Order", datum, CreateEnergy)) return 1; | 
|---|
|  | 413 | if (!CreateDataFragmentOrder(EnergyFragments, KeySet, argv[3], "MaxEnergies-FragmentOrder", "Plot of maximum of fragment energy vs. Bond Order", datum, CreateMaxFragmentOrder)) return 1; | 
|---|
|  | 414 | if (!CreateDataFragmentOrder(EnergyFragments, KeySet, argv[3], "MinEnergies-FragmentOrder", "Plot of minimum of fragment energy vs. Bond Order", datum, CreateMinFragmentOrder)) return 1; | 
|---|
|  | 415 |  | 
|---|
|  | 416 | // +++++++++++++++++++++++++++++++Ploting min/mean/max forces for each fragment | 
|---|
|  | 417 | // min force | 
|---|
|  | 418 | if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MinForces-Fragment", "Plot of min approximated forces versus the Fragment No", datum, CreateMinimumForce)) return 1; | 
|---|
|  | 419 |  | 
|---|
|  | 420 | // mean force | 
|---|
|  | 421 | if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MeanForces-Fragment", "Plot of mean approximated forces versus the Fragment No", datum, CreateMeanForce)) return 1; | 
|---|
|  | 422 |  | 
|---|
|  | 423 | // max force | 
|---|
|  | 424 | if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MaxForces-Fragment", "Plot of max approximated forces versus the Fragment No", datum, CreateMaximumForce)) return 1; | 
|---|
|  | 425 |  | 
|---|
|  | 426 | // +++++++++++++++++++++++++++++++Ploting min/mean/max forces for each fragment per order | 
|---|
|  | 427 | // min force | 
|---|
|  | 428 | if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MinForces-FragmentOrder", "Plot of min approximated forces of each Fragment No vs. Bond Order", datum, CreateMinimumForce)) return 1; | 
|---|
|  | 429 |  | 
|---|
|  | 430 | // mean force | 
|---|
|  | 431 | if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MeanForces-FragmentOrder", "Plot of mean approximated forces of each Fragment No vs. Bond Order", datum, CreateMeanForce)) return 1; | 
|---|
|  | 432 |  | 
|---|
|  | 433 | // max force | 
|---|
|  | 434 | if (!CreateDataFragment(ForceFragments, KeySet, argv[3], "MaxForces-FragmentOrder", "Plot of max approximated forces of each Fragment No vs. Bond Order", datum, CreateMaximumForce)) return 1; | 
|---|
|  | 435 |  | 
|---|
|  | 436 | // ======================================= Creating the plot files ============================================================== | 
|---|
| [437922] | 437 |  | 
|---|
| [14de469] | 438 | Orderxrange << "[1:" << KeySet.Order << "]"; | 
|---|
|  | 439 | Fragmentxrange << "[0:" << KeySet.FragmentCounter+1 << "]"; | 
|---|
| [390248] | 440 | yrange.str("[1e-8:1e+1]"); | 
|---|
| [14de469] | 441 |  | 
|---|
| [b12a35] | 442 | if (!NoTime) { | 
|---|
|  | 443 | // +++++++++++++++++++++++++++++++++++++++ Plotting Simtime vs Bond Order | 
|---|
|  | 444 | 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; | 
|---|
|  | 445 | } | 
|---|
| [14de469] | 446 |  | 
|---|
|  | 447 | // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in energy to full QM | 
|---|
| [390248] | 448 | 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] | 449 |  | 
|---|
| [14de469] | 450 | // +++++++++++++++++++++++++++++++++++Plotting Energies vs. Order | 
|---|
|  | 451 | 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; | 
|---|
|  | 452 |  | 
|---|
|  | 453 | // +++++++++++++++++++++++++++++++++++++++ Plotting deviation in forces to full QM | 
|---|
| [390248] | 454 | yrange.str("[1e-8:1e+0]"); | 
|---|
| [14de469] | 455 | // min force | 
|---|
| [390248] | 456 | 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] | 457 |  | 
|---|
|  | 458 | // mean force | 
|---|
| [390248] | 459 | 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] | 460 |  | 
|---|
|  | 461 | // max force | 
|---|
| [390248] | 462 | 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] | 463 |  | 
|---|
|  | 464 | // min/mean/max comparison for total force | 
|---|
|  | 465 | if(!OpenOutputFile(output, argv[3], "DeltaMinMeanMaxTotalForce-Order.pyx")) return 1; | 
|---|
| [fa40b5] | 466 | CreatePlotHeader(output, "DeltaMinMeanMaxTotalForce-Order", 1, "bottom left", "y", NULL,  1, 1, "bond order k", "absolute error in total forces [Ht/a.u.]"); | 
|---|
| [437922] | 467 | output << "plot " << Orderxrange.str().c_str() << " [1e-8:1e+0] \\" << endl; | 
|---|
| [14de469] | 468 | output << "'DeltaMinForces-Order.dat' title 'minimum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints, \\" << endl; | 
|---|
|  | 469 | output << "'DeltaMeanForces-Order.dat' title 'mean' using 1:(abs($" << 8 << ")) with linespoints, \\" << endl; | 
|---|
|  | 470 | output << "'DeltaMaxForces-Order.dat' title 'maximum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints" << endl; | 
|---|
| [437922] | 471 | output.close(); | 
|---|
| [14de469] | 472 |  | 
|---|
|  | 473 | // ++++++++++++++++++++++++++++++++++++++Plotting Forces vs. Order | 
|---|
|  | 474 | // min force | 
|---|
|  | 475 | 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; | 
|---|
|  | 476 |  | 
|---|
|  | 477 | // mean force | 
|---|
|  | 478 | 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; | 
|---|
|  | 479 |  | 
|---|
|  | 480 | // max force | 
|---|
|  | 481 | 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; | 
|---|
|  | 482 |  | 
|---|
|  | 483 | // min/mean/max comparison for total force | 
|---|
|  | 484 | if(!OpenOutputFile(output, argv[3],"MinMeanMaxTotalForce-Order.pyx")) return 1; | 
|---|
| [fa40b5] | 485 | CreatePlotHeader(output, "MinMeanMaxTotalForce-Order", 1, "bottom left", "y", NULL, 1, 1, "bond order k", "absolute total force [Ht/a.u.]"); | 
|---|
| [437922] | 486 | output << "plot "<< Orderxrange.str().c_str() << " [1e-8:1e+0] \\" << endl; | 
|---|
| [14de469] | 487 | output << "'MinForces-Order.dat' title 'minimum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints, \\" << endl; | 
|---|
|  | 488 | output << "'MeanForces-Order.dat' title 'mean' using 1:(abs($" << 8 << ")) with linespoints, \\" << endl; | 
|---|
|  | 489 | output << "'MaxForces-Order.dat' title 'maximum' using 1:(sqrt($" << 8 << "*$" << 8 << "+$" << 8+1 << "*$" << 8+1 << "+$" << 8+2 << "*$" << 8+2 << ")) with linespoints" << endl; | 
|---|
| [437922] | 490 | output.close(); | 
|---|
| [14de469] | 491 |  | 
|---|
|  | 492 | // ++++++++++++++++++++++++++++++++++++++Plotting vector sum vs. Order | 
|---|
|  | 493 |  | 
|---|
|  | 494 | 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; | 
|---|
|  | 495 |  | 
|---|
|  | 496 | // +++++++++++++++++++++++++++++++Plotting energyfragments vs. order | 
|---|
| [390248] | 497 | yrange.str(""); | 
|---|
|  | 498 | yrange << "[" << EnergyFragments.FindMinValue() << ":" << EnergyFragments.FindMaxValue() << "]"; | 
|---|
|  | 499 | 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; | 
|---|
|  | 500 | 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; | 
|---|
|  | 501 | 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; | 
|---|
|  | 502 | 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] | 503 |  | 
|---|
|  | 504 | // +++++++++++++++++++++++++++++++=Ploting min/mean/max forces for each fragment | 
|---|
| [390248] | 505 | yrange.str(""); | 
|---|
|  | 506 | yrange << "[" << ForceFragments.FindMinValue() << ":" << ForceFragments.FindMaxValue()<< "]"; | 
|---|
| [14de469] | 507 | // min | 
|---|
| [390248] | 508 | 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] | 509 |  | 
|---|
| [14de469] | 510 | // mean | 
|---|
| [390248] | 511 | 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] | 512 |  | 
|---|
| [14de469] | 513 | // max | 
|---|
| [390248] | 514 | 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] | 515 |  | 
|---|
|  | 516 | // +++++++++++++++++++++++++++++++=Ploting min/mean/max forces for each fragment per bond order | 
|---|
|  | 517 | // min | 
|---|
| [390248] | 518 | 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] | 519 |  | 
|---|
| [14de469] | 520 | // mean | 
|---|
| [390248] | 521 | 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] | 522 |  | 
|---|
| [14de469] | 523 | // max | 
|---|
| [390248] | 524 | 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] | 525 |  | 
|---|
| [95634f] | 526 | // +++++++++++++++++++++++++++++++=Ploting approximated and true shielding for each atom | 
|---|
|  | 527 | if (periode != NULL) { // also look for PAS values | 
|---|
|  | 528 | if(!OpenOutputFile(output, argv[3], "ShieldingsPAS-Order.pyx")) return 1; | 
|---|
| [4ee3df] | 529 | if(!OpenOutputFile(output2, argv[3], "DeltaShieldingsPAS-Order.pyx")) return 1; | 
|---|
| [95634f] | 530 | CreatePlotHeader(output, "ShieldingsPAS-Order", 1, "top right", NULL, NULL,  1, 5, "nuclei index", "iso chemical shielding value [ppm]"); | 
|---|
| [4ee3df] | 531 | CreatePlotHeader(output2, "DeltaShieldingsPAS-Order", 1, "top right", NULL, NULL,  1, 5, "nuclei index", "iso chemical shielding value [ppm]"); | 
|---|
| [95634f] | 532 | double step=0.8/KeySet.Order; | 
|---|
|  | 533 | output << "set boxwidth " << step << endl; | 
|---|
|  | 534 | output << "plot [0:" << ShieldingPAS.RowCounter[ShieldingPAS.MatrixCounter]+10 << "]\\" << endl; | 
|---|
| [4ee3df] | 535 | output2 << "plot [0:" << ShieldingPAS.RowCounter[ShieldingPAS.MatrixCounter]+10 << "]\\" << endl; | 
|---|
| [95634f] | 536 | for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) { | 
|---|
|  | 537 | output << "'ShieldingsPAS-Order.dat' index " << BondOrder << " title 'Order " << BondOrder+1 << "' using ($1+" << step*(double)BondOrder << "):7 with boxes, \\" << endl; | 
|---|
| [4ee3df] | 538 | output2 << "'DeltaShieldingsPAS-Order.dat' index " << BondOrder << " title 'Order " << BondOrder+1 << "' using ($1):7 with linespoints"; | 
|---|
|  | 539 | if (BondOrder-1 != KeySet.Order) | 
|---|
|  | 540 | output2 << ", \\" << endl; | 
|---|
| [95634f] | 541 | } | 
|---|
|  | 542 | output << "'ShieldingsPAS-Order.dat' index " << KeySet.Order << " title 'Full' using ($1+" << step*(double)KeySet.Order << "):7 with boxes" << endl; | 
|---|
| [4ee3df] | 543 | output2.close(); | 
|---|
| [674220] | 544 |  | 
|---|
|  | 545 | if(!OpenOutputFile(output, argv[3], "ChisPAS-Order.pyx")) return 1; | 
|---|
|  | 546 | if(!OpenOutputFile(output2, argv[3], "DeltaChisPAS-Order.pyx")) return 1; | 
|---|
|  | 547 | CreatePlotHeader(output, "ChisPAS-Order", 1, "top right", NULL, NULL,  1, 5, "nuclei index", "iso chemical Chi value [ppm]"); | 
|---|
|  | 548 | CreatePlotHeader(output2, "DeltaChisPAS-Order", 1, "top right", NULL, NULL,  1, 5, "nuclei index", "iso chemical Chi value [ppm]"); | 
|---|
|  | 549 | output << "set boxwidth " << step << endl; | 
|---|
|  | 550 | output << "plot [0:" << ChiPAS.RowCounter[ChiPAS.MatrixCounter]+10 << "]\\" << endl; | 
|---|
|  | 551 | output2 << "plot [0:" << ChiPAS.RowCounter[ChiPAS.MatrixCounter]+10 << "]\\" << endl; | 
|---|
|  | 552 | for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) { | 
|---|
|  | 553 | output << "'ChisPAS-Order.dat' index " << BondOrder << " title 'Order " << BondOrder+1 << "' using ($1+" << step*(double)BondOrder << "):7 with boxes, \\" << endl; | 
|---|
|  | 554 | output2 << "'DeltaChisPAS-Order.dat' index " << BondOrder << " title 'Order " << BondOrder+1 << "' using ($1):7 with linespoints"; | 
|---|
| [71e7c7] | 555 | if (BondOrder-1 != KeySet.Order) | 
|---|
|  | 556 | output2 << ", \\" << endl; | 
|---|
|  | 557 | } | 
|---|
|  | 558 | output << "'ChisPAS-Order.dat' index " << KeySet.Order << " title 'Full' using ($1+" << step*(double)KeySet.Order << "):7 with boxes" << endl; | 
|---|
| [95634f] | 559 | output.close(); | 
|---|
| [4ee3df] | 560 | output2.close(); | 
|---|
| [234af2] | 561 |  | 
|---|
|  | 562 | if(!OpenOutputFile(output, argv[3], "ChisPAS-Order.pyx")) return 1; | 
|---|
|  | 563 | if(!OpenOutputFile(output2, argv[3], "DeltaChisPAS-Order.pyx")) return 1; | 
|---|
|  | 564 | CreatePlotHeader(output, "ChisPAS-Order", 1, "top right", NULL, NULL,  1, 5, "nuclei index", "iso chemical Chi value [ppm]"); | 
|---|
|  | 565 | CreatePlotHeader(output2, "DeltaChisPAS-Order", 1, "top right", NULL, NULL,  1, 5, "nuclei index", "iso chemical Chi value [ppm]"); | 
|---|
|  | 566 | output << "set boxwidth " << step << endl; | 
|---|
|  | 567 | output << "plot [0:" << ChiPAS.RowCounter[ChiPAS.MatrixCounter]+10 << "]\\" << endl; | 
|---|
|  | 568 | output2 << "plot [0:" << ChiPAS.RowCounter[ChiPAS.MatrixCounter]+10 << "]\\" << endl; | 
|---|
|  | 569 | for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) { | 
|---|
|  | 570 | output << "'ChisPAS-Order.dat' index " << BondOrder << " title 'Order " << BondOrder+1 << "' using ($1+" << step*(double)BondOrder << "):7 with boxes, \\" << endl; | 
|---|
|  | 571 | output2 << "'DeltaChisPAS-Order.dat' index " << BondOrder << " title 'Order " << BondOrder+1 << "' using ($1):7 with linespoints"; | 
|---|
| [674220] | 572 | if (BondOrder-1 != KeySet.Order) | 
|---|
|  | 573 | output2 << ", \\" << endl; | 
|---|
|  | 574 | } | 
|---|
|  | 575 | output << "'ChisPAS-Order.dat' index " << KeySet.Order << " title 'Full' using ($1+" << step*(double)KeySet.Order << "):7 with boxes" << endl; | 
|---|
|  | 576 | output.close(); | 
|---|
|  | 577 | output2.close(); | 
|---|
| [95634f] | 578 | } | 
|---|
|  | 579 |  | 
|---|
| [14de469] | 580 | // create Makefile | 
|---|
|  | 581 | if(!OpenOutputFile(output, argv[3], "Makefile")) return 1; | 
|---|
|  | 582 | output << "PYX = $(shell ls *.pyx)" << endl << endl; | 
|---|
|  | 583 | output << "EPS = $(PYX:.pyx=.eps)" << endl << endl; | 
|---|
|  | 584 | output << "%.eps: %.pyx" << endl; | 
|---|
|  | 585 | output << "\t~/build/pyxplot/pyxplot $<" << endl << endl; | 
|---|
|  | 586 | output << "all: $(EPS)" << endl << endl; | 
|---|
|  | 587 | output << ".PHONY: clean" << endl; | 
|---|
|  | 588 | output << "clean:" << endl; | 
|---|
|  | 589 | output << "\trm -rf $(EPS)" << endl; | 
|---|
|  | 590 | output.close(); | 
|---|
| [437922] | 591 |  | 
|---|
| [68cb0f] | 592 | // ++++++++++++++++ exit ++++++++++++++++++++++++++++++++++ | 
|---|
|  | 593 | delete(periode); | 
|---|
| [920c70] | 594 | delete[](dir); | 
|---|
| [47d041] | 595 | LOG(0, "done."); | 
|---|
| [14de469] | 596 | return 0; | 
|---|
|  | 597 | }; | 
|---|
|  | 598 |  | 
|---|
|  | 599 | //============================ END =========================== | 
|---|