- Timestamp:
- Jul 1, 2010, 2:37:53 PM (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:
- 4b94bb
- Parents:
- 205d9b
- Location:
- src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/atom.cpp
r205d9b rc550dd 17 17 #include "World.hpp" 18 18 #include "molecule.hpp" 19 #include "Shapes/Shape.hpp" 19 20 20 21 /************************************* Functions for class atom *************************************/ … … 112 113 * \return true - is inside, false - is not 113 114 */ 114 bool atom::IsIn Parallelepiped(const Vector offset, const Matrix& parallelepiped) const115 { 116 return (node->IsInParallelepiped(offset, parallelepiped));115 bool atom::IsInShape(const Shape& shape) const 116 { 117 return shape.isInside(*node); 117 118 }; 118 119 -
src/atom.hpp
r205d9b rc550dd 35 35 class World; 36 36 class molecule; 37 class Shape; 37 38 38 39 /********************************************** declarations *******************************/ … … 66 67 double DistanceToVector(const Vector &origin) const; 67 68 double DistanceSquaredToVector(const Vector &origin) const; 68 bool IsIn Parallelepiped(const Vector offset, const Matrix ¶llelepiped) const;69 bool IsInShape(const Shape&) const; 69 70 70 71 // getter and setter -
src/molecule.cpp
r205d9b rc550dd 659 659 * @param three vectors forming the matrix that defines the shape of the parallelpiped 660 660 */ 661 molecule* molecule::CopyMoleculeFromSubRegion(const Vector offset, const Matrix ¶llelepiped) const {661 molecule* molecule::CopyMoleculeFromSubRegion(const Shape ®ion) const { 662 662 molecule *copy = World::getInstance().createMolecule(); 663 663 664 664 BOOST_FOREACH(atom *iter,atoms){ 665 if(iter->IsIn Parallelepiped(offset,parallelepiped)){665 if(iter->IsInShape(region)){ 666 666 copy->AddCopyAtom(iter); 667 667 } -
src/molecule.hpp
r205d9b rc550dd 53 53 class periodentafel; 54 54 class Vector; 55 class Shape; 55 56 56 57 /******************************** Some definitions for easier reading **********************************/ … … 316 317 317 318 molecule *CopyMolecule(); 318 molecule* CopyMoleculeFromSubRegion(const Vector offset, const Matrix ¶llelepiped) const;319 molecule* CopyMoleculeFromSubRegion(const Shape&) const; 319 320 320 321 /// Fragment molecule by two different approaches: -
src/unittests/vectorunittest.cpp
r205d9b rc550dd 215 215 CPPUNIT_ASSERT(testVector.ScalarProduct(three) < MYEPSILON); 216 216 } 217 218 219 /**220 * UnitTest for Vector::IsInParallelepiped().221 */222 void VectorTest::IsInParallelepipedTest()223 {224 Matrix parallelepiped;225 parallelepiped.at(0,0) = 1;226 parallelepiped.at(1,0) = 0;227 parallelepiped.at(2,0) = 0;228 parallelepiped.at(0,1) = 0;229 parallelepiped.at(1,1) = 1;230 parallelepiped.at(2,1) = 0;231 parallelepiped.at(0,2) = 0;232 parallelepiped.at(1,2) = 0;233 parallelepiped.at(2,2) = 1;234 235 fixture = zero;236 CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );237 fixture = Vector(2.5,2.5,2.5);238 CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );239 fixture = Vector(1.,1.,1.);240 CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );241 fixture = Vector(3.5,3.5,3.5);242 CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );243 fixture = Vector(2.,2.,2.);244 CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );245 fixture = Vector(2.,3.,2.);246 CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );247 fixture = Vector(-2.,2.,-1.);248 CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );249 }250 -
src/unittests/vectorunittest.hpp
r205d9b rc550dd 27 27 CPPUNIT_TEST ( ProjectionTest ); 28 28 CPPUNIT_TEST ( NormalsTest ); 29 CPPUNIT_TEST ( IsInParallelepipedTest );30 29 CPPUNIT_TEST_SUITE_END(); 31 30 … … 45 44 void LineIntersectionTest(); 46 45 void VectorRotationTest(); 47 void IsInParallelepipedTest();48 46 49 47 private: -
src/vector.cpp
r205d9b rc550dd 543 543 } 544 544 545 /**546 * Checks whether this vector is within the parallelepiped defined by the given three vectors and547 * their offset.548 *549 * @param offest for the origin of the parallelepiped550 * @param three vectors forming the matrix that defines the shape of the parallelpiped551 */552 bool Vector::IsInParallelepiped(const Vector &offset, const Matrix& _parallelepiped) const553 {554 Matrix parallelepiped = _parallelepiped.invert();555 Vector a = parallelepiped * ((*this)-offset);556 bool isInside = true;557 558 for (int i=NDIM;i--;)559 isInside = isInside && ((a[i] <= 1) && (a[i] >= 0));560 561 return isInside;562 }563 564 545 565 546 // some comonly used vectors -
src/vector.hpp
r205d9b rc550dd 60 60 bool GetOneNormalVector(const Vector &x1); 61 61 bool MakeNormalTo(const Vector &y1); 62 bool IsInParallelepiped(const Vector &offset, const Matrix& _parallelepiped) const;63 62 std::pair<Vector,Vector> partition(const Vector&) const; 64 63 std::pair<pointset,Vector> partition(const pointset&) const;
Note:
See TracChangeset
for help on using the changeset viewer.