예제 #1
0
def Eigenvalue_Coulomb_Matrix(Z, R, N=0):
    '''requires: : preordering of Z and R according to CM_full_sorted(Z, R, N)[1]
    (otherwise two identical molecules with atoms 1 and 2 switched in the Z and R array
    will be mapped onto different representations)
    '''
    #return(qml.representations.generate_eigenvalue_coulomb_matrix(Z, R, size = dim))
    return (jrep.CM_ev_unsrt(Z, R, N))
예제 #2
0
def dd_CM_ev_unsrt(Z, R, N, dx_index=0, ddx_index=0):

    Z = Z.astype(float)
    R = R.astype(float)
    N = float(N)

    fM = jrep.CM_ev_unsrt(Z, R, N)
    dim = len(Z)
    Hraw = hessian(jrep.CM_ev_unsrt, dx_index, ddx_index)(Z, R, N)

    #calculates dZdZ
    if (dx_index == 0):
        if (ddx_index == 0):
            '''
            sorting function, performs the following rearrangement:
            [[[[HdZraw[k, m, n] for k in range(dim)] for m in order] for n in order])
            '''
            dZdZ_ordered = np.transpose(Hraw, (1, 2, 0))

            return (dZdZ_ordered)

    #calculates dRdR
    if (dx_index == 1):
        if (ddx_index == 1):

            print("do dRdR sorting for unsorted ddCM_ev function")
            '''
            sorting function, performs the following rearrangement:
            [[[[[[HdRraw[n, i, x, j, y] for n in range(dim)] for y in range(3)] for j in range(dim)] for x in range(3)] for i in range(dim)])
            '''
            dRdR_ordered = np.transpose(Hraw, (1, 2, 3, 4, 0))

            return (dRdR_ordered)

    if (dx_index == 0 and ddx_index == 1) or (dx_index == 1
                                              and ddx_index == 0):
        print("you want to calculate dZdR or dRdZ, line 443")
        '''sorting function, performs the following reordering but in fast
        [[[[[HdZdRraw[m, i, j, x] for m in range(dim)] for x in range(3)] for j in range(dim)] for i in range(dim)]
        '''
        dZdR_ordered = np.transpose(Hraw, (1, 2, 3, 0))

        return (dZdR_ordered)

    if (dx_index == 2 or ddx_index == 2):
        return (Hraw)
예제 #3
0
def d_CM_ev_unsrt(Z, R, N, dx_index):
    '''
    Calculates first derivative of unsorted Coulomb Matrix eigenvalues w.r.t. dx_index
    '''
    dim = len(Z)
    print("len of Z:", dim)
    print("calculating Jacobian of Coulomb Matrix eigenvalues")
    fM = jrep.CM_ev_unsrt(Z, R, N)  #get order of sorted representation

    #direct derivative as jacobian
    dCM_ev = jacfwd(jrep.CM_ev_unsrt, dx_index)
    ref_dCM_ev = dCM_ev(Z, R, N)
    '''Not sure about reordering and values below. definitely need to recheck'''
    if (dx_index == 0):
        J_dZkl = jnp.asarray([[ref_dCM_ev[l][m] for l in range(dim)]
                              for m in range(dim)])
        return (J_dZkl)
    elif (dx_index == 1):
        #unordered derivative taken from sorted matrix
        J_dRkl = jnp.asarray([[[ref_dCM_ev[l][m][x] for l in range(dim)]
                               for x in range(3)] for m in range(dim)])
        return (J_dRkl)
    else:
        return (ref_dCM_ev)
예제 #4
0
to then move both H simultaneously anti-clockwise by an angle phi:
    
                H
               / phi
         C===C.......
        /
        H

'''

#calculate reference values
compound = qml.Compound(reference)
Z = compound.nuclear_charges.astype(float)
R = compound.coordinates

ref_M_EVCM = jrep.CM_ev_unsrt(Z, R, size = 4)


dZ_eigenvalues = [] #list of eigenvalue vectors. length is same as len of name_vector
dimZ_list = [] #dimension of files may vary. store all dimensions here


dZ_slot1_list = [[],[],[],[]]
dZ_slot2_list = [[],[],[],[]]
dZ_slot3_list = [[],[],[],[]]
dZ_slot4_list = [[],[],[],[]]

EVCM_aberration = []

M_list = [[],[],[],[]]
예제 #5
0
compound1 = qml.Compound(names[0])
compound2 = qml.Compound(names[1])

if do_fingerprint_distance:

    Z1 = compound1.nuclear_charges.astype(float)
    R1 = compound1.coordinates

    Z2 = compound2.nuclear_charges.astype(float)
    R2 = compound2.coordinates

    #calculate difference to reference constitution
    M_CM1 = jrep.CM_full_unsorted_matrix(Z1, R1, size=4)
    M_CM2 = jrep.CM_full_unsorted_matrix(Z2, R2, size=4)

    M_EVCM1 = jrep.CM_ev_unsrt(Z1, R1, N=0, size=4)
    M_EVCM2 = jrep.CM_ev_unsrt(Z2, R2, size=4)

    M_BOB1 = np.asarray(ZRNrep.Bag_of_Bonds(Z1, R1))
    M_BOB2 = np.asarray(ZRNrep.Bag_of_Bonds(Z2, R2))

    M_OM1 = jrep.OM_full_unsorted_matrix(Z1, R1)
    M_OM2 = jrep.OM_full_unsorted_matrix(Z2, R2)

    M_EVOM1 = jrep.OM_ev(Z1, R1)[0]
    M_EVOM2 = jrep.OM_ev(Z2, R2)[0]

    diff1 = (M_EVCM1 - M_EVCM2)
    diff2 = (M_BOB1 - M_BOB2)
    diff3 = (M_CM1.flatten() - M_CM2.flatten())
    diff4 = (M_OM1.flatten() - M_OM2.flatten())