source: src/analysis_correlation.cpp@ bbbad5

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since bbbad5 was b5c53d, checked in by Frederik Heber <heber@…>, 14 years ago

Merge branch 'StructureRefactoring' into stable

Conflicts:

src/Actions/AtomAction/AddAction.cpp
src/Actions/AtomAction/ChangeElementAction.cpp
src/Parser/XyzParser.cpp
src/analysis_correlation.cpp
src/atom.cpp
src/config.cpp
src/molecule.cpp

  • AtomInfo::element were privatized in stable and element::symbol, ::name in StructureRefactoring (overlapped in various lines).
  • Property mode set to 100644
File size: 21.4 KB
Line 
1/*
2 * analysis.cpp
3 *
4 * Created on: Oct 13, 2009
5 * Author: heber
6 */
7
8#include "Helpers/MemDebug.hpp"
9
10#include <iostream>
11#include <iomanip>
12
13#include "BoundaryTriangleSet.hpp"
14#include "analysis_correlation.hpp"
15#include "element.hpp"
16#include "Helpers/Info.hpp"
17#include "Helpers/Log.hpp"
18#include "molecule.hpp"
19#include "tesselation.hpp"
20#include "tesselationhelpers.hpp"
21#include "triangleintersectionlist.hpp"
22#include "LinearAlgebra/Vector.hpp"
23#include "LinearAlgebra/Matrix.hpp"
24#include "Helpers/Verbose.hpp"
25#include "World.hpp"
26#include "Box.hpp"
27
28
29/** Calculates the pair correlation between given elements.
30 * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si))
31 * \param *molecules vector of molecules
32 * \param &elements vector of elements to correlate
33 * \return Map of doubles with values the pair of the two atoms.
34 */
35PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector<const element *> &elements)
36{
37 Info FunctionInfo(__func__);
38 PairCorrelationMap *outmap = NULL;
39 double distance = 0.;
40 Box &domain = World::getInstance().getDomain();
41
42 if (molecules.empty()) {
43 DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl);
44 return outmap;
45 }
46 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
47 (*MolWalker)->doCountAtoms();
48
49 // create all possible pairs of elements
50 set <pair<const element *,const element *> > PairsOfElements;
51 if (elements.size() >= 2) {
52 for (vector<const element *>::const_iterator type1 = elements.begin(); type1 != elements.end(); ++type1)
53 for (vector<const element *>::const_iterator type2 = elements.begin(); type2 != elements.end(); ++type2)
54 if (type1 != type2) {
55 PairsOfElements.insert( make_pair(*type1,*type2) );
56 DoLog(1) && (Log() << Verbose(1) << "Creating element pair " << *(*type1) << " and " << *(*type2) << "." << endl);
57 }
58 } else if (elements.size() == 1) { // one to all are valid
59 const element *elemental = *elements.begin();
60 PairsOfElements.insert( pair<const element *,const element*>(elemental,0) );
61 PairsOfElements.insert( pair<const element *,const element*>(0,elemental) );
62 } else { // all elements valid
63 PairsOfElements.insert( pair<element *, element*>((element *)NULL, (element *)NULL) );
64 }
65
66 outmap = new PairCorrelationMap;
67 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++){
68 DoLog(2) && (Log()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
69 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
70 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
71 for (std::vector<molecule *>::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules.end(); MolOtherWalker++){
72 DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl);
73 for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) {
74 DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl);
75 if ((*iter)->getId() < (*runner)->getId()){
76 for (set <pair<const element *, const element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
77 if ((PairRunner->first == (**iter).getType()) && (PairRunner->second == (**runner).getType())) {
78 distance = domain.periodicDistance((*iter)->getPosition(),(*runner)->getPosition());
79 //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
80 outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
81 }
82 }
83 }
84 }
85 }
86 }
87 return outmap;
88};
89
90/** Calculates the pair correlation between given elements.
91 * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si))
92 * \param *molecules list of molecules structure
93 * \param &elements vector of elements to correlate
94 * \param ranges[NDIM] interval boundaries for the periodic images to scan also
95 * \return Map of doubles with values the pair of the two atoms.
96 */
97PairCorrelationMap *PeriodicPairCorrelation(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const int ranges[NDIM] )
98{
99 Info FunctionInfo(__func__);
100 PairCorrelationMap *outmap = NULL;
101 double distance = 0.;
102 int n[NDIM];
103 Vector checkX;
104 Vector periodicX;
105 int Othern[NDIM];
106 Vector checkOtherX;
107 Vector periodicOtherX;
108
109 if (molecules.empty()) {
110 DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl);
111 return outmap;
112 }
113 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
114 (*MolWalker)->doCountAtoms();
115
116 // create all possible pairs of elements
117 set <pair<const element *,const element *> > PairsOfElements;
118 if (elements.size() >= 2) {
119 for (vector<const element *>::const_iterator type1 = elements.begin(); type1 != elements.end(); ++type1)
120 for (vector<const element *>::const_iterator type2 = elements.begin(); type2 != elements.end(); ++type2)
121 if (type1 != type2) {
122 PairsOfElements.insert( make_pair(*type1,*type2) );
123 DoLog(1) && (Log() << Verbose(1) << "Creating element pair " << *(*type1) << " and " << *(*type2) << "." << endl);
124 }
125 } else if (elements.size() == 1) { // one to all are valid
126 const element *elemental = *elements.begin();
127 PairsOfElements.insert( pair<const element *,const element*>(elemental,0) );
128 PairsOfElements.insert( pair<const element *,const element*>(0,elemental) );
129 } else { // all elements valid
130 PairsOfElements.insert( pair<element *, element*>((element *)NULL, (element *)NULL) );
131 }
132
133 outmap = new PairCorrelationMap;
134 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++){
135 Matrix FullMatrix = World::getInstance().getDomain().getM();
136 Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
137 DoLog(2) && (Log()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
138 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
139 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
140 periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
141 // go through every range in xyz and get distance
142 for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
143 for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
144 for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
145 checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
146 for (std::vector<molecule *>::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules.end(); MolOtherWalker++){
147 DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl);
148 for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) {
149 DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl);
150 if ((*iter)->getId() < (*runner)->getId()){
151 for (set <pair<const element *,const element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
152 if ((PairRunner->first == (**iter).getType()) && (PairRunner->second == (**runner).getType())) {
153 periodicOtherX = FullInverseMatrix * ((*runner)->getPosition()); // x now in [0,1)^3
154 // go through every range in xyz and get distance
155 for (Othern[0]=-ranges[0]; Othern[0] <= ranges[0]; Othern[0]++)
156 for (Othern[1]=-ranges[1]; Othern[1] <= ranges[1]; Othern[1]++)
157 for (Othern[2]=-ranges[2]; Othern[2] <= ranges[2]; Othern[2]++) {
158 checkOtherX = FullMatrix * (Vector(Othern[0], Othern[1], Othern[2]) + periodicOtherX);
159 distance = checkX.distance(checkOtherX);
160 //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
161 outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
162 }
163 }
164 }
165 }
166 }
167 }
168 }
169 }
170
171 return outmap;
172};
173
174/** Calculates the distance (pair) correlation between a given element and a point.
175 * \param *molecules list of molecules structure
176 * \param &elements vector of elements to correlate with point
177 * \param *point vector to the correlation point
178 * \return Map of dobules with values as pairs of atom and the vector
179 */
180CorrelationToPointMap *CorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Vector *point )
181{
182 Info FunctionInfo(__func__);
183 CorrelationToPointMap *outmap = NULL;
184 double distance = 0.;
185 Box &domain = World::getInstance().getDomain();
186
187 if (molecules.empty()) {
188 DoLog(1) && (Log() << Verbose(1) <<"No molecule given." << endl);
189 return outmap;
190 }
191 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
192 (*MolWalker)->doCountAtoms();
193 outmap = new CorrelationToPointMap;
194 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) {
195 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
196 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
197 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
198 for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
199 if ((*type == NULL) || ((*iter)->getType() == *type)) {
200 distance = domain.periodicDistance((*iter)->getPosition(),*point);
201 DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
202 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) );
203 }
204 }
205 }
206
207 return outmap;
208};
209
210/** Calculates the distance (pair) correlation between a given element, all its periodic images and a point.
211 * \param *molecules list of molecules structure
212 * \param &elements vector of elements to correlate to point
213 * \param *point vector to the correlation point
214 * \param ranges[NDIM] interval boundaries for the periodic images to scan also
215 * \return Map of dobules with values as pairs of atom and the vector
216 */
217CorrelationToPointMap *PeriodicCorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Vector *point, const int ranges[NDIM] )
218{
219 Info FunctionInfo(__func__);
220 CorrelationToPointMap *outmap = NULL;
221 double distance = 0.;
222 int n[NDIM];
223 Vector periodicX;
224 Vector checkX;
225
226 if (molecules.empty()) {
227 DoLog(1) && (Log() << Verbose(1) <<"No molecule given." << endl);
228 return outmap;
229 }
230 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
231 (*MolWalker)->doCountAtoms();
232 outmap = new CorrelationToPointMap;
233 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) {
234 Matrix FullMatrix = World::getInstance().getDomain().getM();
235 Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
236 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
237 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
238 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
239 for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
240 if ((*type == NULL) || ((*iter)->getType() == *type)) {
241 periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
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 distance = checkX.distance(*point);
248 DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
249 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (*iter, point) ) );
250 }
251 }
252 }
253 }
254
255 return outmap;
256};
257
258/** Calculates the distance (pair) correlation between a given element and a surface.
259 * \param *molecules list of molecules structure
260 * \param &elements vector of elements to correlate to surface
261 * \param *Surface pointer to Tesselation class surface
262 * \param *LC LinkedCell structure to quickly find neighbouring atoms
263 * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest
264 */
265CorrelationToSurfaceMap *CorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Tesselation * const Surface, const LinkedCell *LC )
266{
267 Info FunctionInfo(__func__);
268 CorrelationToSurfaceMap *outmap = NULL;
269 double distance = 0;
270 class BoundaryTriangleSet *triangle = NULL;
271 Vector centroid;
272
273 if ((Surface == NULL) || (LC == NULL) || (molecules.empty())) {
274 DoeLog(1) && (eLog()<< Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl);
275 return outmap;
276 }
277 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
278 (*MolWalker)->doCountAtoms();
279 outmap = new CorrelationToSurfaceMap;
280 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) {
281 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << (*MolWalker)->name << "." << endl);
282 if ((*MolWalker)->empty())
283 DoLog(2) && (2) && (Log() << Verbose(2) << "\t is empty." << endl);
284 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
285 DoLog(3) && (Log() << Verbose(3) << "\tCurrent atom is " << *(*iter) << "." << endl);
286 for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
287 if ((*type == NULL) || ((*iter)->getType() == *type)) {
288 TriangleIntersectionList Intersections((*iter)->getPosition(),Surface,LC);
289 distance = Intersections.GetSmallestDistance();
290 triangle = Intersections.GetClosestTriangle();
291 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> ((*iter), triangle) ) );
292 }
293 }
294 }
295
296 return outmap;
297};
298
299/** Calculates the distance (pair) correlation between a given element, all its periodic images and and a surface.
300 * Note that we also put all periodic images found in the cells given by [ -ranges[i], ranges[i] ] and i=0,...,NDIM-1.
301 * 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
302 * axis an integer from [ -ranges[i], ranges[i] ] onto it and multiply with the domain matrix to bring it back into
303 * the real space. Then, we Tesselation::FindClosestTriangleToPoint() and DistanceToTrianglePlane().
304 * \param *molecules list of molecules structure
305 * \param &elements vector of elements to correlate to surface
306 * \param *Surface pointer to Tesselation class surface
307 * \param *LC LinkedCell structure to quickly find neighbouring atoms
308 * \param ranges[NDIM] interval boundaries for the periodic images to scan also
309 * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest
310 */
311CorrelationToSurfaceMap *PeriodicCorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] )
312{
313 Info FunctionInfo(__func__);
314 CorrelationToSurfaceMap *outmap = NULL;
315 double distance = 0;
316 class BoundaryTriangleSet *triangle = NULL;
317 Vector centroid;
318 int n[NDIM];
319 Vector periodicX;
320 Vector checkX;
321
322 if ((Surface == NULL) || (LC == NULL) || (molecules.empty())) {
323 DoLog(1) && (Log() << Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl);
324 return outmap;
325 }
326 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++)
327 (*MolWalker)->doCountAtoms();
328 outmap = new CorrelationToSurfaceMap;
329 double ShortestDistance = 0.;
330 BoundaryTriangleSet *ShortestTriangle = NULL;
331 for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin(); MolWalker != molecules.end(); MolWalker++) {
332 Matrix FullMatrix = World::getInstance().getDomain().getM();
333 Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
334 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
335 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
336 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
337 for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
338 if ((*type == NULL) || ((*iter)->getType() == *type)) {
339 periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
340 // go through every range in xyz and get distance
341 ShortestDistance = -1.;
342 for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
343 for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
344 for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
345 checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
346 TriangleIntersectionList Intersections(checkX,Surface,LC);
347 distance = Intersections.GetSmallestDistance();
348 triangle = Intersections.GetClosestTriangle();
349 if ((ShortestDistance == -1.) || (distance < ShortestDistance)) {
350 ShortestDistance = distance;
351 ShortestTriangle = triangle;
352 }
353 }
354 // insert
355 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (*iter, ShortestTriangle) ) );
356 //Log() << Verbose(1) << "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "." << endl;
357 }
358 }
359 }
360
361 return outmap;
362};
363
364/** Returns the index of the bin for a given value.
365 * \param value value whose bin to look for
366 * \param BinWidth width of bin
367 * \param BinStart first bin
368 */
369int GetBin ( const double value, const double BinWidth, const double BinStart )
370{
371 Info FunctionInfo(__func__);
372 int bin =(int) (floor((value - BinStart)/BinWidth));
373 return (bin);
374};
375
376
377/** Prints correlation (double, int) pairs to file.
378 * \param *file file to write to
379 * \param *map map to write
380 */
381void OutputCorrelation( ofstream * const file, const BinPairMap * const map )
382{
383 Info FunctionInfo(__func__);
384 *file << "BinStart\tCount" << endl;
385 for (BinPairMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) {
386 *file << setprecision(8) << runner->first << "\t" << runner->second << endl;
387 }
388};
389
390/** Prints correlation (double, (atom*,atom*) ) pairs to file.
391 * \param *file file to write to
392 * \param *map map to write
393 */
394void OutputPairCorrelation( ofstream * const file, const PairCorrelationMap * const map )
395{
396 Info FunctionInfo(__func__);
397 *file << "BinStart\tAtom1\tAtom2" << endl;
398 for (PairCorrelationMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) {
399 *file << setprecision(8) << runner->first << "\t" << *(runner->second.first) << "\t" << *(runner->second.second) << endl;
400 }
401};
402
403/** Prints correlation (double, int) pairs to file.
404 * \param *file file to write to
405 * \param *map map to write
406 */
407void OutputCorrelationToPoint( ofstream * const file, const CorrelationToPointMap * const map )
408{
409 Info FunctionInfo(__func__);
410 *file << "BinStart\tAtom::x[i]-point.x[i]" << endl;
411 for (CorrelationToPointMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) {
412 *file << runner->first;
413 for (int i=0;i<NDIM;i++)
414 *file << "\t" << setprecision(8) << (runner->second.first->at(i) - runner->second.second->at(i));
415 *file << endl;
416 }
417};
418
419/** Prints correlation (double, int) pairs to file.
420 * \param *file file to write to
421 * \param *map map to write
422 */
423void OutputCorrelationToSurface( ofstream * const file, const CorrelationToSurfaceMap * const map )
424{
425 Info FunctionInfo(__func__);
426 *file << "BinStart\tTriangle" << endl;
427 if (!map->empty())
428 for (CorrelationToSurfaceMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) {
429 *file << setprecision(8) << runner->first << "\t";
430 *file << *(runner->second.first) << "\t";
431 *file << *(runner->second.second) << endl;
432 }
433};
434
Note: See TracBrowser for help on using the repository browser.