コード例 #1
0
def check_convert(path_out):
    '''
    Path_out is the out_file
    '''

    # ~#~#~#~#~#~#~#~#~#~ #
    # R e f _ e n e r g y #
    # ~#~#~#~#~#~#~#~#~#~ #

    ref_energy = defaultdict(dict)

    ref_energy["HBO.out"] = -100.0185822589

    # ~#~#~#~#~#~#~#~#~#~#~#~#~ #
    # S e t _ p a r a m e t e r #
    # ~#~#~#~#~#~#~#~#~#~#~#~#~ #

    cmd = "cp {0}/tests/{1} .".format(qpackage_root, path_out)
    subprocess.check_call([cmd], shell=True)

    cmd = "qp_convert_output_to_ezfio.py {0}".format(path_out)
    subprocess.check_call([cmd], shell=True)

    # Test 2
    cmd = "qp_edit -c {0}.ezfio".format(path_out)
    subprocess.check_call([cmd], shell=True)

    cmd = "qp_run SCF {0}.ezfio".format(path_out)
    subprocess.check_call([cmd], shell=True)

    # ~#~#~#~#~ #
    # C h e c k #
    # ~#~#~#~#~ #

    ezfio.set_file("{0}.ezfio".format(path_out))

    cur_e = ezfio.get_hartree_fock_energy()
    ref_e = ref_energy[path_out]

    if abs(cur_e - ref_e) <= precision:
        subprocess.call(["rm {0}".format(path_out)], shell=True)
        subprocess.call(["rm -R {0}.ezfio".format(path_out)], shell=True)
        return True
    else:
        raise ValueError(get_error_message([ref_e], [cur_e]))
コード例 #2
0
def check_convert(path_out):
    '''
    Path_out is the out_file
    '''

    # ~#~#~#~#~#~#~#~#~#~ #
    # R e f _ e n e r g y #
    # ~#~#~#~#~#~#~#~#~#~ #

    ref_energy = defaultdict(dict)

    ref_energy["HBO.out"] = -100.0185822589

    # ~#~#~#~#~#~#~#~#~#~#~#~#~ #
    # S e t _ p a r a m e t e r #
    # ~#~#~#~#~#~#~#~#~#~#~#~#~ #
    cmd = "qp_convert_output_to_ezfio.py {0}".format(path_out)
    subprocess.check_call([cmd], shell=True)

    # Test 2
    cmd = "qp_edit -c {0}.ezfio".format(path_out)
    subprocess.check_call([cmd], shell=True)

    cmd = "qp_run SCF {0}.ezfio".format(path_out)
    subprocess.check_call([cmd], shell=True)

    # ~#~#~#~#~ #
    # C h e c k #
    # ~#~#~#~#~ #

    ezfio.set_file("{0}.ezfio".format(path_out))

    cur_e = ezfio.get_hartree_fock_energy()
    ref_e = ref_energy[path_out]

    if abs(cur_e - ref_e) <= precision:
        subprocess.call(["rm -R {0}.ezfio".format(path_out)], shell=True)
        return True
    else:
        raise ValueError(get_error_message([ref_e], [cur_e]))
コード例 #3
0
def run_hf(geo, basis, mult=1, pseudo=False, remove_after_sucess=True):
    """
    Run a simle by default hf
    EZFIO path = geo.ezfio
    """

    # ~#~#~#~#~#~#~#~#~#~ #
    # R e f _ e n e r g y #
    # ~#~#~#~#~#~#~#~#~#~ #

    ref_energy = defaultdict(defaultdict)

    ref_energy["sto-3g"]["methane"] = Energy(-39.7267433402, None)
    ref_energy["vdz"]["SO2"] = Energy(None, -41.48912297776174)
    ref_energy["vdz"]["HBO"] = Energy(None, -19.11982530413317)

    # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
    # G l o b a l _ v a r i a b l e #
    # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #

    global has_hf_alredy
    has_hf_alredy = True

    # ~#~#~#~ #
    # I n i t #
    # ~#~#~#~ #

    init_folder(geo, basis, mult, pseudo)
    ezfio.set_file("{0}.ezfio".format(geo))

    # ~#~#~#~#~#~#~#~#~#~#~#~#~ #
    # S e t _ p a r a m e t e r #
    # ~#~#~#~#~#~#~#~#~#~#~#~#~ #
    ezfio.bielec_integrals_direct = False
    ezfio.bielec_integrals_threshold_ao = 1.e-15
    ezfio.bielec_integrals_disk_access_ao_integrals = "None"

    ezfio.bielec_integrals_threshold_mo = 1.e-15
    ezfio.bielec_integrals_disk_access_mo_integrals = "None"

    ezfio.hartree_fock_mo_guess_type = "Huckel"
    ezfio.hartree_fock_thresh_scf = 1.e-10
    ezfio.hartree_fock_n_it_scf_max = 100

    ezfio.pseudo_do_pseudo = pseudo

    # ~#~#~ #
    # R u n #
    # ~#~#~ #

    cmd = "qp_run SCF {0}.ezfio/".format(geo)
    subprocess.check_call([cmd], shell=True)

    # ~#~#~#~#~ #
    # C h e c k #
    # ~#~#~#~#~ #

    cur_e = ezfio.get_hartree_fock_energy()

    ref_e = ref_energy[basis][geo]
    if pseudo:
        ref_e = ref_e.with_pseudo
    else:
        ref_e = ref_e.without_pseudo

    if abs(cur_e - ref_e) <= precision:

        if remove_after_sucess:
            subprocess.call(["rm -R {0}.ezfio".format(geo)], shell=True)

        return True

    else:
        raise ValueError(get_error_message([ref_e], [cur_e]))
コード例 #4
0
def run_hf(geo, basis, mult=1, pseudo=False, remove_after_sucess=True):
    """
    Run a simle by default hf
    EZFIO path = geo.ezfio
    """

    # ~#~#~#~#~#~#~#~#~#~ #
    # R e f _ e n e r g y #
    # ~#~#~#~#~#~#~#~#~#~ #

    ref_energy = defaultdict(defaultdict)

    ref_energy["sto-3g"]["methane"] = Energy(-39.7267433402, None)
    ref_energy["vdz"]["SO2"] = Energy(None, -41.48912297776174)
    #   ref_energy["vdz"]["HBO"] = Energy(None, -19.1198231418)
    ref_energy["vdz"]["HBO"] = Energy(None, -19.1198254041)

    # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
    # G l o b a l _ v a r i a b l e #
    # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #

    global has_hf_alredy
    has_hf_alredy = True

    # ~#~#~#~ #
    # I n i t #
    # ~#~#~#~ #

    init_folder(geo, basis, mult, pseudo)
    ezfio.set_file("{0}.ezfio".format(geo))

    # ~#~#~#~#~#~#~#~#~#~#~#~#~ #
    # S e t _ p a r a m e t e r #
    # ~#~#~#~#~#~#~#~#~#~#~#~#~ #
    ezfio.integrals_bielec_direct = False
    ezfio.integrals_bielec_threshold_ao = 1.e-15
    ezfio.integrals_bielec_disk_access_ao_integrals = "None"

    ezfio.integrals_bielec_threshold_mo = 1.e-15
    ezfio.integrals_bielec_disk_access_mo_integrals = "None"

    ezfio.hartree_fock_mo_guess_type = "Huckel"
    ezfio.hartree_fock_thresh_scf = 1.e-10
    ezfio.hartree_fock_n_it_scf_max = 100

    ezfio.pseudo_do_pseudo = pseudo

    # ~#~#~ #
    # R u n #
    # ~#~#~ #

    #    cmd = "{0}/Hartree_Fock/SCF {1}.ezfio/".format(QP_src,geo)
    cmd = "qp_run SCF {0}.ezfio/".format(geo)
    subprocess.check_call([cmd], shell=True)

    # ~#~#~#~#~ #
    # C h e c k #
    # ~#~#~#~#~ #

    cur_e = ezfio.get_hartree_fock_energy()

    ref_e = ref_energy[basis][geo]
    if pseudo:
        ref_e = ref_e.with_pseudo
    else:
        ref_e = ref_e.without_pseudo

    if abs(cur_e - ref_e) <= precision:

        if remove_after_sucess:
            subprocess.call(["rm -R {0}.ezfio".format(geo)], shell=True)

        return True

    else:
        raise ValueError(get_error_message([ref_e], [cur_e]))