예제 #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
                                n_frozen_core=0,
                                set_iter=1000,
                                mem_total=15000,
                                mem_static=900)

        output_s = get_output_from_qchem(
            qc_input_s,
            processors=4,
            force_recalculation=False,
            # parser=parser_rasci,
            store_full_output=True)
        # print(output_s)
        with open('qchem_output_{}.out'.format(atom.name), 'w') as f:
            f.write(output_s)

        output_s = parser_rasci(output_s)

        output_t = get_output_from_qchem(qc_input_t,
                                         processors=4,
                                         force_recalculation=False,
                                         parser=parser_rasci,
                                         store_full_output=True)

        print('\n---------------------------------------------')
        print('Atom: {}'.format(atom.name))
        print('Basis: {}'.format(basis_name))
        print('Active space singlet (ele, act, occ): {}'.format(
            active_spaces['singlet']))
        print('---------------------------------------------')

        for i, state in enumerate(output_s['excited_states']):
예제 #6
0
                                set_iter=1000,
                                mem_total=15000,
                                mem_static=900
                                )

        output_d = get_output_from_qchem(qc_input_d,
                                         processors=4,
                                         force_recalculation=False,
                                         # parser=parser_rasci,
                                         store_full_output=True
                                         )
        # print(output_s)
        with open('qchem_output_{}.out'.format(atom.name), 'w') as f:
            f.write(output_d)

        output_d = parser_rasci(output_d)

        print('\n---------------------------------------------')
        print('Atom: {}'.format(atom.name))
        print('Basis: {}'.format(basis_name))
        print('Active space (ele, act, occ): {}'.format(active_spaces))
        print('---------------------------------------------')

        for i, state in enumerate(output_d['excited_states']):
            print('Energy state {} ({}):  {: 18.12f} au'.format(i+1, state['multiplicity'], state['total_energy']))
            print(' Alpha  Beta   Amplitude')
            for j, conf in enumerate(state['configurations']):
                print('  {}  {} {:8.3f}'.format(conf['alpha'], conf['beta'], conf['amplitude']))

        print('\nsoc_tot (cm-1) [imaginary part]')
        print('   ' + ''.join(['{:^18}'.format(n) for n in range(1, 11)]))