Changeset 014475
- Timestamp:
- Jul 1, 2010, 1:44:39 PM (14 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:
- 8f822c
- Parents:
- 12cf773
- Location:
- src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Box.cpp
r12cf773 r014475 51 51 } 52 52 53 Vector Box::translateIn(const Vector &point) {53 Vector Box::translateIn(const Vector &point) const{ 54 54 return (*M) * point; 55 55 } 56 56 57 Vector Box::translateOut(const Vector &point) {57 Vector Box::translateOut(const Vector &point) const{ 58 58 return (*Minv) * point; 59 59 } 60 60 61 Vector Box::WrapPeriodically(const Vector &point) {61 Vector Box::WrapPeriodically(const Vector &point) const{ 62 62 Vector helper = translateOut(point); 63 63 for(int i=NDIM;i--;){ … … 71 71 } 72 72 73 VECTORSET(std::list) Box::explode(const Vector &point) {73 VECTORSET(std::list) Box::explode(const Vector &point) const{ 74 74 VECTORSET(std::list) res; 75 75 … … 91 91 } 92 92 93 double Box::periodicDistanceSquared(const Vector &point1,const Vector &point2){ 94 VectorSet<std::list<Vector> > expansion = explode(point1); 95 return expansion.minDistSquared(point2); 93 double Box::periodicDistanceSquared(const Vector &point1,const Vector &point2) const{ 94 VECTORSET(std::list) expansion = explode(point1); 95 double res = expansion.minDistSquared(point2); 96 return res; 97 } 98 99 double Box::periodicDistance(const Vector &point1,const Vector &point2) const{ 100 double res; 101 res = sqrt(periodicDistanceSquared(point1,point2)); 102 return res; 96 103 } 97 104 -
src/Box.hpp
r12cf773 r014475 29 29 Box &operator=(const Matrix&); 30 30 31 Vector translateIn(const Vector &point) ;32 Vector translateOut(const Vector &point) ;31 Vector translateIn(const Vector &point) const; 32 Vector translateOut(const Vector &point) const; 33 33 34 Vector WrapPeriodically(const Vector &point) ;35 VECTORSET(std::list) explode(const Vector &point) ;34 Vector WrapPeriodically(const Vector &point) const; 35 VECTORSET(std::list) explode(const Vector &point) const; 36 36 37 double periodicDistanceSquared(const Vector &point1,const Vector &point2); 37 double periodicDistanceSquared(const Vector &point1,const Vector &point2) const; 38 double periodicDistance(const Vector &point1,const Vector &point2) const; 38 39 39 40 private: -
src/VectorSet.hpp
r12cf773 r014475 57 57 return std::numeric_limits<double>::infinity(); 58 58 std::list<double> helper; 59 helper.resize(this->size()); 59 60 transform(this->begin(),this->end(), 60 61 helper.begin(), -
src/analysis_correlation.cpp
r12cf773 r014475 36 36 PairCorrelationMap *outmap = NULL; 37 37 double distance = 0.; 38 const Matrix &domain = World::getInstance().getDomain().getM();38 Box &domain = World::getInstance().getDomain(); 39 39 40 40 if (molecules->ListOfMolecules.empty()) { … … 77 77 for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner) 78 78 if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) { 79 distance = (*iter)->node->PeriodicDistance(*(*runner)->node, domain);79 distance = domain.periodicDistance(*(*iter)->node,*(*runner)->node); 80 80 //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl; 81 81 outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) ); … … 191 191 CorrelationToPointMap *outmap = NULL; 192 192 double distance = 0.; 193 const Matrix &domain = World::getInstance().getDomain().getM();193 Box &domain = World::getInstance().getDomain(); 194 194 195 195 if (molecules->ListOfMolecules.empty()) { … … 207 207 for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 208 208 if ((*type == NULL) || ((*iter)->type == *type)) { 209 distance = (*iter)->node->PeriodicDistance(*point, domain);209 distance = domain.periodicDistance(*(*iter)->node,*point); 210 210 DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl); 211 211 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) ); -
src/molecule_graph.cpp
r12cf773 r014475 123 123 LinkedCell *LC = NULL; 124 124 bool free_BG = false; 125 const Matrix &M = World::getInstance().getDomain().getM();125 Box &domain = World::getInstance().getDomain(); 126 126 127 127 if (BG == NULL) { … … 180 180 //Log() << Verbose(1) << "Checking distance " << OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size) << " against typical bond length of " << bonddistance*bonddistance << "." << endl; 181 181 (BG->*minmaxdistance)(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem); 182 const double distance = OtherWalker->x.PeriodicDistanceSquared(Walker->x,M);182 const double distance = domain.periodicDistanceSquared(OtherWalker->x,Walker->x); 183 183 const bool status = (distance <= MaxDistance * MaxDistance) && (distance >= MinDistance * MinDistance); 184 184 // Log() << Verbose(1) << "MinDistance is " << MinDistance << " and MaxDistance is " << MaxDistance << "." << endl; -
src/vector.cpp
r12cf773 r014475 97 97 return *this; 98 98 } 99 100 /** Calculates distance between this and another vector in a periodic cell.101 * \param *y array to second vector102 * \param *cell_size 6-dimensional array with (xx, xy, yy, xz, yz, zz) entries specifying the periodic cell103 * \return \f$| x - y |\f$104 */105 double Vector::PeriodicDistance(const Vector &y, const Matrix &cell_size) const106 {107 return sqrt(PeriodicDistanceSquared(y,cell_size));108 };109 110 /** Calculates distance between this and another vector in a periodic cell.111 * \param *y array to second vector112 * \param *cell_size 6-dimensional array with (xx, xy, yy, xz, yz, zz) entries specifying the periodic cell113 * \return \f$| x - y |^2\f$114 */115 double Vector::PeriodicDistanceSquared(const Vector &y, const Matrix &cell_size) const116 {117 double res = DistanceSquared(y), tmp;118 Vector Shiftedy, TranslationVector;119 int N[NDIM];120 121 // in order to check the periodic distance, translate one of the vectors into each of the 27 neighbouring cells122 for (N[0]=-1;N[0]<=1;N[0]++)123 for (N[1]=-1;N[1]<=1;N[1]++)124 for (N[2]=-1;N[2]<=1;N[2]++) {125 // create the translation vector126 TranslationVector = cell_size * Vector(N[0],N[1],N[2]);127 // add onto the original vector to compare with128 Shiftedy = y + TranslationVector;129 // get distance and compare with minimum so far130 tmp = DistanceSquared(Shiftedy);131 if (tmp < res) res = tmp;132 }133 return (res);134 };135 99 136 100 /** Calculates scalar product between this and another vector. -
src/vector.hpp
r12cf773 r014475 42 42 double DistanceSquared(const Vector &y) const; 43 43 double DistanceToSpace(const Space& space) const; 44 double PeriodicDistance(const Vector &y, const Matrix &cell_size) const;45 double PeriodicDistanceSquared(const Vector &y, const Matrix &cell_size) const;46 44 double ScalarProduct(const Vector &y) const; 47 45 double Angle(const Vector &y) const;
Note:
See TracChangeset
for help on using the changeset viewer.