Ignore:
Timestamp:
Jan 27, 2010, 2:36:09 PM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
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, 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
Children:
2ededc2
Parents:
1ca488f (diff), 244a84 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge commit 'heber/Analysis_PairCorrelation' into MenuRefactoring

Conflicts:

molecuilder/src/unittests/Makefile.am

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/analysis_correlation.cpp

    r1ca488f r04b6f9  
    1010#include "analysis_correlation.hpp"
    1111#include "element.hpp"
     12#include "info.hpp"
    1213#include "log.hpp"
    1314#include "molecule.hpp"
     
    2829PairCorrelationMap *PairCorrelation(MoleculeListClass * const &molecules, const element * const type1, const element * const type2 )
    2930{
     31  Info FunctionInfo(__func__);
    3032  PairCorrelationMap *outmap = NULL;
    3133  double distance = 0.;
     
    7779PairCorrelationMap *PeriodicPairCorrelation(MoleculeListClass * const &molecules, const element * const type1, const element * const type2, const int ranges[NDIM] )
    7880{
     81  Info FunctionInfo(__func__);
    7982  PairCorrelationMap *outmap = NULL;
    8083  double distance = 0.;
     
    154157CorrelationToPointMap *CorrelationToPoint(MoleculeListClass * const &molecules, const element * const type, const Vector *point )
    155158{
     159  Info FunctionInfo(__func__);
    156160  CorrelationToPointMap *outmap = NULL;
    157161  double distance = 0.;
     
    190194CorrelationToPointMap *PeriodicCorrelationToPoint(MoleculeListClass * const &molecules, const element * const type, const Vector *point, const int ranges[NDIM] )
    191195{
     196  Info FunctionInfo(__func__);
    192197  CorrelationToPointMap *outmap = NULL;
    193198  double distance = 0.;
     
    243248CorrelationToSurfaceMap *CorrelationToSurface(MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC )
    244249{
     250  Info FunctionInfo(__func__);
    245251  CorrelationToSurfaceMap *outmap = NULL;
    246252  double distance = 0;
     
    261267        Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;
    262268        if ((type == NULL) || (Walker->type == type)) {
    263           triangle = Surface->FindClosestTriangleToPoint(Walker->node, LC );
     269          triangle = Surface->FindClosestTriangleToVector(Walker->node, LC );
    264270          if (triangle != NULL) {
    265271            distance = DistanceToTrianglePlane(Walker->node, triangle);
     
    288294CorrelationToSurfaceMap *PeriodicCorrelationToSurface(MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] )
    289295{
     296  Info FunctionInfo(__func__);
    290297  CorrelationToSurfaceMap *outmap = NULL;
    291298  double distance = 0;
     
    301308  }
    302309  outmap = new CorrelationToSurfaceMap;
     310  double ShortestDistance = 0.;
     311  BoundaryTriangleSet *ShortestTriangle = NULL;
    303312  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    304313    if ((*MolWalker)->ActiveFlag) {
     
    314323          periodicX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
    315324          // go through every range in xyz and get distance
     325          ShortestDistance = -1.;
    316326          for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
    317327            for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
     
    320330                checkX.AddVector(&periodicX);
    321331                checkX.MatrixMultiplication(FullMatrix);
    322                 triangle = Surface->FindClosestTriangleToPoint(&checkX, LC );
    323                 if (triangle != NULL) {
    324                   distance = DistanceToTrianglePlane(&checkX, triangle);
    325                   outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> (Walker, triangle) ) );
     332                triangle = Surface->FindClosestTriangleToVector(&checkX, LC);
     333                distance = Surface->GetDistanceSquaredToTriangle(checkX, triangle);
     334                if ((ShortestDistance == -1.) || (distance < ShortestDistance)) {
     335                  ShortestDistance = distance;
     336                  ShortestTriangle = triangle;
    326337                }
    327           }
     338              }
     339          // insert
     340          ShortestDistance = sqrt(ShortestDistance);
     341          outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (Walker, ShortestTriangle) ) );
     342          //Log() << Verbose(1) << "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "." << endl;
    328343        }
    329344      }
     
    342357double GetBin ( const double value, const double BinWidth, const double BinStart )
    343358{
     359  Info FunctionInfo(__func__);
    344360  double bin =(double) (floor((value - BinStart)/BinWidth));
    345361  return (bin*BinWidth+BinStart);
     
    353369void OutputCorrelation( ofstream * const file, const BinPairMap * const map )
    354370{
     371  Info FunctionInfo(__func__);
    355372  *file << "# BinStart\tCount" << endl;
    356373  for (BinPairMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) {
     
    365382void OutputPairCorrelation( ofstream * const file, const PairCorrelationMap * const map )
    366383{
     384  Info FunctionInfo(__func__);
    367385  *file << "# BinStart\tAtom1\tAtom2" << endl;
    368386  for (PairCorrelationMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) {
     
    377395void OutputCorrelationToPoint( ofstream * const file, const CorrelationToPointMap * const map )
    378396{
     397  Info FunctionInfo(__func__);
    379398  *file << "# BinStart\tAtom::x[i]-point.x[i]" << endl;
    380399  for (CorrelationToPointMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) {
     
    392411void OutputCorrelationToSurface( ofstream * const file, const CorrelationToSurfaceMap * const map )
    393412{
     413  Info FunctionInfo(__func__);
    394414  *file << "# BinStart\tTriangle" << endl;
    395415  for (CorrelationToSurfaceMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) {
    396     *file << runner->first << "\t" << *(runner->second.second) << endl;
    397   }
    398 };
    399 
     416    *file << runner->first << "\t" << *(runner->second.first) << "\t" << *(runner->second.second) << endl;
     417  }
     418};
     419
Note: See TracChangeset for help on using the changeset viewer.