source: src/vector.hpp@ bc84e47

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
Last change on this file since bc84e47 was 498a9f, checked in by Frederik Heber <heber@…>, 17 years ago

some new functions: vector::vector(), vector::ProjectOntoPlane(), vector::One(), vector::Init()

vector::vector() new constructor allowing for setting of components
vector::ProjectOntoPlane() projects vector onto plane described by normal vector
vector::One() sets components to given double
vector::Init() initialised components to given values

  • Property mode set to 100644
File size: 1.9 KB
Line 
1#ifndef VECTOR_HPP_
2#define VECTOR_HPP_
3
4/** Single vector.
5 * basically, just a x[3] but with helpful functions
6 */
7class vector {
8 public:
9 double x[NDIM];
10
11 vector();
12 vector(double x1, double x2, double x3);
13 ~vector();
14
15 double Distance(const vector *y) const;
16 double PeriodicDistance(const vector *y, const double *cell_size) const;
17 double ScalarProduct(const vector *y) const;
18 double Projection(const vector *y) const;
19 double Norm() const ;
20 double Angle(vector *y) const;
21
22 void AddVector(const vector *y);
23 void SubtractVector(const vector *y);
24 void CopyVector(const vector *y);
25 void RotateVector(const vector *y, const double alpha);
26 void ProjectOntoPlane(const vector *y);
27 void Zero();
28 void One(double one);
29 void Init(double x1, double x2, double x3);
30 void Normalize();
31 void Translate(const vector *x);
32 void Mirror(const vector *x);
33 void Scale(double **factor);
34 void Scale(double *factor);
35 void Scale(double factor);
36 void MatrixMultiplication(double *M);
37 void InverseMatrixMultiplication(double *M);
38 void KeepPeriodic(ofstream *out, double *matrix);
39 void LinearCombinationOfVectors(const vector *x1, const vector *x2, const vector *x3, double *factors);
40
41 bool GetOneNormalVector(const vector *x1);
42 bool MakeNormalVector(const vector *y1);
43 bool MakeNormalVector(const vector *y1, const vector *y2);
44 bool MakeNormalVector(const vector *x1, const vector *x2, const vector *x3);
45 bool SolveSystem(vector *x1, vector *x2, vector *y, double alpha, double beta, double c);
46 bool LSQdistance(vector **vectors, int dim);
47
48 void AskPosition(double *cell_size, bool check);
49 bool Output(ofstream *out) const;
50};
51
52ofstream& operator<<(ofstream& ost, vector& m);
53vector& operator+=(vector& a, const vector& b);
54vector& operator*=(vector& a, const double m);
55vector& operator*(const vector& a, const double m);
56vector& operator+(const vector& a, const vector& b);
57
58#endif /*VECTOR_HPP_*/
Note: See TracBrowser for help on using the repository browser.