示例#1
0
    def test_eth_00_ras22(self):

        rasci = dict(self.rem)
        if do_alpha_beta:
            rasci.update({'ras_elec_alpha': 1,
                          'ras_elec_beta': 1})

        # create qchem input
        txt_input = create_qchem_input(self.molecule, **rasci)

        # calculate and parse qchem output
        output = get_output_from_qchem(txt_input,
                                       processors=4,
                                       store_full_output=True,
                                       force_recalculation=recalculate)
        data = parser_rasci(output)

        filename = self.__class__.__name__ + '_ras22.yaml'

        # create reference file
        if ctrl_print:
            with open(filename, 'w') as outfile:
                yaml.dump(data, outfile, default_flow_style=False, allow_unicode=True)

        with open(filename, 'r') as stream:
            data_loaded = yaml.load(stream, Loader=yaml.Loader)

        data = standardize_dictionary(data, decimal=2)

        #print(data)

        print(data_loaded)
        data_loaded = standardize_dictionary(data_loaded, decimal=2)

        self.assertDictEqual(data, data_loaded)
示例#2
0
    def test_srdft(self):

        # create qchem input
        qc_input = create_qchem_input(
            self.molecule,
            jobtype='sp',
            exchange='hf',
            correlation='rasci',
            basis='6-31G(d,p)',
            ras_act=2,
            ras_elec=2,
            ras_spin_mult=0,
            ras_roots=2,
            ras_do_hole=True,
            ras_sts_tm=True,
            # rasci sr-dft
            ras_omega=400,
            ras_srdft_cor='srpw92',
            ras_srdft_exc='srpbe',
            ras_natorb=False,
            set_iter=30,
            ras_srdft_damp=0.5)

        #from pyqchem.cache import SqlCache as CacheSystem

        #cache = CacheSystem()
        #cache.list_database()
        #output = cache.retrieve_calculation_data(qc_input, 'fullout')
        #print(output)

        # calculate and parse qchem output
        output = get_output_from_qchem(qc_input,
                                       processors=4,
                                       force_recalculation=recalculate,
                                       store_full_output=True)
        print(output)
        data = parser_rasci(output)

        filename = dir_path + '/' + self.__class__.__name__ + '_srdft.yaml'

        if remake_tests:
            with open(filename, 'w') as outfile:
                yaml.dump(data,
                          outfile,
                          default_flow_style=False,
                          allow_unicode=True)

        data = standardize_dictionary(data, decimal=2)

        with open(filename, 'r') as stream:
            data_loaded = yaml.load(stream, Loader=yaml.Loader)

        print(data_loaded)
        data_loaded = standardize_dictionary(data_loaded, decimal=2)

        self.assertDictEqual(data, data_loaded)
示例#3
0
    def test_srdft(self):

        # create qchem input
        txt_input = create_qchem_input(
            self.molecule,
            jobtype='sp',
            exchange='hf',
            correlation='rasci',
            basis='6-31G(d,p)',
            ras_act=4,
            ras_elec=4,
            ras_spin_mult=0,
            ras_roots=6,
            ras_do_hole=True,
            ras_sts_tm=True,
            # rasci sr-dft
            ras_omega=300,
            ras_srdft_cor='srpbe',
            ras_srdft_exc='srlsda',
            ras_natorb=False,
            set_iter=30,
            ras_srdft_damp=0.5)

        print(txt_input.get_txt())

        # calculate and parse qchem output
        output = get_output_from_qchem(txt_input,
                                       processors=4,
                                       force_recalculation=recalculate,
                                       store_full_output=True)

        print(output)
        data = parser_rasci(output)

        print(data)

        filename = dir_path + '/' + self.__class__.__name__ + '_srdft.yaml'

        if remake_tests:
            with open(filename, 'w') as outfile:
                yaml.dump(data,
                          outfile,
                          default_flow_style=False,
                          allow_unicode=True)

        data = standardize_dictionary(data)

        with open(filename, 'r') as stream:
            data_loaded = yaml.load(stream, Loader=yaml.Loader)

        print(data_loaded)
        data_loaded = standardize_dictionary(data_loaded)

        self.assertDictEqual(data, data_loaded)
示例#4
0
    def test_rasci(self):
        # create qchem input
        txt_input = create_qchem_input(self.molecule,
                                       jobtype='sp',
                                       exchange='hf',
                                       correlation='rasci',
                                       basis='sto-3g',
                                       ras_act=4,
                                       ras_elec=4,
                                       ras_spin_mult=1,
                                       ras_roots=6,
                                       ras_print=5,
                                       ras_do_hole=True,
                                       ras_sts_tm=True)

        # calculate and parse qchem output
        output = get_output_from_qchem(txt_input,
                                       processors=4,
                                       force_recalculation=recalculate,
                                       store_full_output=True)
        print(output)
        data = parser_rasci(output)

        print(data)

        filename = dir_path + '/' + self.__class__.__name__ + '_rasci.yaml'

        if remake_tests:
            with open(filename, 'w') as outfile:
                yaml.dump(data,
                          outfile,
                          default_flow_style=False,
                          allow_unicode=True)

        data = standardize_dictionary(data, decimal=2)

        with open(filename, 'r') as stream:
            data_loaded = yaml.load(stream, Loader=yaml.Loader)

        print(data_loaded)
        data_loaded = standardize_dictionary(data_loaded, decimal=2)

        self.assertDictEqual(data, data_loaded)
示例#5
0
    def test_eth_00_ras44(self):

        rasci = dict(self.rem)
        rasci.update({'ras_act': 4,
                      'ras_elec': 4,
                      'ras_occ': 6})
        if do_alpha_beta:
            rasci.update({'ras_elec_alpha': 2,
                          'ras_elec_beta': 2})


        # create qchem input
        txt_input = create_qchem_input(self.molecule, **rasci)

        # calculate and parse qchem output
        output = get_output_from_qchem(txt_input, processors=4)
        print(output)
        data = basic_rasci(output)

        print(data)

        filename = self.__class__.__name__ + '_ras44.yaml'

        # creat reference file
        if ctrl_print:
            with open(filename, 'w') as outfile:
                yaml.dump(data, outfile, default_flow_style=False, allow_unicode=True)

        with open(filename, 'r') as stream:
            data_loaded = yaml.safe_load(stream)

        data = standardize_dictionary(data)

        print(data_loaded)
        data_loaded = standardize_dictionary(data_loaded)

        self.assertDictEqual(data, data_loaded)