Ejemplo n.º 1
0
def CalculateSPANR(ChargeCoordinates):
    """
    #################################################################
    The span R (SPAN) is a size descriptor defined as
    the radius of the smallest sphere, centred on the centre
    of mass, completely enclosing all atoms of a molecule
    [G.A. Arteca, Molecular Shape Descriptors in Reviews in
    Computational Chemistry - Vol. 9, K.B. Lipkowitz, D. Boyd (Eds.),
    VCH Publishers, New York (NY), pp. 191-253, 1991]
    --->SPAN
    #################################################################
    """

    temp = []
    for coords in ChargeCoordinates:
        temp.append([
            descriptors3D.get_atomicMass(coords[3]),
            [coords[0], coords[1], coords[2]]
        ])

    masscenter = _GetMassCenter(temp)

    res = []
    for i in temp:
        res.append(GetAtomDistance(i[1], masscenter))

    return round(float(max(res)), 3)
Ejemplo n.º 2
0
def CalculateRadiusofGyration(ChargeCoordinates):
    """
    #################################################################
    Calculation of Radius of gyration.
    --->rygr
    #################################################################
    """
    temp = []

    for coords in ChargeCoordinates:
        temp.append([
            descriptors3D.get_atomicMass(coords[3]),
            [coords[0], coords[1], coords[2]]
        ])

    nAT = len(temp)

    masscenter = _GetMassCenter(temp)
    result = 0.0
    for i in range(nAT):
        dis = GetAtomDistance(temp[i][1], masscenter)
        result = result + temp[i][0] * scipy.power(dis, p=2)

    return round(
        scipy.sqrt(float(result / descriptors3D.get_MW(ChargeCoordinates))), 3)
Ejemplo n.º 3
0
def CalculateAtomicNumberMoRSE(lcoordinates):
    """
    #################################################################
    The calculation of  3-D MoRse descriptors 
    
    based on atomic number.
    #################################################################
    """
    R=_GetR(n=30)
    temp=[]
    mass = [descriptors3D.get_atomicMass(coords[3]) for coords in lcoordinates]
    for i in lcoordinates:
        #if i[0]!='H':
        temp.append([float(i[0]),float(i[1]),float(i[2])])
    DM=_GetGementricalDistanceMatrix(temp)
    nAT=len(temp)
    RDFresult={}
    
    for kkk,Ri in enumerate(R):        
        res=0.0
        for j in range(nAT-1):
            for k in range(j+1,nAT):
                res=res+mass[j]*mass[k]*math.sin(Ri*DM[j,k])/(Ri*DM[j,k])
        RDFresult['MoRSE'+'N'+str(kkk+1)]=round(res/144,3)
        
    return RDFresult       
Ejemplo n.º 4
0
def CalculateMassRDF(lcoordinates):
    """
    The calculation of radial distribution function (RDF)
    descriptors based on atomic mass.
    """
    mass = [descriptors3D.get_atomicMass(coords[3]) for coords in lcoordinates]
    R = _GetR(n=30)
    temp = []
    for i in lcoordinates:
        #if i[0]!='H':
        temp.append([float(i[0]), float(i[1]), float(i[2])])

    DM = GetGementricalDistanceMatrix(temp)
    nAT = len(temp)
    RDFresult = {}

    for kkk, Ri in enumerate(R):
        res = 0.0
        for j in range(nAT - 1):
            for k in range(j + 1, nAT):
                res = res + mass[j] * mass[k] * math.exp(
                    -_beta * math.pow(Ri - DM[j, k], 2))
        RDFresult['RDF' + 'M' + str(kkk + 1)] = round(res / 144, 3)

    return RDFresult
Ejemplo n.º 5
0
def GetInertiaMatrix(ChargeCoordinates):
    """
    #################################################################
    Get Inertia matrix based on atomic mass and optimized coordinates.
    #################################################################
    """
    temp = []
    for coords in ChargeCoordinates:
        temp.append([
            descriptors3D.get_atomicMass(coords[3]),
            [coords[0], coords[1], coords[2]]
        ])

    #
    #    masscenter=_GetMassCenter(temp)
    #
    #    for i,j in enumerate(temp):
    #        temp[i][1]=[d-masscenter[k] for k,d in enumerate(j[1])]

    nAT = len(temp)

    InertiaMatrix = scipy.zeros((3, 3))
    res11 = 0.0
    res22 = 0.0
    res33 = 0.0
    res12 = 0.0
    res23 = 0.0
    res13 = 0.0
    for i in range(nAT):
        res11 = res11 + temp[i][0] * (math.pow(temp[i][1][1], 2) +
                                      math.pow(temp[i][1][2], 2))
        res22 = res22 + temp[i][0] * (math.pow(temp[i][1][0], 2) +
                                      math.pow(temp[i][1][2], 2))
        res33 = res33 + temp[i][0] * (math.pow(temp[i][1][0], 2) +
                                      math.pow(temp[i][1][1], 2))
        res12 = res12 + temp[i][0] * (temp[i][1][0] * temp[i][1][1])
        res13 = res13 + temp[i][0] * (temp[i][1][0] * temp[i][1][2])
        res23 = res23 + temp[i][0] * (temp[i][1][1] * temp[i][1][2])
    InertiaMatrix[0, 0] = res11
    InertiaMatrix[1, 1] = res22
    InertiaMatrix[2, 2] = res33
    InertiaMatrix[0, 1] = res12
    InertiaMatrix[0, 2] = res13
    InertiaMatrix[1, 2] = res23
    InertiaMatrix[1, 0] = res12
    InertiaMatrix[2, 0] = res13
    InertiaMatrix[2, 1] = res23

    return InertiaMatrix
Ejemplo n.º 6
0
def CalculateAverageSPANR(ChargeCoordinates):
    """
    #################################################################
    The average span R (SPAM) is the root square of
    the ratio of SPAN over the number of atoms.
    --->ASPAN
    #################################################################
    """
    temp = []
    for coords in ChargeCoordinates:
        temp.append([
            descriptors3D.get_atomicMass(coords[3]),
            [coords[0], coords[1], coords[2]]
        ])

    nAT = len(temp)
    masscenter = _GetMassCenter(temp)
    res = []
    for i in temp:
        res.append(GetAtomDistance(i[1], masscenter))

    return round(math.pow(float(max(res)) / nAT, 0.5), 3)
Ejemplo n.º 7
0
def CalculateGravitational3D1(ChargeCoordinates):
    """
    #################################################################
    Calculation of Gravitational 3D index.
    --->grav1
    #################################################################
    """
    temp = []
    for coords in ChargeCoordinates:
        temp.append([
            descriptors3D.get_atomicMass(coords[3]),
            [coords[0], coords[1], coords[2]]
        ])

    nAT = len(temp)
    result = 0.0
    for i in range(nAT - 1):
        for j in range(i + 1, nAT):
            dis = GetAtomDistance(temp[i][1], temp[j][1])

            result = result + temp[i][0] * temp[j][0] / scipy.power(dis, p=2)

    return round(float(result) / 100, 3)