source: src/analysis_correlation.cpp@ 53731f

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 Candidate_v1.7.0 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 53731f was 9879f6, checked in by Frederik Heber <heber@…>, 16 years ago

Huge Refactoring due to class molecule now being an STL container.

  • molecule::start and molecule::end were dropped. Hence, the usual construct Walker = start while (Walker->next != end) {

Walker = walker->next
...

}
was changed to
for (molecule::iterator iter = begin(); iter != end(); ++iter) {

...

}
and (*iter) used instead of Walker.

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