예제 #1
0
def XPOL(L):

    coord = L[0] + '.xyz'
    main = L[1]  # name of main fragment
    N = int(L[2])  #no. of atoms in main fragment
    scaling = float(L[3])
    main_charge = int(L[4])
    main_mult = int(L[5])
    job = L[6]
    root = L[7]

    n = separate.separate(coord, main, N)  # n is no. of water molecules

    #replace_by_Q.replace_by_Q('uracil.xyz')

    for i in range(n):
        charge_water.pointcharge('Water' + str(i + 1) + '.xyz')

    for i in range(n):
        pc_water.pc_water(i + 1, n)

    gen_main_pc.gen_main_pc(main, n)

    #for i in range (n):
    #  gen_water_pc.gen_water_pc(i+1)

    make_input.make_input(main + '.xyz', main + '.pc', main_charge, main_mult)

    #for i in range (n):
    #  make_input.make_input('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'.pc')

    submit.submit(main + '_pc')

    #for i in range (n):
    #  submit.submit('Water'+str(i+1)+'_pc')

    En = energy.energy(main + '_pc.out')

    print En

    replace_by_Q.replace_by_Q(main + '.xyz', main +
                              '_pc.out')  #update uracil charges from 1st iter

    for i in range(n):
        gen_water_pc.gen_water_pc(
            i + 1, main,
            N)  #gen. pc files for water using updated uracil charges

    for i in range(n):
        make_input.make_input('Water' + str(i + 1) + '.xyz',
                              'Water' + str(i + 1) + '.pc')

    for i in range(n):
        submit.submit('Water' + str(i + 1) + '_pc')

    Eo = 0

    j = 0

    epsilon = 0.000001
    while (abs(Eo - En) >= epsilon):
        j += 1
        #print abs(Eo-En)
        print 'Starting iteration no. ' + str(j)
        Eo = En
        replace_by_Q.replace_by_Q(main + '.xyz',
                                  main + '_pc.out')  #update uracil charges
        for i in range(n):
            replace_by_Q.replace_by_Q('Water' + str(i + 1) + '.xyz',
                                      'Water' + str(i + 1) +
                                      '_pc.out')  #update water charges
        for i in range(n):
            pc_water.pc_water(i + 1, n)
        gen_main_pc.gen_main_pc(main, n)  #gen. uracil pc file
        for i in range(n):
            gen_water_pc.gen_water_pc(i + 1, main, N)  #gen. water pc file

        make_input.make_input(
            main + '.xyz', main + '.pc', main_charge,
            main_mult)  #make input files with updated charges
        for i in range(n):
            make_input.make_input('Water' + str(i + 1) + '.xyz',
                                  'Water' + str(i + 1) + '.pc')

        submit.submit(main + '_pc')  #submit input files
        for i in range(n):
            submit.submit('Water' + str(i + 1) + '_pc')

        En = energy.energy(main + '_pc.out')
        print "Energy of " + main + " after iteration  " + str(
            j) + " is " + str(En)
        print "delta E = " + str(abs(Eo - En))

# print 'Converged energy = '+str(En)+'\n\n'

# print 'Scaling the water point charges'
# for i in range(n):
#   replace_by_Q.replace_by_Q('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'_pc.out',scaling)
# for i in range (n):
#   pc_water.pc_water(i+1,n)
# gen_main_pc.gen_main_pc(main,n)#gen. main fragment pc file

    print 'Submitting EOM file'
    make_DLPNO_input.make_DLPNO_input(main + '.xyz', main + '.pc', job)
    submit.submit(main + '_' + job + '_EOM_pc')
    submit_CHELPG.submit(main + '_' + job + '_EOM_pc.root' + str(root) + '.' +
                         job)

    #Regenerating water charges from EE/IP/EA calc. of main frag.
    replace_by_Q_EOM.replace_by_Q_EOM(
        main + '.xyz',
        main + '_' + job + '_EOM_pc.root' + str(root) + '.' + job + '.out')
    for i in range(n):
        gen_water_pc.gen_water_pc(
            i + 1, main,
            N)  #gen. pc files for water using updated uracil charges

    for i in range(n):
        make_input.make_input('Water' + str(i + 1) + '.xyz',
                              'Water' + str(i + 1) + '.pc')

    for i in range(n):
        submit.submit('Water' + str(i + 1) + '_pc')
    for i in range(n):
        replace_by_Q.replace_by_Q('Water' + str(i + 1) + '.xyz',
                                  'Water' + str(i + 1) +
                                  '_pc.out')  #update water charges


#Now we have final water charges

    gen_main_pc.gen_main_pc(main, n)  #gen. main fragment pc file
    print 'Final files generated'

    print 'Submitting ' + job + ' file'
    # make_DLPNO_input.make_DLPNO_input(main+'.xyz',main+'.pc')
    # submit.submit(main+'_IP_DLPNO_pc')

    # print 'IP values obtained'

    make_DLPNO_input.make_DLPNO_input(main + '.xyz', main + '.pc', job)
    submit.submit(main + '_' + job + '_EOM_pc')

    return
예제 #2
0
def XPOL_n(L, iter_no):

    coord = L[0] + '.xyz'
    main = L[1]  # name of main fragment
    N = int(L[2])  #no. of atoms in main fragment
    scaling = float(L[3])
    main_charge = int(L[4])
    main_mult = int(L[5])
    job = L[6]
    root = int(L[7])

    f = open(main + '_time.txt', 'w')
    f.close()
    n = separate.separate(coord, main, N)  # n is no. of water molecules

    #replace_by_Q.replace_by_Q('uracil.xyz')

    for i in range(n):
        charge_water.pointcharge('Water' + str(i + 1) + '.xyz')

    for i in range(n):
        pc_water.pc_water(i + 1, n)

    for k in range(iter_no):
        gen_main_pc.gen_main_pc(main, n)

        make_input.make_input(main + '.xyz', main + '.pc', main_charge,
                              main_mult)

        submit.submit(main + '_pc')

        time = comp_time.comp_time(main + '_pc.out')  #comp. time calc.
        s = 'Time taken for iteration number ' + str(
            k + 1) + ' for main fragment :\n'
        s += time + '\n\n'
        f = open(main + '_time.txt', 'a')
        f.write(s)
        f.close()

        En = energy.energy(main + '_pc.out')

        f = open(main + '_energy.txt', 'a')
        s = 'Energy after iteration no. ' + str(k +
                                                1) + ' : ' + str(En) + '\n\n'
        f.write(s)
        f.close()
        replace_by_Q.replace_by_Q(
            main + '.xyz',
            main + '_pc.out')  #update uracil charges from 1st iter

        for i in range(n):
            gen_water_pc.gen_water_pc(
                i + 1, main,
                N)  #gen. pc files for water using updated uracil charges

        for i in range(n):
            make_input.make_input('Water' + str(i + 1) + '.xyz',
                                  'Water' + str(i + 1) + '.pc')

        for i in range(n):
            submit.submit('Water' + str(i + 1) + '_pc')

            time = comp_time.comp_time('Water' + str(i + 1) +
                                       '_pc.out')  #comp. time calc.
            s = 'Time taken for iteration number ' + str(
                k + 1) + ' for water mol. no. ' + str(i + 1) + ' :\n'
            s += time + '\n\n'
            f = open(main + '_time.txt', 'a')
            f.write(s)
            f.close()

        for i in range(n):
            replace_by_Q.replace_by_Q('Water' + str(i + 1) + '.xyz',
                                      'Water' + str(i + 1) +
                                      '_pc.out')  #update water charges
        for i in range(n):
            pc_water.pc_water(i + 1, n)

    gen_main_pc.gen_main_pc(main, n)  #gen. uracil pc file
    #   for i in range (n):
    #     gen_water_pc.gen_water_pc(i+1,main,N)#gen. water pc file

    #   make_input.make_input(main+'.xyz',main+'.pc',main_charge,main_mult)#make input files with updated charges
    #   for i in range (n):
    #     make_input.make_input('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'.pc')

    #   submit.submit(main+'_pc')#submit input files
    #   for i in range (n):
    #     submit.submit('Water'+str(i+1)+'_pc')

    #   En = energy.energy(main+'_pc.out')
    #   print "Energy of "+main+" after iteration  "+str(j)+" is "+str(En)
    #   print "delta E = " + str(abs(Eo-En))

    ## print 'Converged energy = '+str(En)+'\n\n'

    ## print 'Scaling the water point charges'
    ## for i in range(n):
    ##   replace_by_Q.replace_by_Q('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'_pc.out',scaling)
    ## for i in range (n):
    ##   pc_water.pc_water(i+1,n)
    ## gen_main_pc.gen_main_pc(main,n)#gen. main fragment pc file

    #############
    # print 'Submitting EOM file'
    # make_CIS_input.make_DLPNO_input(main+'.xyz',main+'.pc',job)
    # submit.submit(main+'_'+job+'_CIS_pc')
    #############

    # submit_CHELPG.submit(main+'_'+job+'_CIS_pc-iroot'+str(root)+'.csp')

    #Regenerating water charges from EE/IP/EA calc. of main frag.
    # replace_by_Q_EOM.replace_by_Q_EOM(main+'.xyz',main+'_'+job+'_CIS_pc.root'+str(root)+'.'+job+'.out')
    # for i in range (n):
    #   gen_water_pc.gen_water_pc(i+1,main,N)#gen. pc files for water using updated uracil charges

    # for i in range (n):
    #   make_input.make_input('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'.pc')

    # for i in range (n):
    #   submit.submit('Water'+str(i+1)+'_pc')
    # for i in range(n):
    #   replace_by_Q.replace_by_Q('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'_pc.out')#update water charges
    #Now we have final water charges

    # gen_main_pc.gen_main_pc(main,n)#gen. main fragment pc file
    # print 'Final files generated'

    # print 'Submitting '+job+' file'
    # make_DLPNO_input.make_DLPNO_input(main+'.xyz',main+'.pc')
    # submit.submit(main+'_IP_DLPNO_pc')

    # print 'IP values obtained'

    # make_CIS_input.make_DLPNO_input(main+'.xyz',main+'.pc',job)
    # submit.submit(main+'_'+job+'_CIS_pc')

    # append_IROOT.append_IROOT(main+'_'+job+'_EOM_pc.out',main,root)

    return En
예제 #3
0
n = separate.separate(N)

#replace_by_Q.replace_by_Q('uracil.xyz')

for i in range(n):
    charge_water.pointcharge('Water' + str(i + 1) + '.xyz')

for i in range(n):
    pc_water.pc_water(i + 1, n)

gen_uracil_pc.gen_uracil_pc(n)

#for i in range (n):
#  gen_water_pc.gen_water_pc(i+1)

make_input.make_input('uracil.xyz', 'uracil.pc')

#for i in range (n):
#  make_input.make_input('Water'+str(i+1)+'.xyz','Water'+str(i+1)+'.pc')

submit.submit('uracil_pc')

#for i in range (n):
#  submit.submit('Water'+str(i+1)+'_pc')

En = energy.energy('uracil_pc.out')

print En

replace_by_Q.replace_by_Q(
    'uracil.xyz', 'uracil_pc.out')  #update uracil charges from 1st iter