| [bcf653] | 1 | /*
 | 
|---|
 | 2 |  * Project: MoleCuilder
 | 
|---|
 | 3 |  * Description: creates and alters molecular systems
 | 
|---|
 | 4 |  * Copyright (C)  2010 University of Bonn. All rights reserved.
 | 
|---|
 | 5 |  * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
 | 
|---|
 | 6 |  */
 | 
|---|
 | 7 | 
 | 
|---|
| [c4d4df] | 8 | /*
 | 
|---|
 | 9 |  * analysis.cpp
 | 
|---|
 | 10 |  *
 | 
|---|
 | 11 |  *  Created on: Oct 13, 2009
 | 
|---|
 | 12 |  *      Author: heber
 | 
|---|
 | 13 |  */
 | 
|---|
 | 14 | 
 | 
|---|
| [bf3817] | 15 | // include config.h
 | 
|---|
 | 16 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 17 | #include <config.h>
 | 
|---|
 | 18 | #endif
 | 
|---|
 | 19 | 
 | 
|---|
| [ad011c] | 20 | #include "CodePatterns/MemDebug.hpp"
 | 
|---|
| [112b09] | 21 | 
 | 
|---|
| [c4d4df] | 22 | #include <iostream>
 | 
|---|
| [36166d] | 23 | #include <iomanip>
 | 
|---|
| [c4d4df] | 24 | 
 | 
|---|
| [be945c] | 25 | #include "atom.hpp"
 | 
|---|
 | 26 | #include "bond.hpp"
 | 
|---|
| [d74077] | 27 | #include "BoundaryTriangleSet.hpp"
 | 
|---|
| [be945c] | 28 | #include "Box.hpp"
 | 
|---|
| [c4d4df] | 29 | #include "element.hpp"
 | 
|---|
| [ad011c] | 30 | #include "CodePatterns/Info.hpp"
 | 
|---|
 | 31 | #include "CodePatterns/Log.hpp"
 | 
|---|
| [ea430a] | 32 | #include "Formula.hpp"
 | 
|---|
| [c4d4df] | 33 | #include "molecule.hpp"
 | 
|---|
 | 34 | #include "tesselation.hpp"
 | 
|---|
 | 35 | #include "tesselationhelpers.hpp"
 | 
|---|
| [8db598] | 36 | #include "triangleintersectionlist.hpp"
 | 
|---|
| [be945c] | 37 | #include "World.hpp"
 | 
|---|
| [57f243] | 38 | #include "LinearAlgebra/Vector.hpp"
 | 
|---|
| [cca9ef] | 39 | #include "LinearAlgebra/RealSpaceMatrix.hpp"
 | 
|---|
| [ad011c] | 40 | #include "CodePatterns/Verbose.hpp"
 | 
|---|
| [b34306] | 41 | #include "World.hpp"
 | 
|---|
| [84c494] | 42 | #include "Box.hpp"
 | 
|---|
| [c4d4df] | 43 | 
 | 
|---|
| [be945c] | 44 | #include "analysis_correlation.hpp"
 | 
|---|
 | 45 | 
 | 
|---|
 | 46 | /** Calculates the dipole vector of a given atomSet.
 | 
|---|
 | 47 |  *
 | 
|---|
 | 48 |  *  Note that we use the following procedure as rule of thumb:
 | 
|---|
 | 49 |  *   -# go through every bond of the atom
 | 
|---|
 | 50 |  *   -# calculate the difference of electronegativities \f$\Delta\text{EN}\f$
 | 
|---|
 | 51 |  *   -# if \f$\Delta\text{EN} > 0.5\f$, we align the bond vector in direction of the more negative element
 | 
|---|
 | 52 |  *   -# sum up all vectors
 | 
|---|
 | 53 |  *   -# finally, divide by the number of summed vectors
 | 
|---|
 | 54 |  *
 | 
|---|
 | 55 |  * @param atomsbegin begin iterator of atomSet
 | 
|---|
 | 56 |  * @param atomsend end iterator of atomset
 | 
|---|
 | 57 |  * @return dipole vector
 | 
|---|
 | 58 |  */
 | 
|---|
 | 59 | Vector getDipole(molecule::const_iterator atomsbegin, molecule::const_iterator atomsend)
 | 
|---|
 | 60 | {
 | 
|---|
 | 61 |   Vector DipoleVector;
 | 
|---|
 | 62 |   size_t SumOfVectors = 0;
 | 
|---|
 | 63 |   // go through all atoms
 | 
|---|
 | 64 |   for (molecule::const_iterator atomiter = atomsbegin;
 | 
|---|
 | 65 |       atomiter != atomsend;
 | 
|---|
 | 66 |       ++atomiter) {
 | 
|---|
 | 67 |     // go through all bonds
 | 
|---|
 | 68 |     for (BondList::const_iterator bonditer = (*atomiter)->ListOfBonds.begin();
 | 
|---|
 | 69 |         bonditer != (*atomiter)->ListOfBonds.end();
 | 
|---|
 | 70 |         ++bonditer) {
 | 
|---|
 | 71 |       const atom * Otheratom = (*bonditer)->GetOtherAtom(*atomiter);
 | 
|---|
 | 72 |       if (Otheratom->getId() > (*atomiter)->getId()) {
 | 
|---|
 | 73 |         const double DeltaEN = (*atomiter)->getType()->getElectronegativity()
 | 
|---|
 | 74 |             -Otheratom->getType()->getElectronegativity();
 | 
|---|
 | 75 |         Vector BondDipoleVector = (*atomiter)->getPosition() - Otheratom->getPosition();
 | 
|---|
 | 76 |         // DeltaEN is always positive, gives correct orientation of vector
 | 
|---|
 | 77 |         BondDipoleVector.Normalize();
 | 
|---|
 | 78 |         BondDipoleVector *= DeltaEN;
 | 
|---|
 | 79 |         DipoleVector += BondDipoleVector;
 | 
|---|
 | 80 |         SumOfVectors++;
 | 
|---|
 | 81 |       }
 | 
|---|
 | 82 |     }
 | 
|---|
 | 83 |   }
 | 
|---|
 | 84 |   DipoleVector *= 1./(double)SumOfVectors;
 | 
|---|
 | 85 |   DoLog(1) && (Log() << Verbose(1) << "Resulting dipole vector is " << DipoleVector << std::endl);
 | 
|---|
 | 86 | 
 | 
|---|
 | 87 |   return DipoleVector;
 | 
|---|
 | 88 | };
 | 
|---|
 | 89 | 
 | 
|---|
| [ea430a] | 90 | /** Calculates the dipole angular correlation for given molecule type.
 | 
|---|
 | 91 |  * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si))
 | 
|---|
| [be945c] | 92 |  * Angles are given in degrees.
 | 
|---|
| [ea430a] | 93 |  * \param *molecules vector of molecules
 | 
|---|
 | 94 |  * \return Map of doubles with values the pair of the two atoms.
 | 
|---|
 | 95 |  */
 | 
|---|
| [be945c] | 96 | DipoleAngularCorrelationMap *DipoleAngularCorrelation(std::vector<molecule *> &molecules)
 | 
|---|
| [ea430a] | 97 | {
 | 
|---|
 | 98 |   Info FunctionInfo(__func__);
 | 
|---|
| [caa30b] | 99 |   DipoleAngularCorrelationMap *outmap = new DipoleAngularCorrelationMap;
 | 
|---|
| [ea430a] | 100 | //  double distance = 0.;
 | 
|---|
 | 101 | //  Box &domain = World::getInstance().getDomain();
 | 
|---|
 | 102 | //
 | 
|---|
| [be945c] | 103 |   if (molecules.empty()) {
 | 
|---|
 | 104 |     DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl);
 | 
|---|
 | 105 |     return outmap;
 | 
|---|
 | 106 |   }
 | 
|---|
 | 107 | 
 | 
|---|
 | 108 |   outmap = new DipoleAngularCorrelationMap;
 | 
|---|
 | 109 |   for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin();
 | 
|---|
| [92e5cb] | 110 |       MolWalker != molecules.end(); ++MolWalker) {
 | 
|---|
| [be945c] | 111 |     DoLog(2) && (Log()<< Verbose(2) << "Current molecule is "
 | 
|---|
 | 112 |         << (*MolWalker)->getId() << "." << endl);
 | 
|---|
 | 113 |     const Vector Dipole = getDipole((*MolWalker)->begin(), (*MolWalker)->end());
 | 
|---|
| [92e5cb] | 114 |     std::vector<molecule *>::const_iterator MolOtherWalker = MolWalker;
 | 
|---|
 | 115 |     for (++MolOtherWalker;
 | 
|---|
| [be945c] | 116 |         MolOtherWalker != molecules.end();
 | 
|---|
| [92e5cb] | 117 |         ++MolOtherWalker) {
 | 
|---|
| [be945c] | 118 |       DoLog(2) && (Log() << Verbose(2) << "Current other molecule is "
 | 
|---|
 | 119 |           << (*MolOtherWalker)->getId() << "." << endl);
 | 
|---|
 | 120 |       const Vector OtherDipole = getDipole((*MolOtherWalker)->begin(), (*MolOtherWalker)->end());
 | 
|---|
 | 121 |       const double angle = Dipole.Angle(OtherDipole) * (180./M_PI);
 | 
|---|
 | 122 |       DoLog(1) && (Log() << Verbose(1) << "Angle is " << angle << "." << endl);
 | 
|---|
 | 123 |       outmap->insert ( make_pair (angle, make_pair ((*MolWalker), (*MolOtherWalker)) ) );
 | 
|---|
 | 124 |     }
 | 
|---|
 | 125 |   }
 | 
|---|
| [ea430a] | 126 |   return outmap;
 | 
|---|
 | 127 | };
 | 
|---|
 | 128 | 
 | 
|---|
| [c4d4df] | 129 | 
 | 
|---|
 | 130 | /** Calculates the pair correlation between given elements.
 | 
|---|
 | 131 |  * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si))
 | 
|---|
| [e65de8] | 132 |  * \param *molecules vector of molecules
 | 
|---|
| [c78d44] | 133 |  * \param &elements vector of elements to correlate
 | 
|---|
| [c4d4df] | 134 |  * \return Map of doubles with values the pair of the two atoms.
 | 
|---|
 | 135 |  */
 | 
|---|
| [e5c0a1] | 136 | PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector<const element *> &elements)
 | 
|---|
| [c4d4df] | 137 | {
 | 
|---|
| [3930eb] | 138 |   Info FunctionInfo(__func__);
 | 
|---|
| [caa30b] | 139 |   PairCorrelationMap *outmap = new PairCorrelationMap;
 | 
|---|
| [c4d4df] | 140 |   double distance = 0.;
 | 
|---|
| [014475] | 141 |   Box &domain = World::getInstance().getDomain();
 | 
|---|
| [c4d4df] | 142 | 
 | 
|---|
| [e65de8] | 143 |   if (molecules.empty()) {
 | 
|---|
| [58ed4a] | 144 |     DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl);
 | 
|---|
| [c4d4df] | 145 |     return outmap;
 | 
|---|
 | 146 |   }
 | 
|---|
| [e65de8] | 147 |   for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
 | 
|---|
| [009607e] | 148 |     (*MolWalker)->doCountAtoms();
 | 
|---|
| [c78d44] | 149 | 
 | 
|---|
 | 150 |   // create all possible pairs of elements
 | 
|---|
| [e5c0a1] | 151 |   set <pair<const element *,const element *> > PairsOfElements;
 | 
|---|
| [c78d44] | 152 |   if (elements.size() >= 2) {
 | 
|---|
| [e5c0a1] | 153 |     for (vector<const element *>::const_iterator type1 = elements.begin(); type1 != elements.end(); ++type1)
 | 
|---|
 | 154 |       for (vector<const element *>::const_iterator type2 = elements.begin(); type2 != elements.end(); ++type2)
 | 
|---|
| [c78d44] | 155 |         if (type1 != type2) {
 | 
|---|
| [e5c0a1] | 156 |           PairsOfElements.insert( make_pair(*type1,*type2) );
 | 
|---|
| [2fe971] | 157 |           DoLog(1) && (Log() << Verbose(1) << "Creating element pair " << *(*type1) << " and " << *(*type2) << "." << endl);
 | 
|---|
| [c78d44] | 158 |         }
 | 
|---|
 | 159 |   } else if (elements.size() == 1) { // one to all are valid
 | 
|---|
| [e5c0a1] | 160 |     const element *elemental = *elements.begin();
 | 
|---|
 | 161 |     PairsOfElements.insert( pair<const element *,const element*>(elemental,0) );
 | 
|---|
 | 162 |     PairsOfElements.insert( pair<const element *,const element*>(0,elemental) );
 | 
|---|
| [c78d44] | 163 |   } else { // all elements valid
 | 
|---|
 | 164 |     PairsOfElements.insert( pair<element *, element*>((element *)NULL, (element *)NULL) );
 | 
|---|
 | 165 |   }
 | 
|---|
 | 166 | 
 | 
|---|
| [c4d4df] | 167 |   outmap = new PairCorrelationMap;
 | 
|---|
| [e65de8] | 168 |   for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++){
 | 
|---|
 | 169 |     DoLog(2) && (Log()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
 | 
|---|
 | 170 |     for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
 | 
|---|
 | 171 |       DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
 | 
|---|
 | 172 |       for (std::vector<molecule *>::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules.end(); MolOtherWalker++){
 | 
|---|
 | 173 |         DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl);
 | 
|---|
 | 174 |         for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) {
 | 
|---|
 | 175 |           DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl);
 | 
|---|
 | 176 |           if ((*iter)->getId() < (*runner)->getId()){
 | 
|---|
| [b5c53d] | 177 |             for (set <pair<const element *, const element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
 | 
|---|
| [d74077] | 178 |               if ((PairRunner->first == (**iter).getType()) && (PairRunner->second == (**runner).getType())) {
 | 
|---|
 | 179 |                 distance = domain.periodicDistance((*iter)->getPosition(),(*runner)->getPosition());
 | 
|---|
| [e65de8] | 180 |                 //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
 | 
|---|
 | 181 |                 outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
 | 
|---|
| [a5551b] | 182 |               }
 | 
|---|
| [c4d4df] | 183 |           }
 | 
|---|
| [a5551b] | 184 |         }
 | 
|---|
| [c4d4df] | 185 |       }
 | 
|---|
 | 186 |     }
 | 
|---|
| [24725c] | 187 |   }
 | 
|---|
| [c4d4df] | 188 |   return outmap;
 | 
|---|
 | 189 | };
 | 
|---|
 | 190 | 
 | 
|---|
| [7ea9e6] | 191 | /** Calculates the pair correlation between given elements.
 | 
|---|
 | 192 |  * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si))
 | 
|---|
 | 193 |  * \param *molecules list of molecules structure
 | 
|---|
| [c78d44] | 194 |  * \param &elements vector of elements to correlate
 | 
|---|
| [7ea9e6] | 195 |  * \param ranges[NDIM] interval boundaries for the periodic images to scan also
 | 
|---|
 | 196 |  * \return Map of doubles with values the pair of the two atoms.
 | 
|---|
 | 197 |  */
 | 
|---|
| [e5c0a1] | 198 | PairCorrelationMap *PeriodicPairCorrelation(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const int ranges[NDIM] )
 | 
|---|
| [7ea9e6] | 199 | {
 | 
|---|
| [3930eb] | 200 |   Info FunctionInfo(__func__);
 | 
|---|
| [caa30b] | 201 |   PairCorrelationMap *outmap = new PairCorrelationMap;
 | 
|---|
| [7ea9e6] | 202 |   double distance = 0.;
 | 
|---|
 | 203 |   int n[NDIM];
 | 
|---|
 | 204 |   Vector checkX;
 | 
|---|
 | 205 |   Vector periodicX;
 | 
|---|
 | 206 |   int Othern[NDIM];
 | 
|---|
 | 207 |   Vector checkOtherX;
 | 
|---|
 | 208 |   Vector periodicOtherX;
 | 
|---|
 | 209 | 
 | 
|---|
| [e65de8] | 210 |   if (molecules.empty()) {
 | 
|---|
| [58ed4a] | 211 |     DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl);
 | 
|---|
| [7ea9e6] | 212 |     return outmap;
 | 
|---|
 | 213 |   }
 | 
|---|
| [e65de8] | 214 |   for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
 | 
|---|
| [009607e] | 215 |     (*MolWalker)->doCountAtoms();
 | 
|---|
| [c78d44] | 216 | 
 | 
|---|
 | 217 |   // create all possible pairs of elements
 | 
|---|
| [e5c0a1] | 218 |   set <pair<const element *,const element *> > PairsOfElements;
 | 
|---|
| [c78d44] | 219 |   if (elements.size() >= 2) {
 | 
|---|
| [e5c0a1] | 220 |     for (vector<const element *>::const_iterator type1 = elements.begin(); type1 != elements.end(); ++type1)
 | 
|---|
 | 221 |       for (vector<const element *>::const_iterator type2 = elements.begin(); type2 != elements.end(); ++type2)
 | 
|---|
| [c78d44] | 222 |         if (type1 != type2) {
 | 
|---|
| [e5c0a1] | 223 |           PairsOfElements.insert( make_pair(*type1,*type2) );
 | 
|---|
| [2fe971] | 224 |           DoLog(1) && (Log() << Verbose(1) << "Creating element pair " << *(*type1) << " and " << *(*type2) << "." << endl);
 | 
|---|
| [c78d44] | 225 |         }
 | 
|---|
 | 226 |   } else if (elements.size() == 1) { // one to all are valid
 | 
|---|
| [e5c0a1] | 227 |     const element *elemental = *elements.begin();
 | 
|---|
 | 228 |     PairsOfElements.insert( pair<const element *,const element*>(elemental,0) );
 | 
|---|
 | 229 |     PairsOfElements.insert( pair<const element *,const element*>(0,elemental) );
 | 
|---|
| [c78d44] | 230 |   } else { // all elements valid
 | 
|---|
 | 231 |     PairsOfElements.insert( pair<element *, element*>((element *)NULL, (element *)NULL) );
 | 
|---|
 | 232 |   }
 | 
|---|
 | 233 | 
 | 
|---|
| [7ea9e6] | 234 |   outmap = new PairCorrelationMap;
 | 
|---|
| [e65de8] | 235 |   for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++){
 | 
|---|
| [cca9ef] | 236 |     RealSpaceMatrix FullMatrix = World::getInstance().getDomain().getM();
 | 
|---|
 | 237 |     RealSpaceMatrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
 | 
|---|
| [e65de8] | 238 |     DoLog(2) && (Log()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
 | 
|---|
 | 239 |     for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
 | 
|---|
 | 240 |       DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
 | 
|---|
| [d74077] | 241 |       periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
 | 
|---|
| [e65de8] | 242 |       // go through every range in xyz and get distance
 | 
|---|
 | 243 |       for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
 | 
|---|
 | 244 |         for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
 | 
|---|
 | 245 |           for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
 | 
|---|
 | 246 |             checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
 | 
|---|
 | 247 |             for (std::vector<molecule *>::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules.end(); MolOtherWalker++){
 | 
|---|
 | 248 |                 DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl);
 | 
|---|
 | 249 |                 for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) {
 | 
|---|
 | 250 |                   DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl);
 | 
|---|
 | 251 |                   if ((*iter)->getId() < (*runner)->getId()){
 | 
|---|
| [e5c0a1] | 252 |                     for (set <pair<const element *,const element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
 | 
|---|
| [d74077] | 253 |                       if ((PairRunner->first == (**iter).getType()) && (PairRunner->second == (**runner).getType())) {
 | 
|---|
 | 254 |                         periodicOtherX = FullInverseMatrix * ((*runner)->getPosition()); // x now in [0,1)^3
 | 
|---|
| [e65de8] | 255 |                         // go through every range in xyz and get distance
 | 
|---|
 | 256 |                         for (Othern[0]=-ranges[0]; Othern[0] <= ranges[0]; Othern[0]++)
 | 
|---|
 | 257 |                           for (Othern[1]=-ranges[1]; Othern[1] <= ranges[1]; Othern[1]++)
 | 
|---|
 | 258 |                             for (Othern[2]=-ranges[2]; Othern[2] <= ranges[2]; Othern[2]++) {
 | 
|---|
 | 259 |                               checkOtherX = FullMatrix * (Vector(Othern[0], Othern[1], Othern[2]) + periodicOtherX);
 | 
|---|
 | 260 |                               distance = checkX.distance(checkOtherX);
 | 
|---|
 | 261 |                               //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
 | 
|---|
 | 262 |                               outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
 | 
|---|
 | 263 |                             }
 | 
|---|
 | 264 |                       }
 | 
|---|
| [c78d44] | 265 |                     }
 | 
|---|
| [7ea9e6] | 266 |                   }
 | 
|---|
| [c78d44] | 267 |                 }
 | 
|---|
| [7ea9e6] | 268 |       }
 | 
|---|
 | 269 |     }
 | 
|---|
| [c78d44] | 270 |   }
 | 
|---|
| [7ea9e6] | 271 | 
 | 
|---|
 | 272 |   return outmap;
 | 
|---|
 | 273 | };
 | 
|---|
 | 274 | 
 | 
|---|
| [c4d4df] | 275 | /** Calculates the distance (pair) correlation between a given element and a point.
 | 
|---|
| [a5551b] | 276 |  * \param *molecules list of molecules structure
 | 
|---|
| [c78d44] | 277 |  * \param &elements vector of elements to correlate with point
 | 
|---|
| [c4d4df] | 278 |  * \param *point vector to the correlation point
 | 
|---|
 | 279 |  * \return Map of dobules with values as pairs of atom and the vector
 | 
|---|
 | 280 |  */
 | 
|---|
| [e5c0a1] | 281 | CorrelationToPointMap *CorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Vector *point )
 | 
|---|
| [c4d4df] | 282 | {
 | 
|---|
| [3930eb] | 283 |   Info FunctionInfo(__func__);
 | 
|---|
| [caa30b] | 284 |   CorrelationToPointMap *outmap = new CorrelationToPointMap;
 | 
|---|
| [c4d4df] | 285 |   double distance = 0.;
 | 
|---|
| [014475] | 286 |   Box &domain = World::getInstance().getDomain();
 | 
|---|
| [c4d4df] | 287 | 
 | 
|---|
| [e65de8] | 288 |   if (molecules.empty()) {
 | 
|---|
| [a67d19] | 289 |     DoLog(1) && (Log() << Verbose(1) <<"No molecule given." << endl);
 | 
|---|
| [c4d4df] | 290 |     return outmap;
 | 
|---|
 | 291 |   }
 | 
|---|
| [e65de8] | 292 |   for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
 | 
|---|
| [009607e] | 293 |     (*MolWalker)->doCountAtoms();
 | 
|---|
| [c4d4df] | 294 |   outmap = new CorrelationToPointMap;
 | 
|---|
| [e65de8] | 295 |   for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) {
 | 
|---|
 | 296 |     DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
 | 
|---|
 | 297 |     for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
 | 
|---|
 | 298 |       DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
 | 
|---|
| [e5c0a1] | 299 |       for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
 | 
|---|
| [d74077] | 300 |         if ((*type == NULL) || ((*iter)->getType() == *type)) {
 | 
|---|
 | 301 |           distance = domain.periodicDistance((*iter)->getPosition(),*point);
 | 
|---|
| [e65de8] | 302 |           DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
 | 
|---|
 | 303 |           outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) );
 | 
|---|
 | 304 |         }
 | 
|---|
| [c4d4df] | 305 |     }
 | 
|---|
| [e65de8] | 306 |   }
 | 
|---|
| [c4d4df] | 307 | 
 | 
|---|
 | 308 |   return outmap;
 | 
|---|
 | 309 | };
 | 
|---|
 | 310 | 
 | 
|---|
| [7ea9e6] | 311 | /** Calculates the distance (pair) correlation between a given element, all its periodic images and a point.
 | 
|---|
 | 312 |  * \param *molecules list of molecules structure
 | 
|---|
| [c78d44] | 313 |  * \param &elements vector of elements to correlate to point
 | 
|---|
| [7ea9e6] | 314 |  * \param *point vector to the correlation point
 | 
|---|
 | 315 |  * \param ranges[NDIM] interval boundaries for the periodic images to scan also
 | 
|---|
 | 316 |  * \return Map of dobules with values as pairs of atom and the vector
 | 
|---|
 | 317 |  */
 | 
|---|
| [e5c0a1] | 318 | CorrelationToPointMap *PeriodicCorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Vector *point, const int ranges[NDIM] )
 | 
|---|
| [7ea9e6] | 319 | {
 | 
|---|
| [3930eb] | 320 |   Info FunctionInfo(__func__);
 | 
|---|
| [caa30b] | 321 |   CorrelationToPointMap *outmap = new CorrelationToPointMap;
 | 
|---|
| [7ea9e6] | 322 |   double distance = 0.;
 | 
|---|
 | 323 |   int n[NDIM];
 | 
|---|
 | 324 |   Vector periodicX;
 | 
|---|
 | 325 |   Vector checkX;
 | 
|---|
 | 326 | 
 | 
|---|
| [e65de8] | 327 |   if (molecules.empty()) {
 | 
|---|
| [a67d19] | 328 |     DoLog(1) && (Log() << Verbose(1) <<"No molecule given." << endl);
 | 
|---|
| [7ea9e6] | 329 |     return outmap;
 | 
|---|
 | 330 |   }
 | 
|---|
| [e65de8] | 331 |   for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
 | 
|---|
| [009607e] | 332 |     (*MolWalker)->doCountAtoms();
 | 
|---|
| [7ea9e6] | 333 |   outmap = new CorrelationToPointMap;
 | 
|---|
| [e65de8] | 334 |   for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) {
 | 
|---|
| [cca9ef] | 335 |     RealSpaceMatrix FullMatrix = World::getInstance().getDomain().getM();
 | 
|---|
 | 336 |     RealSpaceMatrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
 | 
|---|
| [e65de8] | 337 |     DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
 | 
|---|
 | 338 |     for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
 | 
|---|
 | 339 |       DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
 | 
|---|
| [e5c0a1] | 340 |       for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
 | 
|---|
| [d74077] | 341 |         if ((*type == NULL) || ((*iter)->getType() == *type)) {
 | 
|---|
 | 342 |           periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
 | 
|---|
| [e65de8] | 343 |           // go through every range in xyz and get distance
 | 
|---|
 | 344 |           for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
 | 
|---|
 | 345 |             for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
 | 
|---|
 | 346 |               for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
 | 
|---|
 | 347 |                 checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
 | 
|---|
 | 348 |                 distance = checkX.distance(*point);
 | 
|---|
 | 349 |                 DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
 | 
|---|
 | 350 |                 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (*iter, point) ) );
 | 
|---|
 | 351 |               }
 | 
|---|
 | 352 |         }
 | 
|---|
| [7ea9e6] | 353 |     }
 | 
|---|
| [e65de8] | 354 |   }
 | 
|---|
| [7ea9e6] | 355 | 
 | 
|---|
 | 356 |   return outmap;
 | 
|---|
 | 357 | };
 | 
|---|
 | 358 | 
 | 
|---|
| [c4d4df] | 359 | /** Calculates the distance (pair) correlation between a given element and a surface.
 | 
|---|
| [a5551b] | 360 |  * \param *molecules list of molecules structure
 | 
|---|
| [c78d44] | 361 |  * \param &elements vector of elements to correlate to surface
 | 
|---|
| [c4d4df] | 362 |  * \param *Surface pointer to Tesselation class surface
 | 
|---|
 | 363 |  * \param *LC LinkedCell structure to quickly find neighbouring atoms
 | 
|---|
 | 364 |  * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest
 | 
|---|
 | 365 |  */
 | 
|---|
| [e5c0a1] | 366 | CorrelationToSurfaceMap *CorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Tesselation * const Surface, const LinkedCell *LC )
 | 
|---|
| [c4d4df] | 367 | {
 | 
|---|
| [3930eb] | 368 |   Info FunctionInfo(__func__);
 | 
|---|
| [caa30b] | 369 |   CorrelationToSurfaceMap *outmap = new CorrelationToSurfaceMap;
 | 
|---|
| [99593f] | 370 |   double distance = 0;
 | 
|---|
| [c4d4df] | 371 |   class BoundaryTriangleSet *triangle = NULL;
 | 
|---|
 | 372 |   Vector centroid;
 | 
|---|
| [7ea9e6] | 373 | 
 | 
|---|
| [e65de8] | 374 |   if ((Surface == NULL) || (LC == NULL) || (molecules.empty())) {
 | 
|---|
| [58ed4a] | 375 |     DoeLog(1) && (eLog()<< Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl);
 | 
|---|
| [7ea9e6] | 376 |     return outmap;
 | 
|---|
 | 377 |   }
 | 
|---|
| [e65de8] | 378 |   for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
 | 
|---|
| [009607e] | 379 |     (*MolWalker)->doCountAtoms();
 | 
|---|
| [7ea9e6] | 380 |   outmap = new CorrelationToSurfaceMap;
 | 
|---|
| [e65de8] | 381 |   for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) {
 | 
|---|
 | 382 |     DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << (*MolWalker)->name << "." << endl);
 | 
|---|
 | 383 |     if ((*MolWalker)->empty())
 | 
|---|
 | 384 |       DoLog(2) && (2) && (Log() << Verbose(2) << "\t is empty." << endl);
 | 
|---|
 | 385 |     for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
 | 
|---|
 | 386 |       DoLog(3) && (Log() << Verbose(3) << "\tCurrent atom is " << *(*iter) << "." << endl);
 | 
|---|
| [e5c0a1] | 387 |       for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
 | 
|---|
| [d74077] | 388 |         if ((*type == NULL) || ((*iter)->getType() == *type)) {
 | 
|---|
 | 389 |           TriangleIntersectionList Intersections((*iter)->getPosition(),Surface,LC);
 | 
|---|
| [e65de8] | 390 |           distance = Intersections.GetSmallestDistance();
 | 
|---|
 | 391 |           triangle = Intersections.GetClosestTriangle();
 | 
|---|
 | 392 |           outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> ((*iter), triangle) ) );
 | 
|---|
 | 393 |         }
 | 
|---|
| [7fd416] | 394 |     }
 | 
|---|
| [e65de8] | 395 |   }
 | 
|---|
| [7ea9e6] | 396 | 
 | 
|---|
 | 397 |   return outmap;
 | 
|---|
 | 398 | };
 | 
|---|
 | 399 | 
 | 
|---|
 | 400 | /** Calculates the distance (pair) correlation between a given element, all its periodic images and and a surface.
 | 
|---|
 | 401 |  * Note that we also put all periodic images found in the cells given by [ -ranges[i], ranges[i] ] and i=0,...,NDIM-1.
 | 
|---|
 | 402 |  * I.e. We multiply the atom::node with the inverse of the domain matrix, i.e. transform it to \f$[0,0^3\f$, then add per
 | 
|---|
 | 403 |  * axis an integer from [ -ranges[i], ranges[i] ] onto it and multiply with the domain matrix to bring it back into
 | 
|---|
 | 404 |  * the real space. Then, we Tesselation::FindClosestTriangleToPoint() and DistanceToTrianglePlane().
 | 
|---|
 | 405 |  * \param *molecules list of molecules structure
 | 
|---|
| [c78d44] | 406 |  * \param &elements vector of elements to correlate to surface
 | 
|---|
| [7ea9e6] | 407 |  * \param *Surface pointer to Tesselation class surface
 | 
|---|
 | 408 |  * \param *LC LinkedCell structure to quickly find neighbouring atoms
 | 
|---|
 | 409 |  * \param ranges[NDIM] interval boundaries for the periodic images to scan also
 | 
|---|
 | 410 |  * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest
 | 
|---|
 | 411 |  */
 | 
|---|
| [e5c0a1] | 412 | CorrelationToSurfaceMap *PeriodicCorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] )
 | 
|---|
| [7ea9e6] | 413 | {
 | 
|---|
| [3930eb] | 414 |   Info FunctionInfo(__func__);
 | 
|---|
| [caa30b] | 415 |   CorrelationToSurfaceMap *outmap = new CorrelationToSurfaceMap;
 | 
|---|
| [7ea9e6] | 416 |   double distance = 0;
 | 
|---|
 | 417 |   class BoundaryTriangleSet *triangle = NULL;
 | 
|---|
 | 418 |   Vector centroid;
 | 
|---|
| [99593f] | 419 |   int n[NDIM];
 | 
|---|
 | 420 |   Vector periodicX;
 | 
|---|
 | 421 |   Vector checkX;
 | 
|---|
| [c4d4df] | 422 | 
 | 
|---|
| [e65de8] | 423 |   if ((Surface == NULL) || (LC == NULL) || (molecules.empty())) {
 | 
|---|
| [a67d19] | 424 |     DoLog(1) && (Log() << Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl);
 | 
|---|
| [c4d4df] | 425 |     return outmap;
 | 
|---|
 | 426 |   }
 | 
|---|
| [e65de8] | 427 |   for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
 | 
|---|
| [009607e] | 428 |     (*MolWalker)->doCountAtoms();
 | 
|---|
| [c4d4df] | 429 |   outmap = new CorrelationToSurfaceMap;
 | 
|---|
| [244a84] | 430 |   double ShortestDistance = 0.;
 | 
|---|
 | 431 |   BoundaryTriangleSet *ShortestTriangle = NULL;
 | 
|---|
| [e65de8] | 432 |   for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) {
 | 
|---|
| [cca9ef] | 433 |     RealSpaceMatrix FullMatrix = World::getInstance().getDomain().getM();
 | 
|---|
 | 434 |     RealSpaceMatrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
 | 
|---|
| [e65de8] | 435 |     DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
 | 
|---|
 | 436 |     for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
 | 
|---|
 | 437 |       DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
 | 
|---|
| [e5c0a1] | 438 |       for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
 | 
|---|
| [d74077] | 439 |         if ((*type == NULL) || ((*iter)->getType() == *type)) {
 | 
|---|
 | 440 |           periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
 | 
|---|
| [e65de8] | 441 |           // go through every range in xyz and get distance
 | 
|---|
 | 442 |           ShortestDistance = -1.;
 | 
|---|
 | 443 |           for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
 | 
|---|
 | 444 |             for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
 | 
|---|
 | 445 |               for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
 | 
|---|
 | 446 |                 checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
 | 
|---|
| [d74077] | 447 |                 TriangleIntersectionList Intersections(checkX,Surface,LC);
 | 
|---|
| [e65de8] | 448 |                 distance = Intersections.GetSmallestDistance();
 | 
|---|
 | 449 |                 triangle = Intersections.GetClosestTriangle();
 | 
|---|
 | 450 |                 if ((ShortestDistance == -1.) || (distance < ShortestDistance)) {
 | 
|---|
 | 451 |                   ShortestDistance = distance;
 | 
|---|
 | 452 |                   ShortestTriangle = triangle;
 | 
|---|
| [99593f] | 453 |                 }
 | 
|---|
| [e65de8] | 454 |               }
 | 
|---|
 | 455 |           // insert
 | 
|---|
 | 456 |           outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (*iter, ShortestTriangle) ) );
 | 
|---|
 | 457 |           //Log() << Verbose(1) << "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "." << endl;
 | 
|---|
 | 458 |         }
 | 
|---|
| [c4d4df] | 459 |     }
 | 
|---|
| [e65de8] | 460 |   }
 | 
|---|
| [c4d4df] | 461 | 
 | 
|---|
 | 462 |   return outmap;
 | 
|---|
 | 463 | };
 | 
|---|
 | 464 | 
 | 
|---|
| [bd61b41] | 465 | /** Returns the index of the bin for a given value.
 | 
|---|
| [c4d4df] | 466 |  * \param value value whose bin to look for
 | 
|---|
 | 467 |  * \param BinWidth width of bin
 | 
|---|
 | 468 |  * \param BinStart first bin
 | 
|---|
 | 469 |  */
 | 
|---|
| [bd61b41] | 470 | int GetBin ( const double value, const double BinWidth, const double BinStart )
 | 
|---|
| [c4d4df] | 471 | {
 | 
|---|
| [92e5cb] | 472 |   //Info FunctionInfo(__func__);
 | 
|---|
| [bd61b41] | 473 |   int bin =(int) (floor((value - BinStart)/BinWidth));
 | 
|---|
 | 474 |   return (bin);
 | 
|---|
| [c4d4df] | 475 | };
 | 
|---|
 | 476 | 
 | 
|---|
 | 477 | 
 | 
|---|
| [92e5cb] | 478 | /** Adds header part that is unique to BinPairMap.
 | 
|---|
 | 479 |  *
 | 
|---|
 | 480 |  * @param file stream to print to
 | 
|---|
| [c4d4df] | 481 |  */
 | 
|---|
| [92e5cb] | 482 | void OutputCorrelation_Header( ofstream * const file )
 | 
|---|
| [c4d4df] | 483 | {
 | 
|---|
| [92e5cb] | 484 |   *file << "\tCount";
 | 
|---|
| [c4d4df] | 485 | };
 | 
|---|
| [b1f254] | 486 | 
 | 
|---|
| [92e5cb] | 487 | /** Prints values stored in BinPairMap iterator.
 | 
|---|
 | 488 |  *
 | 
|---|
 | 489 |  * @param file stream to print to
 | 
|---|
 | 490 |  * @param runner iterator pointing at values to print
 | 
|---|
| [be945c] | 491 |  */
 | 
|---|
| [92e5cb] | 492 | void OutputCorrelation_Value( ofstream * const file, BinPairMap::const_iterator &runner )
 | 
|---|
| [be945c] | 493 | {
 | 
|---|
| [92e5cb] | 494 |   *file << runner->second;
 | 
|---|
| [be945c] | 495 | };
 | 
|---|
 | 496 | 
 | 
|---|
| [92e5cb] | 497 | 
 | 
|---|
 | 498 | /** Adds header part that is unique to DipoleAngularCorrelationMap.
 | 
|---|
 | 499 |  *
 | 
|---|
 | 500 |  * @param file stream to print to
 | 
|---|
| [b1f254] | 501 |  */
 | 
|---|
| [92e5cb] | 502 | void OutputDipoleAngularCorrelation_Header( ofstream * const file )
 | 
|---|
| [b1f254] | 503 | {
 | 
|---|
| [92e5cb] | 504 |   *file << "\tAtom1\tAtom2";
 | 
|---|
| [b1f254] | 505 | };
 | 
|---|
 | 506 | 
 | 
|---|
| [92e5cb] | 507 | /** Prints values stored in DipoleAngularCorrelationMap iterator.
 | 
|---|
 | 508 |  *
 | 
|---|
 | 509 |  * @param file stream to print to
 | 
|---|
 | 510 |  * @param runner iterator pointing at values to print
 | 
|---|
| [b1f254] | 511 |  */
 | 
|---|
| [92e5cb] | 512 | void OutputDipoleAngularCorrelation_Value( ofstream * const file, DipoleAngularCorrelationMap::const_iterator &runner )
 | 
|---|
| [b1f254] | 513 | {
 | 
|---|
| [92e5cb] | 514 |   *file << runner->second.first->getId() << "\t" << runner->second.second->getId();
 | 
|---|
| [b1f254] | 515 | };
 | 
|---|
 | 516 | 
 | 
|---|
| [92e5cb] | 517 | 
 | 
|---|
 | 518 | /** Adds header part that is unique to PairCorrelationMap.
 | 
|---|
 | 519 |  *
 | 
|---|
 | 520 |  * @param file stream to print to
 | 
|---|
| [b1f254] | 521 |  */
 | 
|---|
| [92e5cb] | 522 | void OutputPairCorrelation_Header( ofstream * const file )
 | 
|---|
| [b1f254] | 523 | {
 | 
|---|
| [92e5cb] | 524 |   *file << "\tAtom1\tAtom2";
 | 
|---|
 | 525 | };
 | 
|---|
 | 526 | 
 | 
|---|
 | 527 | /** Prints values stored in PairCorrelationMap iterator.
 | 
|---|
 | 528 |  *
 | 
|---|
 | 529 |  * @param file stream to print to
 | 
|---|
 | 530 |  * @param runner iterator pointing at values to print
 | 
|---|
 | 531 |  */
 | 
|---|
 | 532 | void OutputPairCorrelation_Value( ofstream * const file, PairCorrelationMap::const_iterator &runner )
 | 
|---|
 | 533 | {
 | 
|---|
 | 534 |   *file << *(runner->second.first) << "\t" << *(runner->second.second);
 | 
|---|
 | 535 | };
 | 
|---|
 | 536 | 
 | 
|---|
 | 537 | 
 | 
|---|
 | 538 | /** Adds header part that is unique to CorrelationToPointMap.
 | 
|---|
 | 539 |  *
 | 
|---|
 | 540 |  * @param file stream to print to
 | 
|---|
 | 541 |  */
 | 
|---|
 | 542 | void OutputCorrelationToPoint_Header( ofstream * const file )
 | 
|---|
 | 543 | {
 | 
|---|
 | 544 |   *file << "\tAtom::x[i]-point.x[i]";
 | 
|---|
 | 545 | };
 | 
|---|
 | 546 | 
 | 
|---|
 | 547 | /** Prints values stored in CorrelationToPointMap iterator.
 | 
|---|
 | 548 |  *
 | 
|---|
 | 549 |  * @param file stream to print to
 | 
|---|
 | 550 |  * @param runner iterator pointing at values to print
 | 
|---|
 | 551 |  */
 | 
|---|
 | 552 | void OutputCorrelationToPoint_Value( ofstream * const file, CorrelationToPointMap::const_iterator &runner )
 | 
|---|
 | 553 | {
 | 
|---|
 | 554 |   for (int i=0;i<NDIM;i++)
 | 
|---|
 | 555 |     *file << "\t" << setprecision(8) << (runner->second.first->at(i) - runner->second.second->at(i));
 | 
|---|
| [b1f254] | 556 | };
 | 
|---|
 | 557 | 
 | 
|---|
| [92e5cb] | 558 | 
 | 
|---|
 | 559 | /** Adds header part that is unique to CorrelationToSurfaceMap.
 | 
|---|
 | 560 |  *
 | 
|---|
 | 561 |  * @param file stream to print to
 | 
|---|
 | 562 |  */
 | 
|---|
 | 563 | void OutputCorrelationToSurface_Header( ofstream * const file )
 | 
|---|
 | 564 | {
 | 
|---|
 | 565 |   *file << "\tTriangle";
 | 
|---|
 | 566 | };
 | 
|---|
 | 567 | 
 | 
|---|
 | 568 | /** Prints values stored in CorrelationToSurfaceMap iterator.
 | 
|---|
 | 569 |  *
 | 
|---|
 | 570 |  * @param file stream to print to
 | 
|---|
 | 571 |  * @param runner iterator pointing at values to print
 | 
|---|
 | 572 |  */
 | 
|---|
 | 573 | void OutputCorrelationToSurface_Value( ofstream * const file, CorrelationToSurfaceMap::const_iterator &runner )
 | 
|---|
 | 574 | {
 | 
|---|
 | 575 |   *file << *(runner->second.first) << "\t" << *(runner->second.second);
 | 
|---|
 | 576 | };
 | 
|---|