Changes in src/helpers.cpp [112b09:986ed3]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/helpers.cpp
r112b09 r986ed3 8 8 #include "helpers.hpp" 9 9 #include "Helpers/fast_functions.hpp" 10 #include "verbose.hpp" 10 11 #include "log.hpp" 11 #include "memoryusageobserver.hpp" 12 13 #include <iostream> 12 14 13 15 /********************************************** helpful functions *********************************/ … … 117 119 }; 118 120 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 components121 * \return allocated NDIM*NDIM array with the symmetric matrix122 */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 /** Calculate the inverse of a 3x3 matrix.139 * \param *matrix NDIM_NDIM array140 */141 double * InverseMatrix( const double * const A)142 {143 double *B = new double[NDIM * NDIM];144 double detA = RDET3(A);145 double detAReci;146 147 for (int i=0;i<NDIM*NDIM;++i)148 B[i] = 0.;149 // calculate the inverse B150 if (fabs(detA) > MYEPSILON) {; // RDET3(A) yields precisely zero if A irregular151 detAReci = 1./detA;152 B[0] = detAReci*RDET2(A[4],A[5],A[7],A[8]); // A_11153 B[1] = -detAReci*RDET2(A[1],A[2],A[7],A[8]); // A_12154 B[2] = detAReci*RDET2(A[1],A[2],A[4],A[5]); // A_13155 B[3] = -detAReci*RDET2(A[3],A[5],A[6],A[8]); // A_21156 B[4] = detAReci*RDET2(A[0],A[2],A[6],A[8]); // A_22157 B[5] = -detAReci*RDET2(A[0],A[2],A[3],A[5]); // A_23158 B[6] = detAReci*RDET2(A[3],A[4],A[6],A[7]); // A_31159 B[7] = -detAReci*RDET2(A[0],A[1],A[6],A[7]); // A_32160 B[8] = detAReci*RDET2(A[0],A[1],A[3],A[4]); // A_33161 }162 return B;163 };164 165 166 167 121 /** Comparison function for GSL heapsort on distances in two molecules. 168 122 * \param *a
Note:
See TracChangeset
for help on using the changeset viewer.