PEATSA/Core/Goodvibes/Main.py
def hessian_calculation(self, N, d_coordinates, chains, atoms_hessian, cutoff, d_secondary, matrix_distances, l_coordinates, l_rem = [], verbose = False):

        '''This function calculates the Hessian matrix. At least its supposed to...'''

        if verbose == True:
            print 'calculating the hessian/second-order derivate Kirchoff/Laplacian matrix'
        
        import math, Numeric

        cutoff_sq = cutoff**2

        matrix_hessian = Numeric.zeros((3*N,3*N), typecode='d')
        
        for row_sup in range(N):
            for col_sup in range(N):

                if col_sup > row_sup:
                    xi = l_coordinates[row_sup][0]
                    xj = l_coordinates[col_sup][0]
                    yi = l_coordinates[row_sup][1]
                    yj = l_coordinates[col_sup][1]
                    zi = l_coordinates[row_sup][2]
                    zj = l_coordinates[col_sup][2]
                    x = xj-xi
                    y = yj-yi
                    z = zj-zi
                    dist_sq = x**2+y**2+z**2
##                    if dist_sq <= cutoff_sq:
                    sigmoidfactor = Utilities.sigmoid(math.sqrt(dist_sq), cutoff)
                    vector = [x,y,z]
                    for row_sub in range(3):
                        for col_sub in range(3):

                            if col_sub >= row_sub: #fill supersymmetrical elements when j>=i
                                value = sigmoidfactor*-vector[row_sub]*vector[col_sub]/dist_sq
                                matrix_hessian[3*row_sup+row_sub,3*col_sup+col_sub] = value ##upper super off-diagonal; xixj, xiyj, xizj, yiyj, yizj, zizj
                                matrix_hessian[3*col_sup+col_sub,3*row_sup+row_sub] = value ##lower super off-diagonal; xjxi, yjxi, zjxi, yjyi, zjyi, zjzi
                                matrix_hessian[3*row_sup+row_sub,3*row_sup+col_sub] -= value ##super diagonal (row); xixi, xiyi, xizi, yiyi, yizi, zizi
                                matrix_hessian[3*col_sup+col_sub,3*col_sup+row_sub] -= value ##super diagonal (col); xjxj, yjxj, zjxj, yjyj, zjyj, zjzj
                                if col_sub > row_sub: #fill lower subsymmetrical elements
                                    matrix_hessian[3*row_sup+col_sub,3*col_sup+row_sub] = value #upper super off-diagonal; yixj, zixj, ziyj
                                    matrix_hessian[3*col_sup+row_sub,3*row_sup+col_sub] = value #lower super off-diagonal; xjyi, xjzi, yjzi
                                    matrix_hessian[3*row_sup+col_sub,3*row_sup+row_sub] -= value ##super diagonal; yixi, zixi, ziyi
                                    matrix_hessian[3*col_sup+row_sub,3*col_sup+col_sub] -= value ##super diagonal; yjxj, zjxj, zjyj

        return matrix_hessian
This function calculates the Hessian matrix. At least its supposed to...
This function calculates the Hessian matrix. At least its supposed to
This function calculates the Hessian matrix . At least its supposed to
def hessian_calculation(self, N, d_coordinates, chains, atoms_hessian, cutoff, d_secondary, matrix_distances, l_coordinates, l_rem = [], verbose = False):
        if verbose == True:
            print 'calculating the hessian/second-order derivate Kirchoff/Laplacian matrix'
        import math, Numeric
        cutoff_sq = cutoff**2
        matrix_hessian = Numeric.zeros((3*N,3*N), typecode='d')
        for row_sup in range(N):
            for col_sup in range(N):
                if col_sup > row_sup:
                    xi = l_coordinates[row_sup][0]
                    xj = l_coordinates[col_sup][0]
                    yi = l_coordinates[row_sup][1]
                    yj = l_coordinates[col_sup][1]
                    zi = l_coordinates[row_sup][2]
                    zj = l_coordinates[col_sup][2]
                    x = xj-xi
                    y = yj-yi
                    z = zj-zi
                    dist_sq = x**2+y**2+z**2
                    sigmoidfactor = Utilities.sigmoid(math.sqrt(dist_sq), cutoff)
                    vector = [x,y,z]
                    for row_sub in range(3):
                        for col_sub in range(3):
                            if col_sub >= row_sub: 
                                value = sigmoidfactor*-vector[row_sub]*vector[col_sub]/dist_sq
                                matrix_hessian[3*row_sup+row_sub,3*col_sup+col_sub] = value 
                                matrix_hessian[3*col_sup+col_sub,3*row_sup+row_sub] = value 
                                matrix_hessian[3*row_sup+row_sub,3*row_sup+col_sub] -= value 
                                matrix_hessian[3*col_sup+col_sub,3*col_sup+row_sub] -= value 
                                if col_sub > row_sub: 
                                    matrix_hessian[3*row_sup+col_sub,3*col_sup+row_sub] = value 
                                    matrix_hessian[3*col_sup+row_sub,3*row_sup+col_sub] = value 
                                    matrix_hessian[3*row_sup+col_sub,3*row_sup+row_sub] -= value 
                                    matrix_hessian[3*col_sup+row_sub,3*col_sup+col_sub] -= value 
        return matrix_hessian
def hessian_calculation ( self , N , d_coordinates , chains , atoms_hessian , cutoff , d_secondary , matrix_distances , l_coordinates , l_rem = [ ] , verbose = False ) : if verbose == True : print 'calculating the hessian/second-order derivate Kirchoff/Laplacian matrix' import math , Numeric cutoff_sq = cutoff ** 2 matrix_hessian = Numeric . zeros ( ( 3 * N , 3 * N ) , typecode = 'd' ) for row_sup in range ( N ) : for col_sup in range ( N ) : if col_sup > row_sup : xi = l_coordinates [ row_sup ] [ 0 ] xj = l_coordinates [ col_sup ] [ 0 ] yi = l_coordinates [ row_sup ] [ 1 ] yj = l_coordinates [ col_sup ] [ 1 ] zi = l_coordinates [ row_sup ] [ 2 ] zj = l_coordinates [ col_sup ] [ 2 ] x = xj - xi y = yj - yi z = zj - zi dist_sq = x ** 2 + y ** 2 + z ** 2 sigmoidfactor = Utilities . sigmoid ( math . sqrt ( dist_sq ) , cutoff ) vector = [ x , y , z ] for row_sub in range ( 3 ) : for col_sub in range ( 3 ) : if col_sub >= row_sub : value = sigmoidfactor * - vector [ row_sub ] * vector [ col_sub ] / dist_sq matrix_hessian [ 3 * row_sup + row_sub , 3 * col_sup + col_sub ] = value matrix_hessian [ 3 * col_sup + col_sub , 3 * row_sup + row_sub ] = value matrix_hessian [ 3 * row_sup + row_sub , 3 * row_sup + col_sub ] -= value matrix_hessian [ 3 * col_sup + col_sub , 3 * col_sup + row_sub ] -= value if col_sub > row_sub : matrix_hessian [ 3 * row_sup + col_sub , 3 * col_sup + row_sub ] = value matrix_hessian [ 3 * col_sup + row_sub , 3 * row_sup + col_sub ] = value matrix_hessian [ 3 * row_sup + col_sub , 3 * row_sup + row_sub ] -= value matrix_hessian [ 3 * col_sup + row_sub , 3 * col_sup + col_sub ] -= value return matrix_hessian
This function calculates the Hessian matrix.
This function calculates the Hessian matrix .
'''This function calculates the Hessian matrix. At least its supposed to...''' ##                    if dist_sq <= cutoff_sq: #fill supersymmetrical elements when j>=i ##upper super off-diagonal; xixj, xiyj, xizj, yiyj, yizj, zizj ##lower super off-diagonal; xjxi, yjxi, zjxi, yjyi, zjyi, zjzi ##super diagonal (row); xixi, xiyi, xizi, yiyi, yizi, zizi ##super diagonal (col); xjxj, yjxj, zjxj, yjyj, zjyj, zjzj #fill lower subsymmetrical elements #upper super off-diagonal; yixj, zixj, ziyj #lower super off-diagonal; xjyi, xjzi, yjzi ##super diagonal; yixi, zixi, ziyi ##super diagonal; yjxj, zjxj, zjyj
self
N
d_coordinates
chains
atoms_hessian
cutoff
d_secondary
matrix_distances
l_coordinates
l_rem
verbose