source: src/analysis_correlation.cpp@ 6cfa36

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 6cfa36 was 112b09, checked in by Tillmann Crueger <crueger@…>, 15 years ago

Added #include "Helpers/MemDebug.hpp" to all .cpp files

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