Changeset c94eeb
- Timestamp:
- Jun 25, 2010, 3:27:35 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:
- 33d774
- Parents:
- 325390
- Location:
- src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/WorldAction/RepeatBoxAction.cpp
r325390 rc94eeb 13 13 #include "molecule.hpp" 14 14 #include "vector.hpp" 15 #include "Matrix.hpp" 15 16 #include "verbose.hpp" 16 17 #include "World.hpp" … … 60 61 (cout << "Repeating box " << Repeater << " times for (x,y,z) axis." << endl); 61 62 double * const cell_size = World::getInstance().getDomain(); 62 double *M = ReturnFullMatrixforSymmetric(cell_size); 63 double *M_double = ReturnFullMatrixforSymmetric(cell_size); 64 Matrix M = Matrix(M_double); 65 delete[] M_double; 63 66 Vector x,y; 64 67 int n[NDIM]; … … 118 121 } 119 122 } 120 delete(M);121 123 delete dialog; 122 124 return Action::success; -
src/analysis_correlation.cpp
r325390 rc94eeb 19 19 #include "triangleintersectionlist.hpp" 20 20 #include "vector.hpp" 21 #include "Matrix.hpp" 21 22 #include "verbose.hpp" 22 23 #include "World.hpp" … … 135 136 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++){ 136 137 if ((*MolWalker)->ActiveFlag) { 137 double * FullMatrix = ReturnFullMatrixforSymmetric(World::getInstance().getDomain()); 138 double * FullInverseMatrix = InverseMatrix(FullMatrix); 138 double * FullMatrix_double = ReturnFullMatrixforSymmetric(World::getInstance().getDomain()); 139 Matrix FullMatrix = Matrix(FullMatrix_double); 140 Matrix FullInverseMatrix = FullMatrix.invert(); 141 delete[](FullMatrix_double); 139 142 DoeLog(2) && (eLog()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 140 143 eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl; … … 176 179 } 177 180 } 178 delete[](FullMatrix);179 delete[](FullInverseMatrix);180 181 } 181 182 } … … 246 247 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 247 248 if ((*MolWalker)->ActiveFlag) { 248 double * FullMatrix = ReturnFullMatrixforSymmetric(World::getInstance().getDomain()); 249 double * FullInverseMatrix = InverseMatrix(FullMatrix); 249 double * FullMatrix_double = ReturnFullMatrixforSymmetric(World::getInstance().getDomain()); 250 Matrix FullMatrix = Matrix(FullMatrix_double); 251 Matrix FullInverseMatrix = FullMatrix.invert(); 252 delete[] FullMatrix_double; 250 253 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 251 254 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { … … 267 270 } 268 271 } 269 delete[](FullMatrix);270 delete[](FullInverseMatrix);271 272 } 272 273 … … 352 353 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 353 354 if ((*MolWalker)->ActiveFlag) { 354 double * FullMatrix = ReturnFullMatrixforSymmetric(World::getInstance().getDomain()); 355 double * FullInverseMatrix = InverseMatrix(FullMatrix); 355 double * FullMatrix_double = ReturnFullMatrixforSymmetric(World::getInstance().getDomain()); 356 Matrix FullMatrix = Matrix(FullMatrix_double); 357 Matrix FullInverseMatrix = FullMatrix.invert(); 358 delete[](FullMatrix_double); 356 359 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 357 360 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { … … 381 384 } 382 385 } 383 delete[](FullMatrix);384 delete[](FullInverseMatrix);385 386 } 386 387 -
src/boundary.cpp
r325390 rc94eeb 22 22 #include "World.hpp" 23 23 #include "Plane.hpp" 24 #include "Matrix.hpp" 24 25 25 26 #include<gsl/gsl_poly.h> … … 764 765 int N[NDIM]; 765 766 int n[NDIM]; 766 double *M = ReturnFullMatrixforSymmetric(World::getInstance().getDomain()); 767 double Rotations[NDIM*NDIM]; 768 double *MInverse = InverseMatrix(M); 767 double *M_double = ReturnFullMatrixforSymmetric(World::getInstance().getDomain()); 768 Matrix M = Matrix(M_double); 769 delete[](M_double); 770 Matrix Rotations; 771 Matrix MInverse = M.invert(); 769 772 Vector AtomTranslations; 770 773 Vector FillerTranslations; … … 800 803 // calculate filler grid in [0,1]^3 801 804 FillerDistance = Vector(distance[0], distance[1], distance[2]); 802 FillerDistance. InverseMatrixMultiplication(M);805 FillerDistance.MatrixMultiplication(MInverse); 803 806 for(int i=0;i<NDIM;i++) 804 807 N[i] = (int) ceil(1./FillerDistance[i]); … … 835 838 } 836 839 837 Rotations [0]= cos(phi[0]) *cos(phi[2]) + (sin(phi[0])*sin(phi[1])*sin(phi[2]));838 Rotations [3]= sin(phi[0]) *cos(phi[2]) - (cos(phi[0])*sin(phi[1])*sin(phi[2]));839 Rotations [6]= cos(phi[1])*sin(phi[2]) ;840 Rotations [1]= - sin(phi[0])*cos(phi[1]) ;841 Rotations [4]= cos(phi[0])*cos(phi[1]) ;842 Rotations [7]= sin(phi[1]) ;843 Rotations [3]= - cos(phi[0]) *sin(phi[2]) + (sin(phi[0])*sin(phi[1])*cos(phi[2]));844 Rotations [5]= - sin(phi[0]) *sin(phi[2]) - (cos(phi[0])*sin(phi[1])*cos(phi[2]));845 Rotations [8]= cos(phi[1])*cos(phi[2]) ;840 Rotations.at(0,0) = cos(phi[0]) *cos(phi[2]) + (sin(phi[0])*sin(phi[1])*sin(phi[2])); 841 Rotations.at(0,1) = sin(phi[0]) *cos(phi[2]) - (cos(phi[0])*sin(phi[1])*sin(phi[2])); 842 Rotations.at(0,2) = cos(phi[1])*sin(phi[2]) ; 843 Rotations.at(1,0) = - sin(phi[0])*cos(phi[1]) ; 844 Rotations.at(1,1) = cos(phi[0])*cos(phi[1]) ; 845 Rotations.at(1,2) = sin(phi[1]) ; 846 Rotations.at(2,0) = - cos(phi[0]) *sin(phi[2]) + (sin(phi[0])*sin(phi[1])*cos(phi[2])); 847 Rotations.at(2,1) = - sin(phi[0]) *sin(phi[2]) - (cos(phi[0])*sin(phi[1])*cos(phi[2])); 848 Rotations.at(2,2) = cos(phi[1])*cos(phi[2]) ; 846 849 } 847 850 … … 892 895 } 893 896 } 894 delete[](M);895 delete[](MInverse);896 897 897 898 return Filling; -
src/ellipsoid.cpp
r325390 rc94eeb 21 21 #include "tesselation.hpp" 22 22 #include "vector.hpp" 23 #include "Matrix.hpp" 23 24 #include "verbose.hpp" 24 25 … … 34 35 Vector helper, RefPoint; 35 36 double distance = -1.; 36 double Matrix[NDIM*NDIM];37 Matrix Matrix; 37 38 double InverseLength[3]; 38 39 double psi,theta,phi; // euler angles in ZX'Z'' convention … … 51 52 theta = EllipsoidAngle[1]; 52 53 phi = EllipsoidAngle[2]; 53 Matrix [0]= cos(psi)*cos(phi) - sin(psi)*cos(theta)*sin(phi);54 Matrix [1]= -cos(psi)*sin(phi) - sin(psi)*cos(theta)*cos(phi);55 Matrix [2]= sin(psi)*sin(theta);56 Matrix [3]= sin(psi)*cos(phi) + cos(psi)*cos(theta)*sin(phi);57 Matrix [4]= cos(psi)*cos(theta)*cos(phi) - sin(psi)*sin(phi);58 Matrix [5]= -cos(psi)*sin(theta);59 Matrix [6]= sin(theta)*sin(phi);60 Matrix [7]= sin(theta)*cos(phi);61 Matrix [8]= cos(theta);54 Matrix.at(0,0) = cos(psi)*cos(phi) - sin(psi)*cos(theta)*sin(phi); 55 Matrix.at(1,0) = -cos(psi)*sin(phi) - sin(psi)*cos(theta)*cos(phi); 56 Matrix.at(2,0) = sin(psi)*sin(theta); 57 Matrix.at(0,1) = sin(psi)*cos(phi) + cos(psi)*cos(theta)*sin(phi); 58 Matrix.at(1,1) = cos(psi)*cos(theta)*cos(phi) - sin(psi)*sin(phi); 59 Matrix.at(2,1) = -cos(psi)*sin(theta); 60 Matrix.at(0,2) = sin(theta)*sin(phi); 61 Matrix.at(1,2) = sin(theta)*cos(phi); 62 Matrix.at(2,2) = cos(theta); 62 63 helper.MatrixMultiplication(Matrix); 63 64 helper.ScaleAll(InverseLength); … … 73 74 phi = -EllipsoidAngle[2]; 74 75 helper.ScaleAll(EllipsoidLength); 75 Matrix [0]= cos(psi)*cos(phi) - sin(psi)*cos(theta)*sin(phi);76 Matrix [1]= -cos(psi)*sin(phi) - sin(psi)*cos(theta)*cos(phi);77 Matrix [2]= sin(psi)*sin(theta);78 Matrix [3]= sin(psi)*cos(phi) + cos(psi)*cos(theta)*sin(phi);79 Matrix [4]= cos(psi)*cos(theta)*cos(phi) - sin(psi)*sin(phi);80 Matrix [5]= -cos(psi)*sin(theta);81 Matrix [6]= sin(theta)*sin(phi);82 Matrix [7]= sin(theta)*cos(phi);83 Matrix [8]= cos(theta);76 Matrix.at(0,0) = cos(psi)*cos(phi) - sin(psi)*cos(theta)*sin(phi); 77 Matrix.at(1,0) = -cos(psi)*sin(phi) - sin(psi)*cos(theta)*cos(phi); 78 Matrix.at(2,0) = sin(psi)*sin(theta); 79 Matrix.at(0,1) = sin(psi)*cos(phi) + cos(psi)*cos(theta)*sin(phi); 80 Matrix.at(1,1) = cos(psi)*cos(theta)*cos(phi) - sin(psi)*sin(phi); 81 Matrix.at(2,1) = -cos(psi)*sin(theta); 82 Matrix.at(0,2) = sin(theta)*sin(phi); 83 Matrix.at(1,2) = sin(theta)*cos(phi); 84 Matrix.at(2,2) = cos(theta); 84 85 helper.MatrixMultiplication(Matrix); 85 86 //Log() << Verbose(4) << "Intersection is at " << helper << "." << endl; -
src/molecule.cpp
r325390 rc94eeb 27 27 #include "tesselation.hpp" 28 28 #include "vector.hpp" 29 #include "Matrix.hpp" 29 30 #include "World.hpp" 30 31 #include "Plane.hpp" … … 284 285 Vector Orthovector1, Orthovector2; // temporary vectors in coordination construction 285 286 Vector InBondvector; // vector in direction of *Bond 286 double *matrix = NULL;287 Matrix matrix; 287 288 bond *Binder = NULL; 288 289 double * const cell_size = World::getInstance().getDomain(); … … 307 308 } // (signs are correct, was tested!) 308 309 } 309 matrix = ReturnFullMatrixforSymmetric(cell_size); 310 double *matrix_double = ReturnFullMatrixforSymmetric(cell_size); 311 matrix = Matrix(matrix_double); 312 delete[](matrix_double); 310 313 Orthovector1.MatrixMultiplication(matrix); 311 314 InBondvector -= Orthovector1; // subtract just the additional translation 312 delete[](matrix);313 315 bondlength = InBondvector.Norm(); 314 316 // Log() << Verbose(4) << "Corrected InBondvector is now: "; … … 541 543 break; 542 544 } 543 delete[](matrix);544 545 545 546 // Log() << Verbose(3) << "End of AddHydrogenReplacementAtom." << endl; -
src/molecule_fragmentation.cpp
r325390 rc94eeb 22 22 #include "periodentafel.hpp" 23 23 #include "World.hpp" 24 #include "Matrix.hpp" 24 25 25 26 /************************************* Functions for class molecule *********************************/ … … 1709 1710 atom *OtherWalker = NULL; 1710 1711 double * const cell_size = World::getInstance().getDomain(); 1711 double *matrix = ReturnFullMatrixforSymmetric(cell_size); 1712 double *matrix_double = ReturnFullMatrixforSymmetric(cell_size); 1713 Matrix matrix = Matrix(matrix_double); 1714 delete[](matrix_double); 1712 1715 enum Shading *ColorList = NULL; 1713 1716 double tmp; … … 1780 1783 delete(AtomStack); 1781 1784 delete[](ColorList); 1782 delete[](matrix);1783 1785 DoLog(2) && (Log() << Verbose(2) << "End of ScanForPeriodicCorrection." << endl); 1784 1786 }; -
src/molecule_geometry.cpp
r325390 rc94eeb 19 19 #include "World.hpp" 20 20 #include "Plane.hpp" 21 #include "Matrix.hpp" 21 22 #include <boost/foreach.hpp> 22 23 … … 154 155 155 156 const double *cell_size = World::getInstance().getDomain(); 156 double *M = ReturnFullMatrixforSymmetric(cell_size); 157 double *M_double = ReturnFullMatrixforSymmetric(cell_size); 158 Matrix M = Matrix(M_double); 159 delete[](M_double); 157 160 a->MatrixMultiplication(M); 158 delete[](M);159 161 160 162 return a; … … 274 276 { 275 277 double * const cell_size = World::getInstance().getDomain(); 276 double *matrix = ReturnFullMatrixforSymmetric(cell_size); 277 double *inversematrix = InverseMatrix(matrix); 278 double *matrix_double = ReturnFullMatrixforSymmetric(cell_size); 279 Matrix matrix = Matrix(matrix_double); 280 delete[](matrix_double); 281 Matrix inversematrix = matrix.invert(); 278 282 double tmp; 279 283 bool flag; … … 324 328 } 325 329 } while (!flag); 326 delete[](matrix);327 delete[](inversematrix);328 330 329 331 Center.Scale(1./static_cast<double>(getAtomCount())); … … 387 389 DoLog(1) && (Log() << Verbose(1) << "Transforming molecule into PAS ... "); 388 390 // the eigenvectors specify the transformation matrix 389 ActOnAllVectors( &Vector::MatrixMultiplication, (const double *) evec->data ); 391 Matrix M = Matrix(evec->data); 392 ActOnAllVectors( &Vector::MatrixMultiplication, static_cast<const Matrix>(M)); 390 393 DoLog(0) && (Log() << Verbose(0) << "done." << endl); 391 394 -
src/vector.cpp
r325390 rc94eeb 105 105 double Vector::PeriodicDistance(const Vector &y, const double * const cell_size) const 106 106 { 107 double res = distance(y), tmp, matrix[NDIM*NDIM]; 107 double res = distance(y), tmp; 108 Matrix matrix; 108 109 Vector Shiftedy, TranslationVector; 109 110 int N[NDIM]; 110 matrix [0]= cell_size[0];111 matrix [1]= cell_size[1];112 matrix [2]= cell_size[3];113 matrix [3]= cell_size[1];114 matrix [4]= cell_size[2];115 matrix [5]= cell_size[4];116 matrix [6]= cell_size[3];117 matrix [7]= cell_size[4];118 matrix [8]= cell_size[5];111 matrix.at(0,0) = cell_size[0]; 112 matrix.at(1,0) = cell_size[1]; 113 matrix.at(2,0) = cell_size[3]; 114 matrix.at(0,1) = cell_size[1]; 115 matrix.at(1,1) = cell_size[2]; 116 matrix.at(2,1) = cell_size[4]; 117 matrix.at(0,2) = cell_size[3]; 118 matrix.at(1,2) = cell_size[4]; 119 matrix.at(2,2) = cell_size[5]; 119 120 // in order to check the periodic distance, translate one of the vectors into each of the 27 neighbouring cells 120 121 for (N[0]=-1;N[0]<=1;N[0]++) … … 142 143 double Vector::PeriodicDistanceSquared(const Vector &y, const double * const cell_size) const 143 144 { 144 double res = DistanceSquared(y), tmp, matrix[NDIM*NDIM]; 145 double res = DistanceSquared(y), tmp; 146 Matrix matrix; 145 147 Vector Shiftedy, TranslationVector; 146 148 int N[NDIM]; 147 matrix [0]= cell_size[0];148 matrix [1]= cell_size[1];149 matrix [2]= cell_size[3];150 matrix [3]= cell_size[1];151 matrix [4]= cell_size[2];152 matrix [5]= cell_size[4];153 matrix [6]= cell_size[3];154 matrix [7]= cell_size[4];155 matrix [8]= cell_size[5];149 matrix.at(0,0) = cell_size[0]; 150 matrix.at(1,0) = cell_size[1]; 151 matrix.at(2,0) = cell_size[3]; 152 matrix.at(0,1) = cell_size[1]; 153 matrix.at(1,1) = cell_size[2]; 154 matrix.at(2,1) = cell_size[4]; 155 matrix.at(0,2) = cell_size[3]; 156 matrix.at(1,2) = cell_size[4]; 157 matrix.at(2,2) = cell_size[5]; 156 158 // in order to check the periodic distance, translate one of the vectors into each of the 27 neighbouring cells 157 159 for (N[0]=-1;N[0]<=1;N[0]++) … … 176 178 * Tries to translate a vector into each adjacent neighbouring cell. 177 179 */ 178 void Vector::KeepPeriodic(const double * const matrix) 179 { 180 void Vector::KeepPeriodic(const double * const _matrix) 181 { 182 Matrix matrix = Matrix(_matrix); 180 183 // int N[NDIM]; 181 184 // bool flag = false; … … 185 188 // Output(out); 186 189 // Log() << Verbose(0) << endl; 187 InverseMatrixMultiplication(matrix);190 MatrixMultiplication(matrix.invert()); 188 191 for(int i=NDIM;i--;) { // correct periodically 189 192 if (at(i) < 0) { // get every coefficient into the interval [0,1) … … 530 533 * \param *Minv inverse matrix 531 534 */ 532 void Vector::WrapPeriodically(const double * const M, const double * const Minv) 533 { 535 void Vector::WrapPeriodically(const double * const _M, const double * const _Minv) 536 { 537 Matrix M = Matrix(_M); 538 Matrix Minv = Matrix(_Minv); 534 539 MatrixMultiplication(Minv); 535 540 // truncate to [0,1] for each axis … … 564 569 * \param *matrix NDIM_NDIM array 565 570 */ 566 void Vector::MatrixMultiplication(const double * constM)567 { 568 (*this) *= M atrix(M);571 void Vector::MatrixMultiplication(const Matrix &M) 572 { 573 (*this) *= M; 569 574 }; 570 575 -
src/vector.hpp
r325390 rc94eeb 60 60 void ScaleAll(const double *factor); 61 61 void Scale(const double factor); 62 void MatrixMultiplication(const double * constM);62 void MatrixMultiplication(const Matrix &M); 63 63 bool InverseMatrixMultiplication(const double * const M); 64 64 void KeepPeriodic(const double * const matrix);
Note:
See TracChangeset
for help on using the changeset viewer.