Пример #1
0
    def __init__(
            self,
            workdir,
            pseudo,
            ecut_list_or_slice,
            atols_mev,
            runmode="sequential",
            spin_mode="polarized",
            acell=(8, 9, 10),
            smearing="fermi_dirac:0.1 eV",
            max_niter=50,
    ):
        """
        Args:
            workdir:
                Working directory.
            pseudo:
                string or Pseudo instance
            ecut_list_or_slice:
                List of cutoff energies or slice object (mainly used for infinite iterations).
            atols_mev:
                List of absolute tolerances in meV (3 entries corresponding to accuracy ["low", "normal", "high"]
            spin_mode:
                Defined how the electronic spin will be treated.
            acell:
                Lengths of the periodic box in Bohr.
            smearing:
                Smearing instance or string in the form "mode:tsmear". Default: FemiDirac with T=0.1 eV
        """
        self.pseudo = Pseudo.aspseudo(pseudo)

        self.atols_mev = atols_mev
        self.spin_mode = spin_mode
        self.smearing = Smearing.assmearing(smearing)
        self.acell = acell

        if isinstance(ecut_list_or_slice, slice):
            self.ecut_iterator = iterator_from_slice(ecut_list_or_slice)
        else:
            self.ecut_iterator = iter(ecut_list_or_slice)

        # Construct a generator that returns strategy objects.
        def strategy_generator():
            for ecut in self.ecut_iterator:
                yield self.strategy_with_ecut(ecut)

        super(PseudoIterativeConvergence, self).__init__(workdir,
                                                         runmode,
                                                         strategy_generator(),
                                                         max_niter=max_niter)

        if not self.isnc:
            raise NotImplementedError(
                "PAW convergence tests are not supported yet")
Пример #2
0
 def __getitem__(self, Z):
     """
     Retrieve pseudos for the atomic number z.
     Accepts both int and slice objects.
     """
     if isinstance(Z, slice):
         assert Z.stop is not None
         pseudos = []
         for znum in iterator_from_slice(Z):
             pseudos.extend(self._pseudos_with_z[znum])
         return pseudos
     else:
         return self._pseudos_with_z[Z]
Пример #3
0
 def __getitem__(self, Z):
     """
     Retrieve pseudos for the atomic number z.
     Accepts both int and slice objects.
     """
     if isinstance(Z, slice):
         assert Z.stop is not None
         pseudos = []
         for znum in iterator_from_slice(Z):
             pseudos.extend(self._pseudos_with_z[znum])
         return pseudos
     else:
         return self._pseudos_with_z[Z]
Пример #4
0
    def __init__(self, workdir, manager, pseudo, ecut_list_or_slice, atols_mev,
                 toldfe=1.e-8, spin_mode="polarized", 
                 acell=(8, 9, 10), smearing="fermi_dirac:0.1 eV", max_niter=50,):
        """
        Args:
            workdir:
                Working directory.
            pseudo:
                string or Pseudo instance
            ecut_list_or_slice:
                List of cutoff energies or slice object (mainly used for infinite iterations).
            atols_mev:
                List of absolute tolerances in meV (3 entries corresponding to accuracy ["low", "normal", "high"]
            manager:
                `TaskManager` object.
            spin_mode:
                Defined how the electronic spin will be treated.
            acell:
                Lengths of the periodic box in Bohr.
            smearing:
                Smearing instance or string in the form "mode:tsmear". Default: FemiDirac with T=0.1 eV
        """
        self.pseudo = Pseudo.aspseudo(pseudo)

        self.atols_mev = atols_mev
        self.toldfe = toldfe
        self.spin_mode = spin_mode
        self.smearing = Smearing.assmearing(smearing)
        self.acell = acell

        if isinstance(ecut_list_or_slice, slice):
            self.ecut_iterator = iterator_from_slice(ecut_list_or_slice)
        else:
            self.ecut_iterator = iter(ecut_list_or_slice)

        # Construct a generator that returns strategy objects.
        def strategy_generator():
            for ecut in self.ecut_iterator:
                yield self.strategy_with_ecut(ecut)

        super(PseudoIterativeConvergence, self).__init__(strategy_generator(), 
              max_niter=max_niter, workdir=workdir, manager=manager, )

        if not self.isnc:
            raise NotImplementedError("PAW convergence tests are not supported yet")