Changeset d10eb6 for src


Ignore:
Timestamp:
Jun 26, 2010, 11:52:50 AM (15 years ago)
Author:
Tillmann Crueger <crueger@…>
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:
63d2b8
Parents:
f66b67
Message:

Made the ReturnFullMatrixForSymmetric return a Matrix object directely instead of a double array

Location:
src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/WorldAction/RepeatBoxAction.cpp

    rf66b67 rd10eb6  
    6161    (cout << "Repeating box " << Repeater << " times for (x,y,z) axis." << endl);
    6262    double * const cell_size = World::getInstance().getDomain();
    63     double *M_double = ReturnFullMatrixforSymmetric(cell_size);
    64     Matrix M = Matrix(M_double);
    65     delete[] M_double;
     63    Matrix M = ReturnFullMatrixforSymmetric(cell_size);
    6664    Vector x,y;
    6765    int n[NDIM];
  • src/Matrix.cpp

    rf66b67 rd10eb6  
    135135  return factor*mat;
    136136}
     137
     138/** Blows the 6-dimensional \a cell_size array up to a full NDIM by NDIM matrix.
     139 * \param *symm 6-dim array of unique symmetric matrix components
     140 * \return allocated NDIM*NDIM array with the symmetric matrix
     141 */
     142Matrix ReturnFullMatrixforSymmetric(const double * const symm)
     143{
     144  Matrix matrix;
     145  matrix.at(0,0) = symm[0];
     146  matrix.at(1,0) = symm[1];
     147  matrix.at(2,0) = symm[3];
     148  matrix.at(0,1) = symm[1];
     149  matrix.at(1,1) = symm[2];
     150  matrix.at(2,1) = symm[4];
     151  matrix.at(0,2) = symm[3];
     152  matrix.at(1,2) = symm[4];
     153  matrix.at(2,2) = symm[5];
     154  return matrix;
     155};
  • src/Matrix.hpp

    rf66b67 rd10eb6  
    5050Matrix operator*(const Matrix&,const double);
    5151
     52Matrix ReturnFullMatrixforSymmetric(const double * const cell_size);
     53
    5254#endif /* MATRIX_HPP_ */
  • src/analysis_correlation.cpp

    rf66b67 rd10eb6  
    136136  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++){
    137137    if ((*MolWalker)->ActiveFlag) {
    138       double * FullMatrix_double = ReturnFullMatrixforSymmetric(World::getInstance().getDomain());
    139       Matrix FullMatrix = Matrix(FullMatrix_double);
     138      Matrix FullMatrix = ReturnFullMatrixforSymmetric(World::getInstance().getDomain());
    140139      Matrix FullInverseMatrix = FullMatrix.invert();
    141       delete[](FullMatrix_double);
    142140      DoeLog(2) && (eLog()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
    143141      eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
     
    247245  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    248246    if ((*MolWalker)->ActiveFlag) {
    249       double * FullMatrix_double = ReturnFullMatrixforSymmetric(World::getInstance().getDomain());
    250       Matrix FullMatrix = Matrix(FullMatrix_double);
     247      Matrix FullMatrix = ReturnFullMatrixforSymmetric(World::getInstance().getDomain());
    251248      Matrix FullInverseMatrix = FullMatrix.invert();
    252       delete[] FullMatrix_double;
    253249      DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
    254250      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     
    353349  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    354350    if ((*MolWalker)->ActiveFlag) {
    355       double * FullMatrix_double = ReturnFullMatrixforSymmetric(World::getInstance().getDomain());
    356       Matrix FullMatrix = Matrix(FullMatrix_double);
     351      Matrix FullMatrix = ReturnFullMatrixforSymmetric(World::getInstance().getDomain());
    357352      Matrix FullInverseMatrix = FullMatrix.invert();
    358       delete[](FullMatrix_double);
    359353      DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
    360354      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
  • src/boundary.cpp

    rf66b67 rd10eb6  
    765765  int N[NDIM];
    766766  int n[NDIM];
    767   double *M_double =  ReturnFullMatrixforSymmetric(World::getInstance().getDomain());
    768   Matrix M = Matrix(M_double);
    769   delete[](M_double);
     767  Matrix M = ReturnFullMatrixforSymmetric(World::getInstance().getDomain());
    770768  Matrix Rotations;
    771769  Matrix MInverse = M.invert();
  • src/helpers.cpp

    rf66b67 rd10eb6  
    117117};
    118118
    119 /** Blows the 6-dimensional \a cell_size array up to a full NDIM by NDIM matrix.
    120  * \param *symm 6-dim array of unique symmetric matrix components
    121  * \return allocated NDIM*NDIM array with the symmetric matrix
    122  */
    123 double * ReturnFullMatrixforSymmetric(const double * const symm)
    124 {
    125   double *matrix = new double[NDIM * NDIM];
    126   matrix[0] = symm[0];
    127   matrix[1] = symm[1];
    128   matrix[2] = symm[3];
    129   matrix[3] = symm[1];
    130   matrix[4] = symm[2];
    131   matrix[5] = symm[4];
    132   matrix[6] = symm[3];
    133   matrix[7] = symm[4];
    134   matrix[8] = symm[5];
    135   return matrix;
    136 };
    137 
    138 
    139119/** Comparison function for GSL heapsort on distances in two molecules.
    140120 * \param *a
  • src/helpers.hpp

    rf66b67 rd10eb6  
    5252bool IsValidNumber( const char *string);
    5353int CompareDoubles (const void * a, const void * b);
    54 double * ReturnFullMatrixforSymmetric(const double * const cell_size);
    5554void performCriticalExit();
    5655
  • src/molecule.cpp

    rf66b67 rd10eb6  
    308308      } // (signs are correct, was tested!)
    309309    }
    310     double *matrix_double = ReturnFullMatrixforSymmetric(cell_size);
    311     matrix = Matrix(matrix_double);
    312     delete[](matrix_double);
     310    matrix = ReturnFullMatrixforSymmetric(cell_size);
    313311    Orthovector1.MatrixMultiplication(matrix);
    314312    InBondvector -= Orthovector1; // subtract just the additional translation
  • src/molecule_fragmentation.cpp

    rf66b67 rd10eb6  
    17101710  atom *OtherWalker = NULL;
    17111711  double * const cell_size = World::getInstance().getDomain();
    1712   double *matrix_double = ReturnFullMatrixforSymmetric(cell_size);
    1713   Matrix matrix = Matrix(matrix_double);
    1714   delete[](matrix_double);
     1712  Matrix matrix = ReturnFullMatrixforSymmetric(cell_size);
    17151713  enum Shading *ColorList = NULL;
    17161714  double tmp;
  • src/molecule_geometry.cpp

    rf66b67 rd10eb6  
    3535  const Vector *CenterBox = DetermineCenterOfBox();
    3636  double * const cell_size = World::getInstance().getDomain();
    37   double *M_double = ReturnFullMatrixforSymmetric(cell_size);
    38   Matrix M = Matrix(M_double);
    39   delete[](M_double);
     37  Matrix M = ReturnFullMatrixforSymmetric(cell_size);
    4038  Matrix Minv = M.invert();
    4139
     
    5957  bool status = true;
    6058  double * const cell_size = World::getInstance().getDomain();
    61   double *M_double = ReturnFullMatrixforSymmetric(cell_size);
    62   Matrix M = Matrix(M_double);
    63   delete[](M_double);
     59  Matrix M = ReturnFullMatrixforSymmetric(cell_size);
    6460  Matrix Minv = M.invert();
    6561
     
    159155
    160156  const double *cell_size = World::getInstance().getDomain();
    161   double *M_double = ReturnFullMatrixforSymmetric(cell_size);
    162   Matrix M = Matrix(M_double);
    163   delete[](M_double);
     157  Matrix M = ReturnFullMatrixforSymmetric(cell_size);
    164158  a->MatrixMultiplication(M);
    165159
     
    250244{
    251245  double * const cell_size = World::getInstance().getDomain();
    252   double *M_double = ReturnFullMatrixforSymmetric(cell_size);
    253   Matrix M = Matrix(M_double);
    254   delete[](M_double);
     246  Matrix M = ReturnFullMatrixforSymmetric(cell_size);
    255247  Matrix Minv = M.invert();
    256248
     
    282274{
    283275  double * const cell_size = World::getInstance().getDomain();
    284   double *matrix_double = ReturnFullMatrixforSymmetric(cell_size);
    285   Matrix matrix = Matrix(matrix_double);
    286   delete[](matrix_double);
     276  Matrix matrix = ReturnFullMatrixforSymmetric(cell_size);
    287277  Matrix inversematrix = matrix.invert();
    288278  double tmp;
Note: See TracChangeset for help on using the changeset viewer.