Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/helpers.cpp

    r112b09 r986ed3  
    88#include "helpers.hpp"
    99#include "Helpers/fast_functions.hpp"
     10#include "verbose.hpp"
    1011#include "log.hpp"
    11 #include "memoryusageobserver.hpp"
     12
     13#include <iostream>
    1214
    1315/********************************************** helpful functions *********************************/
     
    117119};
    118120
    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 /** Calculate the inverse of a 3x3 matrix.
    139  * \param *matrix NDIM_NDIM array
    140  */
    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 B
    150   if (fabs(detA) > MYEPSILON) {;  // RDET3(A) yields precisely zero if A irregular
    151     detAReci = 1./detA;
    152     B[0] =  detAReci*RDET2(A[4],A[5],A[7],A[8]);    // A_11
    153     B[1] = -detAReci*RDET2(A[1],A[2],A[7],A[8]);    // A_12
    154     B[2] =  detAReci*RDET2(A[1],A[2],A[4],A[5]);    // A_13
    155     B[3] = -detAReci*RDET2(A[3],A[5],A[6],A[8]);    // A_21
    156     B[4] =  detAReci*RDET2(A[0],A[2],A[6],A[8]);    // A_22
    157     B[5] = -detAReci*RDET2(A[0],A[2],A[3],A[5]);    // A_23
    158     B[6] =  detAReci*RDET2(A[3],A[4],A[6],A[7]);    // A_31
    159     B[7] = -detAReci*RDET2(A[0],A[1],A[6],A[7]);    // A_32
    160     B[8] =  detAReci*RDET2(A[0],A[1],A[3],A[4]);    // A_33
    161   }
    162   return B;
    163 };
    164 
    165 
    166 
    167121/** Comparison function for GSL heapsort on distances in two molecules.
    168122 * \param *a
Note: See TracChangeset for help on using the changeset viewer.