Changeset 498a9f
- Timestamp:
- Jun 10, 2008, 11:20:12 AM (17 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:
- 233e33
- Parents:
- 3dfad8
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/vector.cpp
r3dfad8 r498a9f 13 13 */ 14 14 vector::vector() { x[0] = x[1] = x[2] = 0.; }; 15 16 /** Constructor of class vector. 17 */ 18 vector::vector(double x1, double x2, double x3) { x[0] = x1; x[1] = x2; x[2] = x3; }; 15 19 16 20 /** Desctructor of class vector. … … 111 115 }; 112 116 117 /** projects this vector onto plane defined by \a *y. 118 * \param *y array to normal vector of plane 119 * \return \f$\langle x, y \rangle\f$ 120 */ 121 void vector::ProjectOntoPlane(const vector *y) 122 { 123 vector tmp; 124 tmp.CopyVector(y); 125 tmp.Scale(Projection(y)); 126 this->SubtractVector(&tmp); 127 }; 128 113 129 /** Calculates the projection of a vector onto another \a *y. 114 130 * \param *y array to second vector … … 117 133 double vector::Projection(const vector *y) const 118 134 { 119 return (ScalarProduct(y) /Norm()/y->Norm());135 return (ScalarProduct(y)); 120 136 }; 121 137 … … 150 166 }; 151 167 168 /** Zeros all components of this vector. 169 */ 170 void vector::One(double one) 171 { 172 for (int i=NDIM;i--;) 173 this->x[i] = one; 174 }; 175 176 /** Initialises all components of this vector. 177 */ 178 void vector::Init(double x1, double x2, double x3) 179 { 180 x[0] = x1; 181 x[1] = x2; 182 x[2] = x3; 183 }; 184 152 185 /** Calculates the angle between this and another vector. 153 186 * \param *y array to second vector 154 * \return \f$\ frac{\langle x, y \rangle}{|x||y|}\f$187 * \return \f$\acos\bigl(frac{\langle x, y \rangle}{|x||y|}\bigr)\f$ 155 188 */ 156 189 double vector::Angle(vector *y) const 157 190 { 158 return (this->ScalarProduct(y)/(this->Norm()*y->Norm()));191 return acos(this->ScalarProduct(y)/Norm()/y->Norm()); 159 192 }; 160 193 -
src/vector.hpp
r3dfad8 r498a9f 10 10 11 11 vector(); 12 vector(double x1, double x2, double x3); 12 13 ~vector(); 13 14 … … 23 24 void CopyVector(const vector *y); 24 25 void RotateVector(const vector *y, const double alpha); 26 void ProjectOntoPlane(const vector *y); 25 27 void Zero(); 28 void One(double one); 29 void Init(double x1, double x2, double x3); 26 30 void Normalize(); 27 31 void Translate(const vector *x);
Note:
See TracChangeset
for help on using the changeset viewer.