Changeset 436f04
- Timestamp:
- Jun 26, 2010, 12:21:48 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:
- a679d1
- Parents:
- e3ffd3
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Matrix.cpp
re3ffd3 r436f04 22 22 Matrix::Matrix(const double* src){ 23 23 content = gsl_matrix_alloc(NDIM, NDIM); 24 this->at(0,0) = src[0];25 this->at(1,0) = src[1];26 this->at(2,0) = src[2];24 set(0,0, src[0]); 25 set(1,0, src[1]); 26 set(2,0, src[2]); 27 27 28 this->at(0,1) = src[3];29 this->at(1,1) = src[4];30 this->at(2,1) = src[5];28 set(0,1, src[3]); 29 set(1,1, src[4]); 30 set(2,1, src[5]); 31 31 32 this->at(0,2) = src[6];33 this->at(1,2) = src[7];34 this->at(2,2) = src[8];32 set(0,2, src[6]); 33 set(1,2, src[7]); 34 set(2,2, src[8]); 35 35 } 36 36 … … 95 95 } 96 96 97 const double &Matrix::at(size_t i, size_t j) const{97 const double Matrix::at(size_t i, size_t j) const{ 98 98 ASSERT(i>=0&&i<NDIM,"Index i for Matrix access out of range"); 99 99 ASSERT(j>=0&&j<NDIM,"Index j for Matrix access out of range"); 100 return *gsl_matrix_ptr (content, i, j); 100 return gsl_matrix_get(content, i, j); 101 } 102 103 void Matrix::set(size_t i, size_t j, const double value){ 104 ASSERT(i>=0&&i<NDIM,"Index i for Matrix access out of range"); 105 ASSERT(j>=0&&j<NDIM,"Index j for Matrix access out of range"); 106 gsl_matrix_set(content,i,j,value); 101 107 } 102 108 … … 118 124 double detReci = 1./det; 119 125 Matrix res; 120 res. at(0,0) = detReci*RDET2(at(1,1),at(2,1),at(1,2),at(2,2)); // A_11121 res. at(1,0) = -detReci*RDET2(at(1,0),at(2,0),at(1,2),at(2,2)); // A_21122 res. at(2,0) = detReci*RDET2(at(1,0),at(2,0),at(1,1),at(2,1)); // A_31123 res. at(0,1) = -detReci*RDET2(at(0,1),at(2,1),at(0,2),at(2,2)); // A_12124 res. at(1,1) = detReci*RDET2(at(0,0),at(2,0),at(0,2),at(2,2)); // A_22125 res. at(2,1) = -detReci*RDET2(at(0,0),at(2,0),at(0,1),at(2,1)); // A_32126 res. at(0,2) = detReci*RDET2(at(0,1),at(1,1),at(0,2),at(1,2)); // A_13127 res. at(1,2) = -detReci*RDET2(at(0,0),at(1,0),at(0,2),at(1,2)); // A_23128 res. at(2,2) = detReci*RDET2(at(0,0),at(1,0),at(0,1),at(1,1)); // A_33126 res.set(0,0, detReci*RDET2(at(1,1),at(2,1),at(1,2),at(2,2))); // A_11 127 res.set(1,0, -detReci*RDET2(at(1,0),at(2,0),at(1,2),at(2,2))); // A_21 128 res.set(2,0, detReci*RDET2(at(1,0),at(2,0),at(1,1),at(2,1))); // A_31 129 res.set(0,1, -detReci*RDET2(at(0,1),at(2,1),at(0,2),at(2,2))); // A_12 130 res.set(1,1, detReci*RDET2(at(0,0),at(2,0),at(0,2),at(2,2))); // A_22 131 res.set(2,1, -detReci*RDET2(at(0,0),at(2,0),at(0,1),at(2,1))); // A_32 132 res.set(0,2, detReci*RDET2(at(0,1),at(1,1),at(0,2),at(1,2))); // A_13 133 res.set(1,2, -detReci*RDET2(at(0,0),at(1,0),at(0,2),at(1,2))); // A_23 134 res.set(2,2, detReci*RDET2(at(0,0),at(1,0),at(0,1),at(1,1))); // A_33 129 135 return res; 130 136 } … … 152 158 { 153 159 Matrix matrix; 154 matrix. at(0,0) = symm[0];155 matrix. at(1,0) = symm[1];156 matrix. at(2,0) = symm[3];157 matrix. at(0,1) = symm[1];158 matrix. at(1,1) = symm[2];159 matrix. at(2,1) = symm[4];160 matrix. at(0,2) = symm[3];161 matrix. at(1,2) = symm[4];162 matrix. at(2,2) = symm[5];160 matrix.set(0,0, symm[0]); 161 matrix.set(1,0, symm[1]); 162 matrix.set(2,0, symm[3]); 163 matrix.set(0,1, symm[1]); 164 matrix.set(1,1, symm[2]); 165 matrix.set(2,1, symm[4]); 166 matrix.set(0,2, symm[3]); 167 matrix.set(1,2, symm[4]); 168 matrix.set(2,2, symm[5]); 163 169 return matrix; 164 170 }; -
src/Matrix.hpp
re3ffd3 r436f04 24 24 25 25 double &at(size_t i, size_t j); 26 const double &at(size_t i, size_t j) const; 26 const double at(size_t i, size_t j) const; 27 28 void set(size_t i, size_t j, const double value); 27 29 28 30 double determinant() const;
Note:
See TracChangeset
for help on using the changeset viewer.