Changeset e138de for src/analysis_correlation.cpp
- Timestamp:
- Nov 4, 2009, 7:56:04 PM (16 years ago)
- Branches:
- 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
- Children:
- 1614174, e5ad5c
- Parents:
- 7326b2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/analysis_correlation.cpp
r7326b2 re138de 10 10 #include "analysis_correlation.hpp" 11 11 #include "element.hpp" 12 #include "log.hpp" 12 13 #include "molecule.hpp" 13 14 #include "tesselation.hpp" … … 25 26 * \return Map of doubles with values the pair of the two atoms. 26 27 */ 27 PairCorrelationMap *PairCorrelation( ofstream * const out,MoleculeListClass * const &molecules, const element * const type1, const element * const type2 )28 PairCorrelationMap *PairCorrelation(MoleculeListClass * const &molecules, const element * const type1, const element * const type2 ) 28 29 { 29 30 PairCorrelationMap *outmap = NULL; … … 31 32 32 33 if (molecules->ListOfMolecules.empty()) { 33 cerr<< Verbose(1) <<"No molecule given." << endl;34 eLog() << Verbose(1) <<"No molecule given." << endl; 34 35 return outmap; 35 36 } … … 37 38 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 38 39 if ((*MolWalker)->ActiveFlag) { 39 cerr<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;40 atom *Walker = (*MolWalker)->start; 41 while (Walker->next != (*MolWalker)->end) { 42 Walker = Walker->next; 43 *out<< Verbose(3) << "Current atom is " << *Walker << "." << endl;40 eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl; 41 atom *Walker = (*MolWalker)->start; 42 while (Walker->next != (*MolWalker)->end) { 43 Walker = Walker->next; 44 Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl; 44 45 if ((type1 == NULL) || (Walker->type == type1)) { 45 46 for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++) 46 47 if ((*MolOtherWalker)->ActiveFlag) { 47 *out<< Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl;48 Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl; 48 49 atom *OtherWalker = (*MolOtherWalker)->start; 49 50 while (OtherWalker->next != (*MolOtherWalker)->end) { // only go up to Walker 50 51 OtherWalker = OtherWalker->next; 51 *out<< Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl;52 Log() << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl; 52 53 if (Walker->nr < OtherWalker->nr) 53 54 if ((type2 == NULL) || (OtherWalker->type == type2)) { 54 55 distance = Walker->node->PeriodicDistance(OtherWalker->node, (*MolWalker)->cell_size); 55 // *out<< Verbose(1) <<"Inserting " << *Walker << " and " << *OtherWalker << endl;56 //Log() << Verbose(1) <<"Inserting " << *Walker << " and " << *OtherWalker << endl; 56 57 outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> (Walker, OtherWalker) ) ); 57 58 } … … 74 75 * \return Map of doubles with values the pair of the two atoms. 75 76 */ 76 PairCorrelationMap *PeriodicPairCorrelation( ofstream * const out,MoleculeListClass * const &molecules, const element * const type1, const element * const type2, const int ranges[NDIM] )77 PairCorrelationMap *PeriodicPairCorrelation(MoleculeListClass * const &molecules, const element * const type1, const element * const type2, const int ranges[NDIM] ) 77 78 { 78 79 PairCorrelationMap *outmap = NULL; … … 86 87 87 88 if (molecules->ListOfMolecules.empty()) { 88 cerr<< Verbose(1) <<"No molecule given." << endl;89 eLog() << Verbose(1) <<"No molecule given." << endl; 89 90 return outmap; 90 91 } … … 94 95 const double * const FullMatrix = ReturnFullMatrixforSymmetric((*MolWalker)->cell_size); 95 96 const double * const FullInverseMatrix = InverseMatrix(FullMatrix); 96 cerr<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;97 atom *Walker = (*MolWalker)->start; 98 while (Walker->next != (*MolWalker)->end) { 99 Walker = Walker->next; 100 *out<< Verbose(3) << "Current atom is " << *Walker << "." << endl;97 eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl; 98 atom *Walker = (*MolWalker)->start; 99 while (Walker->next != (*MolWalker)->end) { 100 Walker = Walker->next; 101 Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl; 101 102 if ((type1 == NULL) || (Walker->type == type1)) { 102 103 periodicX.CopyVector(Walker->node); … … 111 112 for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++) 112 113 if ((*MolOtherWalker)->ActiveFlag) { 113 *out<< Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl;114 Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl; 114 115 atom *OtherWalker = (*MolOtherWalker)->start; 115 116 while (OtherWalker->next != (*MolOtherWalker)->end) { // only go up to Walker 116 117 OtherWalker = OtherWalker->next; 117 *out<< Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl;118 Log() << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl; 118 119 if (Walker->nr < OtherWalker->nr) 119 120 if ((type2 == NULL) || (OtherWalker->type == type2)) { … … 128 129 checkOtherX.MatrixMultiplication(FullMatrix); 129 130 distance = checkX.Distance(&checkOtherX); 130 // *out<< Verbose(1) <<"Inserting " << *Walker << " and " << *OtherWalker << endl;131 //Log() << Verbose(1) <<"Inserting " << *Walker << " and " << *OtherWalker << endl; 131 132 outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> (Walker, OtherWalker) ) ); 132 133 } … … 149 150 * \return Map of dobules with values as pairs of atom and the vector 150 151 */ 151 CorrelationToPointMap *CorrelationToPoint( ofstream * const out,MoleculeListClass * const &molecules, const element * const type, const Vector *point )152 CorrelationToPointMap *CorrelationToPoint(MoleculeListClass * const &molecules, const element * const type, const Vector *point ) 152 153 { 153 154 CorrelationToPointMap *outmap = NULL; … … 155 156 156 157 if (molecules->ListOfMolecules.empty()) { 157 *out<< Verbose(1) <<"No molecule given." << endl;158 Log() << Verbose(1) <<"No molecule given." << endl; 158 159 return outmap; 159 160 } … … 161 162 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 162 163 if ((*MolWalker)->ActiveFlag) { 163 *out<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;164 atom *Walker = (*MolWalker)->start; 165 while (Walker->next != (*MolWalker)->end) { 166 Walker = Walker->next; 167 *out<< Verbose(3) << "Current atom is " << *Walker << "." << endl;164 Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl; 165 atom *Walker = (*MolWalker)->start; 166 while (Walker->next != (*MolWalker)->end) { 167 Walker = Walker->next; 168 Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl; 168 169 if ((type == NULL) || (Walker->type == type)) { 169 170 distance = Walker->node->PeriodicDistance(point, (*MolWalker)->cell_size); 170 *out<< Verbose(4) << "Current distance is " << distance << "." << endl;171 Log() << Verbose(4) << "Current distance is " << distance << "." << endl; 171 172 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (Walker, point) ) ); 172 173 } … … 185 186 * \return Map of dobules with values as pairs of atom and the vector 186 187 */ 187 CorrelationToPointMap *PeriodicCorrelationToPoint( ofstream * const out,MoleculeListClass * const &molecules, const element * const type, const Vector *point, const int ranges[NDIM] )188 CorrelationToPointMap *PeriodicCorrelationToPoint(MoleculeListClass * const &molecules, const element * const type, const Vector *point, const int ranges[NDIM] ) 188 189 { 189 190 CorrelationToPointMap *outmap = NULL; … … 194 195 195 196 if (molecules->ListOfMolecules.empty()) { 196 *out<< Verbose(1) <<"No molecule given." << endl;197 Log() << Verbose(1) <<"No molecule given." << endl; 197 198 return outmap; 198 199 } … … 202 203 const double * const FullMatrix = ReturnFullMatrixforSymmetric((*MolWalker)->cell_size); 203 204 const double * const FullInverseMatrix = InverseMatrix(FullMatrix); 204 *out<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;205 atom *Walker = (*MolWalker)->start; 206 while (Walker->next != (*MolWalker)->end) { 207 Walker = Walker->next; 208 *out<< Verbose(3) << "Current atom is " << *Walker << "." << endl;205 Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl; 206 atom *Walker = (*MolWalker)->start; 207 while (Walker->next != (*MolWalker)->end) { 208 Walker = Walker->next; 209 Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl; 209 210 if ((type == NULL) || (Walker->type == type)) { 210 211 periodicX.CopyVector(Walker->node); … … 218 219 checkX.MatrixMultiplication(FullMatrix); 219 220 distance = checkX.Distance(point); 220 *out<< Verbose(4) << "Current distance is " << distance << "." << endl;221 Log() << Verbose(4) << "Current distance is " << distance << "." << endl; 221 222 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (Walker, point) ) ); 222 223 } … … 236 237 * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest 237 238 */ 238 CorrelationToSurfaceMap *CorrelationToSurface( ofstream * const out,MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC )239 CorrelationToSurfaceMap *CorrelationToSurface(MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC ) 239 240 { 240 241 CorrelationToSurfaceMap *outmap = NULL; … … 244 245 245 246 if ((Surface == NULL) || (LC == NULL) || (molecules->ListOfMolecules.empty())) { 246 *out<< Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl;247 Log() << Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl; 247 248 return outmap; 248 249 } … … 250 251 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 251 252 if ((*MolWalker)->ActiveFlag) { 252 *out<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;253 atom *Walker = (*MolWalker)->start; 254 while (Walker->next != (*MolWalker)->end) { 255 Walker = Walker->next; 256 *out<< Verbose(3) << "Current atom is " << *Walker << "." << endl;253 Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl; 254 atom *Walker = (*MolWalker)->start; 255 while (Walker->next != (*MolWalker)->end) { 256 Walker = Walker->next; 257 Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl; 257 258 if ((type == NULL) || (Walker->type == type)) { 258 triangle = Surface->FindClosestTriangleToPoint( out,Walker->node, LC );259 triangle = Surface->FindClosestTriangleToPoint(Walker->node, LC ); 259 260 if (triangle != NULL) { 260 distance = DistanceToTrianglePlane( out,Walker->node, triangle);261 distance = DistanceToTrianglePlane(Walker->node, triangle); 261 262 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> (Walker, triangle) ) ); 262 263 } … … 281 282 * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest 282 283 */ 283 CorrelationToSurfaceMap *PeriodicCorrelationToSurface( ofstream * const out,MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] )284 CorrelationToSurfaceMap *PeriodicCorrelationToSurface(MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] ) 284 285 { 285 286 CorrelationToSurfaceMap *outmap = NULL; … … 292 293 293 294 if ((Surface == NULL) || (LC == NULL) || (molecules->ListOfMolecules.empty())) { 294 *out<< Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl;295 Log() << Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl; 295 296 return outmap; 296 297 } … … 300 301 const double * const FullMatrix = ReturnFullMatrixforSymmetric((*MolWalker)->cell_size); 301 302 const double * const FullInverseMatrix = InverseMatrix(FullMatrix); 302 *out<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;303 atom *Walker = (*MolWalker)->start; 304 while (Walker->next != (*MolWalker)->end) { 305 Walker = Walker->next; 306 *out<< Verbose(3) << "Current atom is " << *Walker << "." << endl;303 Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl; 304 atom *Walker = (*MolWalker)->start; 305 while (Walker->next != (*MolWalker)->end) { 306 Walker = Walker->next; 307 Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl; 307 308 if ((type == NULL) || (Walker->type == type)) { 308 309 periodicX.CopyVector(Walker->node); … … 315 316 checkX.AddVector(&periodicX); 316 317 checkX.MatrixMultiplication(FullMatrix); 317 triangle = Surface->FindClosestTriangleToPoint( out,&checkX, LC );318 triangle = Surface->FindClosestTriangleToPoint(&checkX, LC ); 318 319 if (triangle != NULL) { 319 distance = DistanceToTrianglePlane( out,&checkX, triangle);320 distance = DistanceToTrianglePlane(&checkX, triangle); 320 321 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> (Walker, triangle) ) ); 321 322 }
Note:
See TracChangeset
for help on using the changeset viewer.