Changeset ccf826
- Timestamp:
- May 28, 2010, 11:41:08 AM (15 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:
- 5589858
- Parents:
- 42a101
- Location:
- src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Plane.cpp
r42a101 rccf826 182 182 }; 183 183 184 Vector Plane::mirrorVector(const Vector &rhs) const { 185 Vector helper = getVectorToPoint(rhs); 186 // substract twice the Vector to the plane 187 return rhs+2*helper; 188 } 189 184 190 /************ Methods inherited from Space ****************/ 185 191 -
src/Plane.hpp
r42a101 rccf826 52 52 Vector GetIntersection(const Vector &Origin, const Vector &LineVector) const; 53 53 54 Vector mirrorVector(const Vector &rhs) const; 55 54 56 /****** Methods inherited from Space ***********/ 55 57 -
src/Space.hpp
r42a101 rccf826 17 17 virtual ~Space(); 18 18 19 /** 20 * Calculates the distance between a Space and a Vector. 21 */ 19 22 virtual double distance(const Vector &point) const=0; 23 24 /** 25 * get the closest point inside the space to another point 26 */ 20 27 virtual Vector getClosestPoint(const Vector &point) const=0; 28 29 /** 30 * get the shortest Vector from a point to a Space. 31 * 32 * The Vector always points from the given Vector to the point in space 33 * returned by Plane::getClosestPoint(). 34 */ 21 35 virtual Vector getVectorToPoint(const Vector &point) const; 36 37 /** 38 * Test wether a point is contained in the space. 39 * 40 * returns true, when the point lies inside and false 41 * otherwise. 42 */ 22 43 virtual bool isContained(const Vector &point) const; 44 45 /** 46 * Tests if this space contains the center of the coordinate system. 47 */ 23 48 virtual bool hasZero() const; 24 49 -
src/molecule_geometry.cpp
r42a101 rccf826 16 16 #include "molecule.hpp" 17 17 #include "World.hpp" 18 #include "Plane.hpp" 18 19 19 20 /************************************* Functions for class molecule *********************************/ … … 251 252 void molecule::Mirror(const Vector *n) 252 253 { 253 ActOnAllVectors( &Vector::Mirror, *n ); 254 Plane p(*n,0); 255 // TODO: replace with simpler construct (e.g. Boost::foreach) 256 // once the structure of the atom list is fully reworked 257 atom *Walker = start; 258 while (Walker->next != end) { 259 Walker = Walker->next; 260 (*Walker->node) = p.mirrorVector(*Walker->node); 261 } 254 262 }; 255 263 -
src/unittests/PlaneUnittest.cpp
r42a101 rccf826 153 153 CPPUNIT_ASSERT(fabs(p4->distance(e1)-1) < MYEPSILON); 154 154 CPPUNIT_ASSERT_EQUAL(zeroVec,p4->getClosestPoint(e1)); 155 156 157 } 155 } 156 157 void PlaneUnittest::mirrorTest(){ 158 Vector fixture; 159 160 // some Vectors that lie on the planes 161 fixture = p1->mirrorVector(e1); 162 CPPUNIT_ASSERT_EQUAL(fixture,e1); 163 fixture = p1->mirrorVector(e2); 164 CPPUNIT_ASSERT_EQUAL(fixture,e2); 165 fixture = p1->mirrorVector(e3); 166 CPPUNIT_ASSERT_EQUAL(fixture,e3); 167 168 fixture = p2->mirrorVector(zeroVec); 169 CPPUNIT_ASSERT_EQUAL(fixture,zeroVec); 170 fixture = p2->mirrorVector(e1); 171 CPPUNIT_ASSERT_EQUAL(fixture,e1); 172 fixture = p2->mirrorVector(e2); 173 CPPUNIT_ASSERT_EQUAL(fixture,e2); 174 175 fixture = p3->mirrorVector(zeroVec); 176 CPPUNIT_ASSERT_EQUAL(fixture,zeroVec); 177 fixture = p3->mirrorVector(e1); 178 CPPUNIT_ASSERT_EQUAL(fixture,e1); 179 fixture = p3->mirrorVector(e3); 180 CPPUNIT_ASSERT_EQUAL(fixture,e3); 181 182 fixture = p4->mirrorVector(zeroVec); 183 CPPUNIT_ASSERT_EQUAL(fixture,zeroVec); 184 fixture = p4->mirrorVector(e2); 185 CPPUNIT_ASSERT_EQUAL(fixture,e2); 186 fixture = p4->mirrorVector(e3); 187 CPPUNIT_ASSERT_EQUAL(fixture,e3); 188 189 // some Vectors outside of the planes 190 { 191 Vector t = (2./3.)*(e1+e2+e3); 192 fixture = p1->mirrorVector(zeroVec); 193 CPPUNIT_ASSERT_EQUAL(fixture,t); 194 } 195 196 fixture = p2->mirrorVector(e3); 197 CPPUNIT_ASSERT_EQUAL(fixture,-1*e3); 198 fixture = p3->mirrorVector(e2); 199 CPPUNIT_ASSERT_EQUAL(fixture,-1*e2); 200 fixture = p4->mirrorVector(e1); 201 CPPUNIT_ASSERT_EQUAL(fixture,-1*e1); 202 } -
src/unittests/PlaneUnittest.hpp
r42a101 rccf826 20 20 CPPUNIT_TEST ( pointsTest ); 21 21 CPPUNIT_TEST ( operationsTest ); 22 CPPUNIT_TEST ( mirrorTest ); 22 23 CPPUNIT_TEST_SUITE_END(); 23 24 … … 30 31 void pointsTest(); 31 32 void operationsTest(); 33 void mirrorTest(); 32 34 33 35 private: -
src/vector.cpp
r42a101 rccf826 602 602 }; 603 603 604 /** Mirrors atom against a given plane.605 * \param n[] normal vector of mirror plane.606 */607 void Vector::Mirror(const Vector &n)608 {609 double projection;610 projection = ScalarProduct(n)/n.NormSquared(); // remove constancy from n (keep as logical one)611 // withdraw projected vector twice from original one612 for (int i=NDIM;i--;)613 at(i) -= 2.*projection*n[i];614 };615 616 604 /** Calculates orthonormal vector to one given vectors. 617 605 * Just subtracts the projection onto the given vector from this vector. -
src/vector.hpp
r42a101 rccf826 60 60 void ProjectIt(const Vector &y); 61 61 Vector Projection(const Vector &y) const; 62 void Mirror(const Vector &x);63 62 void ScaleAll(const double *factor); 64 63 void Scale(const double factor);
Note:
See TracChangeset
for help on using the changeset viewer.