| [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"
|
|---|
| [129204] | 26 | #include "Bond/bond.hpp"
|
|---|
| [d127c8] | 27 | #include "Tesselation/BoundaryTriangleSet.hpp"
|
|---|
| [be945c] | 28 | #include "Box.hpp"
|
|---|
| [3bdb6d] | 29 | #include "Element/element.hpp"
|
|---|
| [ad011c] | 30 | #include "CodePatterns/Info.hpp"
|
|---|
| 31 | #include "CodePatterns/Log.hpp"
|
|---|
| [208237b] | 32 | #include "CodePatterns/Verbose.hpp"
|
|---|
| [ea430a] | 33 | #include "Formula.hpp"
|
|---|
| [208237b] | 34 | #include "LinearAlgebra/Vector.hpp"
|
|---|
| 35 | #include "LinearAlgebra/RealSpaceMatrix.hpp"
|
|---|
| [c4d4df] | 36 | #include "molecule.hpp"
|
|---|
| [d127c8] | 37 | #include "Tesselation/tesselation.hpp"
|
|---|
| 38 | #include "Tesselation/tesselationhelpers.hpp"
|
|---|
| 39 | #include "Tesselation/triangleintersectionlist.hpp"
|
|---|
| [be945c] | 40 | #include "World.hpp"
|
|---|
| [208237b] | 41 | #include "WorldTime.hpp"
|
|---|
| [c4d4df] | 42 |
|
|---|
| [be945c] | 43 | #include "analysis_correlation.hpp"
|
|---|
| 44 |
|
|---|
| 45 | /** Calculates the dipole vector of a given atomSet.
|
|---|
| 46 | *
|
|---|
| 47 | * Note that we use the following procedure as rule of thumb:
|
|---|
| 48 | * -# go through every bond of the atom
|
|---|
| [d1912f] | 49 | * -# calculate the difference of electronegativities \f$\Delta\mathrm{EN}\f$
|
|---|
| 50 | * -# if \f$\Delta\mathrm{EN} > 0.5\f$, we align the bond vector in direction of the more negative element
|
|---|
| [be945c] | 51 | * -# sum up all vectors
|
|---|
| 52 | * -# finally, divide by the number of summed vectors
|
|---|
| 53 | *
|
|---|
| 54 | * @param atomsbegin begin iterator of atomSet
|
|---|
| 55 | * @param atomsend end iterator of atomset
|
|---|
| 56 | * @return dipole vector
|
|---|
| 57 | */
|
|---|
| 58 | Vector getDipole(molecule::const_iterator atomsbegin, molecule::const_iterator atomsend)
|
|---|
| 59 | {
|
|---|
| 60 | Vector DipoleVector;
|
|---|
| 61 | size_t SumOfVectors = 0;
|
|---|
| 62 | // go through all atoms
|
|---|
| 63 | for (molecule::const_iterator atomiter = atomsbegin;
|
|---|
| 64 | atomiter != atomsend;
|
|---|
| 65 | ++atomiter) {
|
|---|
| 66 | // go through all bonds
|
|---|
| [9d83b6] | 67 | const BondList& ListOfBonds = (*atomiter)->getListOfBonds();
|
|---|
| [4fc828] | 68 | ASSERT(ListOfBonds.begin() != ListOfBonds.end(),
|
|---|
| 69 | "getDipole() - no bonds in molecule!");
|
|---|
| [9d83b6] | 70 | for (BondList::const_iterator bonditer = ListOfBonds.begin();
|
|---|
| 71 | bonditer != ListOfBonds.end();
|
|---|
| [be945c] | 72 | ++bonditer) {
|
|---|
| 73 | const atom * Otheratom = (*bonditer)->GetOtherAtom(*atomiter);
|
|---|
| 74 | if (Otheratom->getId() > (*atomiter)->getId()) {
|
|---|
| 75 | const double DeltaEN = (*atomiter)->getType()->getElectronegativity()
|
|---|
| 76 | -Otheratom->getType()->getElectronegativity();
|
|---|
| 77 | Vector BondDipoleVector = (*atomiter)->getPosition() - Otheratom->getPosition();
|
|---|
| 78 | // DeltaEN is always positive, gives correct orientation of vector
|
|---|
| 79 | BondDipoleVector.Normalize();
|
|---|
| 80 | BondDipoleVector *= DeltaEN;
|
|---|
| [4fc828] | 81 | LOG(3,"INFO: Dipole vector from bond " << **bonditer << " is " << BondDipoleVector);
|
|---|
| [be945c] | 82 | DipoleVector += BondDipoleVector;
|
|---|
| 83 | SumOfVectors++;
|
|---|
| 84 | }
|
|---|
| 85 | }
|
|---|
| 86 | }
|
|---|
| [4fc828] | 87 | LOG(3,"INFO: Sum over all bond dipole vectors is "
|
|---|
| 88 | << DipoleVector << " with " << SumOfVectors << " in total.");
|
|---|
| 89 | if (SumOfVectors != 0)
|
|---|
| 90 | DipoleVector *= 1./(double)SumOfVectors;
|
|---|
| [be945c] | 91 | DoLog(1) && (Log() << Verbose(1) << "Resulting dipole vector is " << DipoleVector << std::endl);
|
|---|
| 92 |
|
|---|
| 93 | return DipoleVector;
|
|---|
| 94 | };
|
|---|
| 95 |
|
|---|
| [ea430a] | 96 | /** Calculates the dipole angular correlation for given molecule type.
|
|---|
| [208237b] | 97 | * Calculate the change of the dipole orientation angle over time.
|
|---|
| [ea430a] | 98 | * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si))
|
|---|
| [be945c] | 99 | * Angles are given in degrees.
|
|---|
| [ea430a] | 100 | * \param *molecules vector of molecules
|
|---|
| 101 | * \return Map of doubles with values the pair of the two atoms.
|
|---|
| 102 | */
|
|---|
| [be945c] | 103 | DipoleAngularCorrelationMap *DipoleAngularCorrelation(std::vector<molecule *> &molecules)
|
|---|
| [ea430a] | 104 | {
|
|---|
| 105 | Info FunctionInfo(__func__);
|
|---|
| [caa30b] | 106 | DipoleAngularCorrelationMap *outmap = new DipoleAngularCorrelationMap;
|
|---|
| [ea430a] | 107 | // double distance = 0.;
|
|---|
| 108 | // Box &domain = World::getInstance().getDomain();
|
|---|
| 109 | //
|
|---|
| [be945c] | 110 | if (molecules.empty()) {
|
|---|
| 111 | DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl);
|
|---|
| 112 | return outmap;
|
|---|
| 113 | }
|
|---|
| 114 |
|
|---|
| [208237b] | 115 | // store original time step
|
|---|
| 116 | const unsigned int oldtime = WorldTime::getTime();
|
|---|
| 117 | World::getInstance().setTime(0);
|
|---|
| 118 |
|
|---|
| [4fc828] | 119 | BOOST_FOREACH(atom *_atom, World::getInstance().getAllAtoms())
|
|---|
| 120 | LOG(2, "INFO: Atom " << _atom->getId() << " "
|
|---|
| 121 | << *dynamic_cast<AtomInfo *>(_atom) <<".");
|
|---|
| 122 |
|
|---|
| [208237b] | 123 | // get highest trajectory size
|
|---|
| [4fc828] | 124 | LOG(0,"STATUS: Retrieving maximum amount of time steps ...");
|
|---|
| [208237b] | 125 | size_t max_timesteps = 0;
|
|---|
| [4fc828] | 126 | size_t min_timesteps = -1;
|
|---|
| [208237b] | 127 | BOOST_FOREACH(molecule *_mol, molecules) {
|
|---|
| 128 | for(molecule::const_iterator iter = _mol->begin();
|
|---|
| 129 | iter != _mol->end();
|
|---|
| 130 | ++iter) {
|
|---|
| 131 | if ((*iter)->getTrajectorySize() > max_timesteps)
|
|---|
| 132 | max_timesteps = (*iter)->getTrajectorySize();
|
|---|
| [4fc828] | 133 | if (((*iter)->getTrajectorySize() <= max_timesteps) && (min_timesteps == (size_t)-1))
|
|---|
| 134 | min_timesteps = (*iter)->getTrajectorySize();
|
|---|
| [208237b] | 135 | }
|
|---|
| 136 | }
|
|---|
| [4fc828] | 137 | LOG(1,"INFO: Minimum number of time steps found is " << min_timesteps);
|
|---|
| 138 | LOG(1,"INFO: Maximum number of time steps found is " << max_timesteps);
|
|---|
| 139 |
|
|---|
| [208237b] | 140 | // get zero orientation for each molecule.
|
|---|
| [4fc828] | 141 | LOG(0,"STATUS: Calculating dipoles for first time step ...");
|
|---|
| [208237b] | 142 | std::vector<Vector> ZeroVector;
|
|---|
| 143 | ZeroVector.resize(molecules.size(), zeroVec);
|
|---|
| 144 | size_t i=0;
|
|---|
| 145 | BOOST_FOREACH(molecule *_mol, molecules) {
|
|---|
| 146 | const Vector Dipole = getDipole(_mol->begin(), _mol->end());
|
|---|
| 147 | ZeroVector[i] = Dipole;
|
|---|
| [4fc828] | 148 | LOG(2,"INFO: Zero alignment for molecule " << _mol->getId() << " is " << ZeroVector[i]);
|
|---|
| [208237b] | 149 | ++i;
|
|---|
| 150 | }
|
|---|
| [4fc828] | 151 | LOG(1,"INFO: There is a total of " << i << " molecules.");
|
|---|
| 152 |
|
|---|
| [208237b] | 153 | // go through every time step
|
|---|
| [4fc828] | 154 | LOG(0,"STATUS: Calculating dipoles of following time steps ...");
|
|---|
| [208237b] | 155 | for (size_t step = 1; step < max_timesteps; ++step) {
|
|---|
| 156 | World::getInstance().setTime(step);
|
|---|
| 157 | size_t i=0;
|
|---|
| 158 | BOOST_FOREACH(molecule *_mol, molecules) {
|
|---|
| 159 | const Vector Dipole = getDipole(_mol->begin(), _mol->end());
|
|---|
| [4fc828] | 160 | LOG(2,"INFO: Dipole vector at time step " << step << " for for molecule " << _mol->getId() << " is " << Dipole);
|
|---|
| [208237b] | 161 | const double angle = Dipole.Angle(ZeroVector[i]) * (180./M_PI);
|
|---|
| [4fc828] | 162 | LOG(1,"INFO: Resulting relative angle for molecule " << _mol->getId() << " is " << angle << ".");
|
|---|
| [208237b] | 163 | outmap->insert ( make_pair (angle, _mol ) );
|
|---|
| 164 | ++i;
|
|---|
| 165 | }
|
|---|
| 166 | }
|
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 | // set original time step again
|
|---|
| 170 | World::getInstance().setTime(oldtime);
|
|---|
| [4fc828] | 171 | LOG(0,"STATUS: Done.");
|
|---|
| [208237b] | 172 |
|
|---|
| 173 | // and return results
|
|---|
| 174 | return outmap;
|
|---|
| 175 | };
|
|---|
| 176 |
|
|---|
| 177 | /** Calculates the dipole correlation for given molecule type.
|
|---|
| 178 | * I.e. we calculate how the angle between any two given dipoles in the
|
|---|
| 179 | * systems behaves. Sort of pair correlation but distance is replaced by
|
|---|
| 180 | * the orientation distance, i.e. an angle.
|
|---|
| 181 | * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si))
|
|---|
| 182 | * Angles are given in degrees.
|
|---|
| 183 | * \param *molecules vector of molecules
|
|---|
| 184 | * \return Map of doubles with values the pair of the two atoms.
|
|---|
| 185 | */
|
|---|
| 186 | DipoleCorrelationMap *DipoleCorrelation(std::vector<molecule *> &molecules)
|
|---|
| 187 | {
|
|---|
| 188 | Info FunctionInfo(__func__);
|
|---|
| 189 | DipoleCorrelationMap *outmap = new DipoleCorrelationMap;
|
|---|
| 190 | // double distance = 0.;
|
|---|
| 191 | // Box &domain = World::getInstance().getDomain();
|
|---|
| 192 | //
|
|---|
| 193 | if (molecules.empty()) {
|
|---|
| 194 | DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl);
|
|---|
| 195 | return outmap;
|
|---|
| 196 | }
|
|---|
| 197 |
|
|---|
| [be945c] | 198 | for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin();
|
|---|
| [92e5cb] | 199 | MolWalker != molecules.end(); ++MolWalker) {
|
|---|
| [be945c] | 200 | DoLog(2) && (Log()<< Verbose(2) << "Current molecule is "
|
|---|
| 201 | << (*MolWalker)->getId() << "." << endl);
|
|---|
| 202 | const Vector Dipole = getDipole((*MolWalker)->begin(), (*MolWalker)->end());
|
|---|
| [92e5cb] | 203 | std::vector<molecule *>::const_iterator MolOtherWalker = MolWalker;
|
|---|
| 204 | for (++MolOtherWalker;
|
|---|
| [be945c] | 205 | MolOtherWalker != molecules.end();
|
|---|
| [92e5cb] | 206 | ++MolOtherWalker) {
|
|---|
| [be945c] | 207 | DoLog(2) && (Log() << Verbose(2) << "Current other molecule is "
|
|---|
| 208 | << (*MolOtherWalker)->getId() << "." << endl);
|
|---|
| 209 | const Vector OtherDipole = getDipole((*MolOtherWalker)->begin(), (*MolOtherWalker)->end());
|
|---|
| 210 | const double angle = Dipole.Angle(OtherDipole) * (180./M_PI);
|
|---|
| 211 | DoLog(1) && (Log() << Verbose(1) << "Angle is " << angle << "." << endl);
|
|---|
| 212 | outmap->insert ( make_pair (angle, make_pair ((*MolWalker), (*MolOtherWalker)) ) );
|
|---|
| 213 | }
|
|---|
| 214 | }
|
|---|
| [ea430a] | 215 | return outmap;
|
|---|
| 216 | };
|
|---|
| 217 |
|
|---|
| [c4d4df] | 218 |
|
|---|
| 219 | /** Calculates the pair correlation between given elements.
|
|---|
| 220 | * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si))
|
|---|
| [e65de8] | 221 | * \param *molecules vector of molecules
|
|---|
| [c78d44] | 222 | * \param &elements vector of elements to correlate
|
|---|
| [c4d4df] | 223 | * \return Map of doubles with values the pair of the two atoms.
|
|---|
| 224 | */
|
|---|
| [e5c0a1] | 225 | PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector<const element *> &elements)
|
|---|
| [c4d4df] | 226 | {
|
|---|
| [3930eb] | 227 | Info FunctionInfo(__func__);
|
|---|
| [caa30b] | 228 | PairCorrelationMap *outmap = new PairCorrelationMap;
|
|---|
| [c4d4df] | 229 | double distance = 0.;
|
|---|
| [014475] | 230 | Box &domain = World::getInstance().getDomain();
|
|---|
| [c4d4df] | 231 |
|
|---|
| [e65de8] | 232 | if (molecules.empty()) {
|
|---|
| [58ed4a] | 233 | DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl);
|
|---|
| [c4d4df] | 234 | return outmap;
|
|---|
| 235 | }
|
|---|
| [e65de8] | 236 | for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
|
|---|
| [009607e] | 237 | (*MolWalker)->doCountAtoms();
|
|---|
| [c78d44] | 238 |
|
|---|
| 239 | // create all possible pairs of elements
|
|---|
| [e5c0a1] | 240 | set <pair<const element *,const element *> > PairsOfElements;
|
|---|
| [c78d44] | 241 | if (elements.size() >= 2) {
|
|---|
| [e5c0a1] | 242 | for (vector<const element *>::const_iterator type1 = elements.begin(); type1 != elements.end(); ++type1)
|
|---|
| 243 | for (vector<const element *>::const_iterator type2 = elements.begin(); type2 != elements.end(); ++type2)
|
|---|
| [c78d44] | 244 | if (type1 != type2) {
|
|---|
| [e5c0a1] | 245 | PairsOfElements.insert( make_pair(*type1,*type2) );
|
|---|
| [2fe971] | 246 | DoLog(1) && (Log() << Verbose(1) << "Creating element pair " << *(*type1) << " and " << *(*type2) << "." << endl);
|
|---|
| [c78d44] | 247 | }
|
|---|
| 248 | } else if (elements.size() == 1) { // one to all are valid
|
|---|
| [e5c0a1] | 249 | const element *elemental = *elements.begin();
|
|---|
| 250 | PairsOfElements.insert( pair<const element *,const element*>(elemental,0) );
|
|---|
| 251 | PairsOfElements.insert( pair<const element *,const element*>(0,elemental) );
|
|---|
| [c78d44] | 252 | } else { // all elements valid
|
|---|
| 253 | PairsOfElements.insert( pair<element *, element*>((element *)NULL, (element *)NULL) );
|
|---|
| 254 | }
|
|---|
| 255 |
|
|---|
| [c4d4df] | 256 | outmap = new PairCorrelationMap;
|
|---|
| [e65de8] | 257 | for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++){
|
|---|
| 258 | DoLog(2) && (Log()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
|
|---|
| 259 | for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
|
|---|
| 260 | DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
|
|---|
| 261 | for (std::vector<molecule *>::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules.end(); MolOtherWalker++){
|
|---|
| 262 | DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl);
|
|---|
| 263 | for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) {
|
|---|
| 264 | DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl);
|
|---|
| 265 | if ((*iter)->getId() < (*runner)->getId()){
|
|---|
| [b5c53d] | 266 | for (set <pair<const element *, const element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
|
|---|
| [d74077] | 267 | if ((PairRunner->first == (**iter).getType()) && (PairRunner->second == (**runner).getType())) {
|
|---|
| 268 | distance = domain.periodicDistance((*iter)->getPosition(),(*runner)->getPosition());
|
|---|
| [e65de8] | 269 | //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
|
|---|
| 270 | outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
|
|---|
| [a5551b] | 271 | }
|
|---|
| [c4d4df] | 272 | }
|
|---|
| [a5551b] | 273 | }
|
|---|
| [c4d4df] | 274 | }
|
|---|
| 275 | }
|
|---|
| [24725c] | 276 | }
|
|---|
| [c4d4df] | 277 | return outmap;
|
|---|
| 278 | };
|
|---|
| 279 |
|
|---|
| [7ea9e6] | 280 | /** Calculates the pair correlation between given elements.
|
|---|
| 281 | * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si))
|
|---|
| 282 | * \param *molecules list of molecules structure
|
|---|
| [c78d44] | 283 | * \param &elements vector of elements to correlate
|
|---|
| [7ea9e6] | 284 | * \param ranges[NDIM] interval boundaries for the periodic images to scan also
|
|---|
| 285 | * \return Map of doubles with values the pair of the two atoms.
|
|---|
| 286 | */
|
|---|
| [e5c0a1] | 287 | PairCorrelationMap *PeriodicPairCorrelation(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const int ranges[NDIM] )
|
|---|
| [7ea9e6] | 288 | {
|
|---|
| [3930eb] | 289 | Info FunctionInfo(__func__);
|
|---|
| [caa30b] | 290 | PairCorrelationMap *outmap = new PairCorrelationMap;
|
|---|
| [7ea9e6] | 291 | double distance = 0.;
|
|---|
| 292 | int n[NDIM];
|
|---|
| 293 | Vector checkX;
|
|---|
| 294 | Vector periodicX;
|
|---|
| 295 | int Othern[NDIM];
|
|---|
| 296 | Vector checkOtherX;
|
|---|
| 297 | Vector periodicOtherX;
|
|---|
| 298 |
|
|---|
| [e65de8] | 299 | if (molecules.empty()) {
|
|---|
| [58ed4a] | 300 | DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl);
|
|---|
| [7ea9e6] | 301 | return outmap;
|
|---|
| 302 | }
|
|---|
| [e65de8] | 303 | for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
|
|---|
| [009607e] | 304 | (*MolWalker)->doCountAtoms();
|
|---|
| [c78d44] | 305 |
|
|---|
| 306 | // create all possible pairs of elements
|
|---|
| [e5c0a1] | 307 | set <pair<const element *,const element *> > PairsOfElements;
|
|---|
| [c78d44] | 308 | if (elements.size() >= 2) {
|
|---|
| [e5c0a1] | 309 | for (vector<const element *>::const_iterator type1 = elements.begin(); type1 != elements.end(); ++type1)
|
|---|
| 310 | for (vector<const element *>::const_iterator type2 = elements.begin(); type2 != elements.end(); ++type2)
|
|---|
| [c78d44] | 311 | if (type1 != type2) {
|
|---|
| [e5c0a1] | 312 | PairsOfElements.insert( make_pair(*type1,*type2) );
|
|---|
| [2fe971] | 313 | DoLog(1) && (Log() << Verbose(1) << "Creating element pair " << *(*type1) << " and " << *(*type2) << "." << endl);
|
|---|
| [c78d44] | 314 | }
|
|---|
| 315 | } else if (elements.size() == 1) { // one to all are valid
|
|---|
| [e5c0a1] | 316 | const element *elemental = *elements.begin();
|
|---|
| 317 | PairsOfElements.insert( pair<const element *,const element*>(elemental,0) );
|
|---|
| 318 | PairsOfElements.insert( pair<const element *,const element*>(0,elemental) );
|
|---|
| [c78d44] | 319 | } else { // all elements valid
|
|---|
| 320 | PairsOfElements.insert( pair<element *, element*>((element *)NULL, (element *)NULL) );
|
|---|
| 321 | }
|
|---|
| 322 |
|
|---|
| [7ea9e6] | 323 | outmap = new PairCorrelationMap;
|
|---|
| [e65de8] | 324 | for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++){
|
|---|
| [cca9ef] | 325 | RealSpaceMatrix FullMatrix = World::getInstance().getDomain().getM();
|
|---|
| 326 | RealSpaceMatrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
|
|---|
| [e65de8] | 327 | DoLog(2) && (Log()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
|
|---|
| 328 | for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
|
|---|
| 329 | DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
|
|---|
| [d74077] | 330 | periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
|
|---|
| [e65de8] | 331 | // go through every range in xyz and get distance
|
|---|
| 332 | for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
|
|---|
| 333 | for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
|
|---|
| 334 | for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
|
|---|
| 335 | checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
|
|---|
| 336 | for (std::vector<molecule *>::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules.end(); MolOtherWalker++){
|
|---|
| 337 | DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl);
|
|---|
| 338 | for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) {
|
|---|
| 339 | DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl);
|
|---|
| 340 | if ((*iter)->getId() < (*runner)->getId()){
|
|---|
| [e5c0a1] | 341 | for (set <pair<const element *,const element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
|
|---|
| [d74077] | 342 | if ((PairRunner->first == (**iter).getType()) && (PairRunner->second == (**runner).getType())) {
|
|---|
| 343 | periodicOtherX = FullInverseMatrix * ((*runner)->getPosition()); // x now in [0,1)^3
|
|---|
| [e65de8] | 344 | // go through every range in xyz and get distance
|
|---|
| 345 | for (Othern[0]=-ranges[0]; Othern[0] <= ranges[0]; Othern[0]++)
|
|---|
| 346 | for (Othern[1]=-ranges[1]; Othern[1] <= ranges[1]; Othern[1]++)
|
|---|
| 347 | for (Othern[2]=-ranges[2]; Othern[2] <= ranges[2]; Othern[2]++) {
|
|---|
| 348 | checkOtherX = FullMatrix * (Vector(Othern[0], Othern[1], Othern[2]) + periodicOtherX);
|
|---|
| 349 | distance = checkX.distance(checkOtherX);
|
|---|
| 350 | //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
|
|---|
| 351 | outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
|
|---|
| 352 | }
|
|---|
| 353 | }
|
|---|
| [c78d44] | 354 | }
|
|---|
| [7ea9e6] | 355 | }
|
|---|
| [c78d44] | 356 | }
|
|---|
| [7ea9e6] | 357 | }
|
|---|
| 358 | }
|
|---|
| [c78d44] | 359 | }
|
|---|
| [7ea9e6] | 360 |
|
|---|
| 361 | return outmap;
|
|---|
| 362 | };
|
|---|
| 363 |
|
|---|
| [c4d4df] | 364 | /** Calculates the distance (pair) correlation between a given element and a point.
|
|---|
| [a5551b] | 365 | * \param *molecules list of molecules structure
|
|---|
| [c78d44] | 366 | * \param &elements vector of elements to correlate with point
|
|---|
| [c4d4df] | 367 | * \param *point vector to the correlation point
|
|---|
| 368 | * \return Map of dobules with values as pairs of atom and the vector
|
|---|
| 369 | */
|
|---|
| [e5c0a1] | 370 | CorrelationToPointMap *CorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Vector *point )
|
|---|
| [c4d4df] | 371 | {
|
|---|
| [3930eb] | 372 | Info FunctionInfo(__func__);
|
|---|
| [caa30b] | 373 | CorrelationToPointMap *outmap = new CorrelationToPointMap;
|
|---|
| [c4d4df] | 374 | double distance = 0.;
|
|---|
| [014475] | 375 | Box &domain = World::getInstance().getDomain();
|
|---|
| [c4d4df] | 376 |
|
|---|
| [e65de8] | 377 | if (molecules.empty()) {
|
|---|
| [a67d19] | 378 | DoLog(1) && (Log() << Verbose(1) <<"No molecule given." << endl);
|
|---|
| [c4d4df] | 379 | return outmap;
|
|---|
| 380 | }
|
|---|
| [e65de8] | 381 | for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
|
|---|
| [009607e] | 382 | (*MolWalker)->doCountAtoms();
|
|---|
| [c4d4df] | 383 | outmap = new CorrelationToPointMap;
|
|---|
| [e65de8] | 384 | for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) {
|
|---|
| 385 | DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
|
|---|
| 386 | for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
|
|---|
| 387 | DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
|
|---|
| [e5c0a1] | 388 | for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
|
|---|
| [d74077] | 389 | if ((*type == NULL) || ((*iter)->getType() == *type)) {
|
|---|
| 390 | distance = domain.periodicDistance((*iter)->getPosition(),*point);
|
|---|
| [e65de8] | 391 | DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
|
|---|
| 392 | outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) );
|
|---|
| 393 | }
|
|---|
| [c4d4df] | 394 | }
|
|---|
| [e65de8] | 395 | }
|
|---|
| [c4d4df] | 396 |
|
|---|
| 397 | return outmap;
|
|---|
| 398 | };
|
|---|
| 399 |
|
|---|
| [7ea9e6] | 400 | /** Calculates the distance (pair) correlation between a given element, all its periodic images and a point.
|
|---|
| 401 | * \param *molecules list of molecules structure
|
|---|
| [c78d44] | 402 | * \param &elements vector of elements to correlate to point
|
|---|
| [7ea9e6] | 403 | * \param *point vector to the correlation point
|
|---|
| 404 | * \param ranges[NDIM] interval boundaries for the periodic images to scan also
|
|---|
| 405 | * \return Map of dobules with values as pairs of atom and the vector
|
|---|
| 406 | */
|
|---|
| [e5c0a1] | 407 | CorrelationToPointMap *PeriodicCorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Vector *point, const int ranges[NDIM] )
|
|---|
| [7ea9e6] | 408 | {
|
|---|
| [3930eb] | 409 | Info FunctionInfo(__func__);
|
|---|
| [caa30b] | 410 | CorrelationToPointMap *outmap = new CorrelationToPointMap;
|
|---|
| [7ea9e6] | 411 | double distance = 0.;
|
|---|
| 412 | int n[NDIM];
|
|---|
| 413 | Vector periodicX;
|
|---|
| 414 | Vector checkX;
|
|---|
| 415 |
|
|---|
| [e65de8] | 416 | if (molecules.empty()) {
|
|---|
| [a67d19] | 417 | DoLog(1) && (Log() << Verbose(1) <<"No molecule given." << endl);
|
|---|
| [7ea9e6] | 418 | return outmap;
|
|---|
| 419 | }
|
|---|
| [e65de8] | 420 | for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
|
|---|
| [009607e] | 421 | (*MolWalker)->doCountAtoms();
|
|---|
| [7ea9e6] | 422 | outmap = new CorrelationToPointMap;
|
|---|
| [e65de8] | 423 | for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) {
|
|---|
| [cca9ef] | 424 | RealSpaceMatrix FullMatrix = World::getInstance().getDomain().getM();
|
|---|
| 425 | RealSpaceMatrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
|
|---|
| [e65de8] | 426 | DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
|
|---|
| 427 | for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
|
|---|
| 428 | DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
|
|---|
| [e5c0a1] | 429 | for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
|
|---|
| [d74077] | 430 | if ((*type == NULL) || ((*iter)->getType() == *type)) {
|
|---|
| 431 | periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
|
|---|
| [e65de8] | 432 | // go through every range in xyz and get distance
|
|---|
| 433 | for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
|
|---|
| 434 | for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
|
|---|
| 435 | for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
|
|---|
| 436 | checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
|
|---|
| 437 | distance = checkX.distance(*point);
|
|---|
| 438 | DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
|
|---|
| 439 | outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (*iter, point) ) );
|
|---|
| 440 | }
|
|---|
| 441 | }
|
|---|
| [7ea9e6] | 442 | }
|
|---|
| [e65de8] | 443 | }
|
|---|
| [7ea9e6] | 444 |
|
|---|
| 445 | return outmap;
|
|---|
| 446 | };
|
|---|
| 447 |
|
|---|
| [c4d4df] | 448 | /** Calculates the distance (pair) correlation between a given element and a surface.
|
|---|
| [a5551b] | 449 | * \param *molecules list of molecules structure
|
|---|
| [c78d44] | 450 | * \param &elements vector of elements to correlate to surface
|
|---|
| [c4d4df] | 451 | * \param *Surface pointer to Tesselation class surface
|
|---|
| 452 | * \param *LC LinkedCell structure to quickly find neighbouring atoms
|
|---|
| 453 | * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest
|
|---|
| 454 | */
|
|---|
| [e5c0a1] | 455 | CorrelationToSurfaceMap *CorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Tesselation * const Surface, const LinkedCell *LC )
|
|---|
| [c4d4df] | 456 | {
|
|---|
| [3930eb] | 457 | Info FunctionInfo(__func__);
|
|---|
| [caa30b] | 458 | CorrelationToSurfaceMap *outmap = new CorrelationToSurfaceMap;
|
|---|
| [99593f] | 459 | double distance = 0;
|
|---|
| [c4d4df] | 460 | class BoundaryTriangleSet *triangle = NULL;
|
|---|
| 461 | Vector centroid;
|
|---|
| [7ea9e6] | 462 |
|
|---|
| [e65de8] | 463 | if ((Surface == NULL) || (LC == NULL) || (molecules.empty())) {
|
|---|
| [58ed4a] | 464 | DoeLog(1) && (eLog()<< Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl);
|
|---|
| [7ea9e6] | 465 | return outmap;
|
|---|
| 466 | }
|
|---|
| [e65de8] | 467 | for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
|
|---|
| [009607e] | 468 | (*MolWalker)->doCountAtoms();
|
|---|
| [7ea9e6] | 469 | outmap = new CorrelationToSurfaceMap;
|
|---|
| [e65de8] | 470 | for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) {
|
|---|
| 471 | DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << (*MolWalker)->name << "." << endl);
|
|---|
| 472 | if ((*MolWalker)->empty())
|
|---|
| 473 | DoLog(2) && (2) && (Log() << Verbose(2) << "\t is empty." << endl);
|
|---|
| 474 | for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
|
|---|
| 475 | DoLog(3) && (Log() << Verbose(3) << "\tCurrent atom is " << *(*iter) << "." << endl);
|
|---|
| [e5c0a1] | 476 | for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
|
|---|
| [d74077] | 477 | if ((*type == NULL) || ((*iter)->getType() == *type)) {
|
|---|
| 478 | TriangleIntersectionList Intersections((*iter)->getPosition(),Surface,LC);
|
|---|
| [e65de8] | 479 | distance = Intersections.GetSmallestDistance();
|
|---|
| 480 | triangle = Intersections.GetClosestTriangle();
|
|---|
| 481 | outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> ((*iter), triangle) ) );
|
|---|
| 482 | }
|
|---|
| [7fd416] | 483 | }
|
|---|
| [e65de8] | 484 | }
|
|---|
| [7ea9e6] | 485 |
|
|---|
| 486 | return outmap;
|
|---|
| 487 | };
|
|---|
| 488 |
|
|---|
| 489 | /** Calculates the distance (pair) correlation between a given element, all its periodic images and and a surface.
|
|---|
| 490 | * Note that we also put all periodic images found in the cells given by [ -ranges[i], ranges[i] ] and i=0,...,NDIM-1.
|
|---|
| 491 | * 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
|
|---|
| 492 | * axis an integer from [ -ranges[i], ranges[i] ] onto it and multiply with the domain matrix to bring it back into
|
|---|
| 493 | * the real space. Then, we Tesselation::FindClosestTriangleToPoint() and DistanceToTrianglePlane().
|
|---|
| 494 | * \param *molecules list of molecules structure
|
|---|
| [c78d44] | 495 | * \param &elements vector of elements to correlate to surface
|
|---|
| [7ea9e6] | 496 | * \param *Surface pointer to Tesselation class surface
|
|---|
| 497 | * \param *LC LinkedCell structure to quickly find neighbouring atoms
|
|---|
| 498 | * \param ranges[NDIM] interval boundaries for the periodic images to scan also
|
|---|
| 499 | * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest
|
|---|
| 500 | */
|
|---|
| [e5c0a1] | 501 | CorrelationToSurfaceMap *PeriodicCorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] )
|
|---|
| [7ea9e6] | 502 | {
|
|---|
| [3930eb] | 503 | Info FunctionInfo(__func__);
|
|---|
| [caa30b] | 504 | CorrelationToSurfaceMap *outmap = new CorrelationToSurfaceMap;
|
|---|
| [7ea9e6] | 505 | double distance = 0;
|
|---|
| 506 | class BoundaryTriangleSet *triangle = NULL;
|
|---|
| 507 | Vector centroid;
|
|---|
| [99593f] | 508 | int n[NDIM];
|
|---|
| 509 | Vector periodicX;
|
|---|
| 510 | Vector checkX;
|
|---|
| [c4d4df] | 511 |
|
|---|
| [e65de8] | 512 | if ((Surface == NULL) || (LC == NULL) || (molecules.empty())) {
|
|---|
| [a67d19] | 513 | DoLog(1) && (Log() << Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl);
|
|---|
| [c4d4df] | 514 | return outmap;
|
|---|
| 515 | }
|
|---|
| [e65de8] | 516 | for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
|
|---|
| [009607e] | 517 | (*MolWalker)->doCountAtoms();
|
|---|
| [c4d4df] | 518 | outmap = new CorrelationToSurfaceMap;
|
|---|
| [244a84] | 519 | double ShortestDistance = 0.;
|
|---|
| 520 | BoundaryTriangleSet *ShortestTriangle = NULL;
|
|---|
| [e65de8] | 521 | for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) {
|
|---|
| [cca9ef] | 522 | RealSpaceMatrix FullMatrix = World::getInstance().getDomain().getM();
|
|---|
| 523 | RealSpaceMatrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
|
|---|
| [e65de8] | 524 | DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
|
|---|
| 525 | for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
|
|---|
| 526 | DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
|
|---|
| [e5c0a1] | 527 | for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
|
|---|
| [d74077] | 528 | if ((*type == NULL) || ((*iter)->getType() == *type)) {
|
|---|
| 529 | periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
|
|---|
| [e65de8] | 530 | // go through every range in xyz and get distance
|
|---|
| 531 | ShortestDistance = -1.;
|
|---|
| 532 | for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
|
|---|
| 533 | for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
|
|---|
| 534 | for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
|
|---|
| 535 | checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
|
|---|
| [d74077] | 536 | TriangleIntersectionList Intersections(checkX,Surface,LC);
|
|---|
| [e65de8] | 537 | distance = Intersections.GetSmallestDistance();
|
|---|
| 538 | triangle = Intersections.GetClosestTriangle();
|
|---|
| 539 | if ((ShortestDistance == -1.) || (distance < ShortestDistance)) {
|
|---|
| 540 | ShortestDistance = distance;
|
|---|
| 541 | ShortestTriangle = triangle;
|
|---|
| [99593f] | 542 | }
|
|---|
| [e65de8] | 543 | }
|
|---|
| 544 | // insert
|
|---|
| 545 | outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (*iter, ShortestTriangle) ) );
|
|---|
| 546 | //Log() << Verbose(1) << "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "." << endl;
|
|---|
| 547 | }
|
|---|
| [c4d4df] | 548 | }
|
|---|
| [e65de8] | 549 | }
|
|---|
| [c4d4df] | 550 |
|
|---|
| 551 | return outmap;
|
|---|
| 552 | };
|
|---|
| 553 |
|
|---|
| [bd61b41] | 554 | /** Returns the index of the bin for a given value.
|
|---|
| [c4d4df] | 555 | * \param value value whose bin to look for
|
|---|
| 556 | * \param BinWidth width of bin
|
|---|
| 557 | * \param BinStart first bin
|
|---|
| 558 | */
|
|---|
| [bd61b41] | 559 | int GetBin ( const double value, const double BinWidth, const double BinStart )
|
|---|
| [c4d4df] | 560 | {
|
|---|
| [92e5cb] | 561 | //Info FunctionInfo(__func__);
|
|---|
| [bd61b41] | 562 | int bin =(int) (floor((value - BinStart)/BinWidth));
|
|---|
| 563 | return (bin);
|
|---|
| [c4d4df] | 564 | };
|
|---|
| 565 |
|
|---|
| 566 |
|
|---|
| [92e5cb] | 567 | /** Adds header part that is unique to BinPairMap.
|
|---|
| 568 | *
|
|---|
| 569 | * @param file stream to print to
|
|---|
| [c4d4df] | 570 | */
|
|---|
| [92e5cb] | 571 | void OutputCorrelation_Header( ofstream * const file )
|
|---|
| [c4d4df] | 572 | {
|
|---|
| [92e5cb] | 573 | *file << "\tCount";
|
|---|
| [c4d4df] | 574 | };
|
|---|
| [b1f254] | 575 |
|
|---|
| [92e5cb] | 576 | /** Prints values stored in BinPairMap iterator.
|
|---|
| 577 | *
|
|---|
| 578 | * @param file stream to print to
|
|---|
| 579 | * @param runner iterator pointing at values to print
|
|---|
| [be945c] | 580 | */
|
|---|
| [92e5cb] | 581 | void OutputCorrelation_Value( ofstream * const file, BinPairMap::const_iterator &runner )
|
|---|
| [be945c] | 582 | {
|
|---|
| [92e5cb] | 583 | *file << runner->second;
|
|---|
| [be945c] | 584 | };
|
|---|
| 585 |
|
|---|
| [92e5cb] | 586 |
|
|---|
| 587 | /** Adds header part that is unique to DipoleAngularCorrelationMap.
|
|---|
| 588 | *
|
|---|
| 589 | * @param file stream to print to
|
|---|
| [b1f254] | 590 | */
|
|---|
| [92e5cb] | 591 | void OutputDipoleAngularCorrelation_Header( ofstream * const file )
|
|---|
| [b1f254] | 592 | {
|
|---|
| [4fc828] | 593 | *file << "\tMolecule";
|
|---|
| [b1f254] | 594 | };
|
|---|
| 595 |
|
|---|
| [208237b] | 596 | /** Prints values stored in DipoleCorrelationMap iterator.
|
|---|
| [92e5cb] | 597 | *
|
|---|
| 598 | * @param file stream to print to
|
|---|
| 599 | * @param runner iterator pointing at values to print
|
|---|
| [b1f254] | 600 | */
|
|---|
| [92e5cb] | 601 | void OutputDipoleAngularCorrelation_Value( ofstream * const file, DipoleAngularCorrelationMap::const_iterator &runner )
|
|---|
| [208237b] | 602 | {
|
|---|
| 603 | *file << runner->second->getId();
|
|---|
| 604 | };
|
|---|
| 605 |
|
|---|
| 606 |
|
|---|
| 607 | /** Adds header part that is unique to DipoleAngularCorrelationMap.
|
|---|
| 608 | *
|
|---|
| 609 | * @param file stream to print to
|
|---|
| 610 | */
|
|---|
| 611 | void OutputDipoleCorrelation_Header( ofstream * const file )
|
|---|
| 612 | {
|
|---|
| 613 | *file << "\tMolecule";
|
|---|
| 614 | };
|
|---|
| 615 |
|
|---|
| 616 | /** Prints values stored in DipoleCorrelationMap iterator.
|
|---|
| 617 | *
|
|---|
| 618 | * @param file stream to print to
|
|---|
| 619 | * @param runner iterator pointing at values to print
|
|---|
| 620 | */
|
|---|
| 621 | void OutputDipoleCorrelation_Value( ofstream * const file, DipoleCorrelationMap::const_iterator &runner )
|
|---|
| [b1f254] | 622 | {
|
|---|
| [92e5cb] | 623 | *file << runner->second.first->getId() << "\t" << runner->second.second->getId();
|
|---|
| [b1f254] | 624 | };
|
|---|
| 625 |
|
|---|
| [92e5cb] | 626 |
|
|---|
| 627 | /** Adds header part that is unique to PairCorrelationMap.
|
|---|
| 628 | *
|
|---|
| 629 | * @param file stream to print to
|
|---|
| [b1f254] | 630 | */
|
|---|
| [92e5cb] | 631 | void OutputPairCorrelation_Header( ofstream * const file )
|
|---|
| [b1f254] | 632 | {
|
|---|
| [92e5cb] | 633 | *file << "\tAtom1\tAtom2";
|
|---|
| 634 | };
|
|---|
| 635 |
|
|---|
| 636 | /** Prints values stored in PairCorrelationMap iterator.
|
|---|
| 637 | *
|
|---|
| 638 | * @param file stream to print to
|
|---|
| 639 | * @param runner iterator pointing at values to print
|
|---|
| 640 | */
|
|---|
| 641 | void OutputPairCorrelation_Value( ofstream * const file, PairCorrelationMap::const_iterator &runner )
|
|---|
| 642 | {
|
|---|
| 643 | *file << *(runner->second.first) << "\t" << *(runner->second.second);
|
|---|
| 644 | };
|
|---|
| 645 |
|
|---|
| 646 |
|
|---|
| 647 | /** Adds header part that is unique to CorrelationToPointMap.
|
|---|
| 648 | *
|
|---|
| 649 | * @param file stream to print to
|
|---|
| 650 | */
|
|---|
| 651 | void OutputCorrelationToPoint_Header( ofstream * const file )
|
|---|
| 652 | {
|
|---|
| 653 | *file << "\tAtom::x[i]-point.x[i]";
|
|---|
| 654 | };
|
|---|
| 655 |
|
|---|
| 656 | /** Prints values stored in CorrelationToPointMap iterator.
|
|---|
| 657 | *
|
|---|
| 658 | * @param file stream to print to
|
|---|
| 659 | * @param runner iterator pointing at values to print
|
|---|
| 660 | */
|
|---|
| 661 | void OutputCorrelationToPoint_Value( ofstream * const file, CorrelationToPointMap::const_iterator &runner )
|
|---|
| 662 | {
|
|---|
| 663 | for (int i=0;i<NDIM;i++)
|
|---|
| 664 | *file << "\t" << setprecision(8) << (runner->second.first->at(i) - runner->second.second->at(i));
|
|---|
| [b1f254] | 665 | };
|
|---|
| 666 |
|
|---|
| [92e5cb] | 667 |
|
|---|
| 668 | /** Adds header part that is unique to CorrelationToSurfaceMap.
|
|---|
| 669 | *
|
|---|
| 670 | * @param file stream to print to
|
|---|
| 671 | */
|
|---|
| 672 | void OutputCorrelationToSurface_Header( ofstream * const file )
|
|---|
| 673 | {
|
|---|
| 674 | *file << "\tTriangle";
|
|---|
| 675 | };
|
|---|
| 676 |
|
|---|
| 677 | /** Prints values stored in CorrelationToSurfaceMap iterator.
|
|---|
| 678 | *
|
|---|
| 679 | * @param file stream to print to
|
|---|
| 680 | * @param runner iterator pointing at values to print
|
|---|
| 681 | */
|
|---|
| 682 | void OutputCorrelationToSurface_Value( ofstream * const file, CorrelationToSurfaceMap::const_iterator &runner )
|
|---|
| 683 | {
|
|---|
| 684 | *file << *(runner->second.first) << "\t" << *(runner->second.second);
|
|---|
| 685 | };
|
|---|