Example #1
0
    def find_or_run_calculation(self):
        resultdirs = []
        resultdir_for_nl = {}
        previous_calc_dirs = ssc.get_matching_subdirectories(
            self._onecenter_searchdirs, ssc.COMPRESSION_WORKDIR_PREFIX)
        for shells, myinput in self._shells_and_inputs:
            shellnames = [sc.shell_ind_to_name(nn, ll) for nn, ll in shells]
            LOGGER.info('Processing compression for shell(s) {}'.format(
                ' '.join(shellnames)))
            resultdir = myinput.get_first_dir_with_matching_signature(
                previous_calc_dirs)
            recalculation_needed = not resultdir
            if recalculation_needed:
                resultdir = ssc.create_onecenter_workdir(
                    self._builddir, ssc.COMPRESSION_WORKDIR_PREFIX, self._elem)
                LOGGER.info(
                    'Calculating compressed atom ' + sc.log_path(resultdir))
                calculation = AtomCompressionCalculation(myinput)
                calculation.run(resultdir, self._onecenter_binary)
            else:
                LOGGER.info(
                    'Matching calculation found ' + sc.log_path(resultdir))
            self._extract_results_if_not_present(myinput, shells, resultdir)
            if recalculation_needed:
                myinput.store_signature(resultdir)
            resultdirs.append(resultdir)
            for nn, ll in shells:
                resultdir_for_nl[(nn, ll)] = resultdir

        self._resultdirs = resultdirs
        self._resultdir_for_nl = resultdir_for_nl
Example #2
0
    def _calculate_hubbus_corrected(self, result_spinavg,
                                    replace_empty_with_homo):
        workdir = os.path.join(self._workdir, "hubbu")
        logger.info("Calculating Hubbard U values " + sc.log_path(workdir))
        shells, ihomo, energies = self._get_shells_and_energies_for_deriv_calc(
            result_spinavg, replace_empty_with_homo)
        sc.create_workdir(workdir)
        all_derivs = self._calc_deriv_matrix(workdir,
                                             shells,
                                             energies,
                                             spin_averaged=True)
        all_derivs = 0.5 * (all_derivs + np.transpose(all_derivs))
        valence_hubbus = self._get_valence_derivs(all_derivs, ihomo,
                                                  replace_empty_with_homo)

        logger.info("Applying the Hubbard correction algorithm")
        # needs: ll, omega, Hubbard
        # value of l: print(shells[ihomo][1])
        # valence Hubbard: print(valence_hubbus[ihomo][ihomo])
        # omega: print(self._xcf.omega)
        corr_hubb = self._correct_hubbard(shells[ihomo][1],
                                          valence_hubbus[ihomo][ihomo])
        # correction
        valence_hubbus[ihomo][ihomo] = corr_hubb

        return valence_hubbus
Example #3
0
 def find_or_run_calculation(self):
     previous_calc_dirs = ssc.get_matching_subdirectories(
         self._onecenter_searchdirs, ssc.COMPRESSION_WORKDIR_PREFIX)
     resultdir = self._input.get_first_dir_with_matching_signature(
         previous_calc_dirs)
     recalculation_need = not resultdir
     if recalculation_need:
         resultdir = ssc.create_onecenter_workdir(
             self._builddir, ssc.COMPRESSION_WORKDIR_PREFIX, self._elem)
         LOGGER.info('Calculating compressed atom ' + sc.log_path(resultdir))
         calculation = AtomCompressionCalculation(self._input)
         calculation.run(resultdir, self._onecenter_binary)
     else:
         LOGGER.info('Matching calculation found ' + sc.log_path(resultdir))
     self._extract_results_if_not_present(self._input, resultdir)
     if recalculation_need:
         self._input.store_signature(resultdir)
     self._resultdir = resultdir
Example #4
0
 def find_or_run_calculation(self, eigenonly=False, eigenspinonly=False):
     previous_calc_dirs = ssc.get_matching_subdirectories(
         self._onecenter_searchdirs, ssc.ATOM_WORKDIR_PREFIX)
     resultdir = self._input.get_first_dir_with_matching_signature(
         previous_calc_dirs)
     if not resultdir:
         resultdir = self._do_calculation(eigenonly, eigenspinonly)
         if not (eigenonly or eigenspinonly):
             self._input.store_signature(resultdir)
     else:
         logger.info("Matching calculation found " + sc.log_path(resultdir))
     self._resultdir = resultdir
Example #5
0
 def _calculate_hubbus(self, result_spinavg, replace_empty_with_homo):
     workdir = os.path.join(self._workdir, "hubbu")
     logger.info("Calculating Hubbard U values " + sc.log_path(workdir))
     shells, ihomo, energies = self._get_shells_and_energies_for_deriv_calc(
         result_spinavg, replace_empty_with_homo)
     sc.create_workdir(workdir)
     all_derivs = self._calc_deriv_matrix(workdir, shells, energies,
                                          spin_averaged=True)
     all_derivs = 0.5 * (all_derivs + np.transpose(all_derivs))
     valence_hubbus = self._get_valence_derivs(all_derivs, ihomo,
                                               replace_empty_with_homo)
     return valence_hubbus
Example #6
0
 def _calculate_spinws(self, result_spinavg, replace_empty_with_homo):
     workdir = os.path.join(self._workdir, "spinw")
     logger.info("Calculating spinw values " + sc.log_path(workdir))
     shells, ihomo, energies = self._get_shells_and_energies_for_deriv_calc(
         result_spinavg, replace_empty_with_homo)
     sc.create_workdir(workdir)
     all_derivs_up, all_derivs_dn = self._calc_deriv_matrix(
         workdir, shells, energies, spin_averaged=False)
     spinws = 0.5 * (all_derivs_up - all_derivs_dn)
     spinws = 0.5 * (spinws + np.transpose(spinws))
     valence_spinws = self._get_valence_derivs(spinws, ihomo,
                                               replace_empty_with_homo)
     return valence_spinws
Example #7
0
 def find_or_run_calculation(self):
     previous_calc_dirs = ssc.get_matching_subdirectories(
         self._twocenter_searchdirs, ssc.TWOCNT_WORKDIR_PREFIX)
     resultdirs = self._input.get_all_dirs_with_matching_signature(
         previous_calc_dirs)
     calculation_needed = True
     for resultdir in resultdirs:
         if self._check_prereq_dir_links(resultdir):
             calculation_needed = False
             logger.info("Matching twocnt calculation found "
                         + sc.log_path(resultdir))
             break
     if calculation_needed:
         resultdir = ssc.create_twocenter_workdir(
             self._builddir, ssc.TWOCNT_WORKDIR_PREFIX, self._elem1,
             self._elem2)
         logger.info("Doing twocnt calculation " + sc.log_path(resultdir))
         self._create_prereq_dir_links(resultdir,)
         calculation = SkgenTwocntCalculation(self._input,
                                              self._compression_prereqs)
         calculation.run_and_convert_results(resultdir, self._twocnt_binary)
         self._input.store_signature(resultdir)
     self._resultdir = resultdir
Example #8
0
 def _calculate_spinaveraged_atom(self):
     workdir = os.path.join(self._workdir, "atom0")
     logger.info("Calculating spin averaged atom " + sc.log_path(workdir))
     self._atomconfig.make_spinaveraged()
     result_spinavg = self._calculate_free_atom(workdir)
     return result_spinavg