Ejemplo n.º 1
0
 def setUpClass(cls):
     cls.si_structure = abilab.Structure.from_file(
         abidata.cif_file("si.cif"))
     cls.scf_inp = scf_input(cls.si_structure,
                             abidata.pseudos("14si.pspnc"),
                             ecut=2,
                             kppa=10)
Ejemplo n.º 2
0
 def setUpClass(cls):
     cls.si_structure = abilab.Structure.from_file(
         abidata.cif_file("si.cif"))
     cls.scf_inp = scf_input(cls.si_structure,
                             abidata.pseudos("14si.pspnc"),
                             ecut=2,
                             kppa=10)
     cls.out_file = os.path.join(abidata.dirpath, 'refs', 'si_ebands',
                                 'run.abo')
Ejemplo n.º 3
0
    def from_factory(cls, structure, pseudos, kppa=None, ecut=None, pawecutdg=None, nband=None, accuracy="normal",
                     spin_mode="polarized", smearing="fermi_dirac:0.1 eV", charge=0.0, scf_algorithm=None,
                     shift_mode="Monkhorst-Pack", extra_abivars={}, decorators=[], autoparal=False, spec={}):
        abiinput = scf_input(structure, pseudos, kppa=kppa, ecut=ecut, pawecutdg=pawecutdg, nband=nband,
                             accuracy=accuracy, spin_mode=spin_mode, smearing=smearing, charge=charge,
                             scf_algorithm=scf_algorithm, shift_mode=shift_mode)
        abiinput.set_vars(extra_abivars)
        for d in decorators:
            d(abiinput)

        return cls(abiinput, autoparal=autoparal, spec=spec)
Ejemplo n.º 4
0
    def test_scf_input(self):
        """Testing scf_input"""
        from abipy.abio.factories import scf_input
        inp = scf_input(self.si_structure, self.si_pseudo, kppa=None, ecut=None, pawecutdg=None, nband=None,
                        accuracy="normal", spin_mode="polarized", smearing="fermi_dirac:0.1 eV", charge=0.0,
                        scf_algorithm=None, shift_mode="Monkhorst-Pack")

        with self.assertRaises(AssertionError):
            self.abivalidate_input(inp)
        inp["ecut"] = 2
        self.abivalidate_input(inp)
Ejemplo n.º 5
0
    def test_scf_input(self):
        """Testing scf_input"""
        from abipy.abio.factories import scf_input
        inp = scf_input(self.si_structure, self.si_pseudo, kppa=None, ecut=None, pawecutdg=None, nband=None,
                        accuracy="normal", spin_mode="polarized", smearing="fermi_dirac:0.1 eV", charge=0.0,
                        scf_algorithm=None, shift_mode="Monkhorst-Pack")

        with self.assertRaises(AssertionError):
            self.abivalidate_input(inp)
        inp["ecut"] = 2
        self.abivalidate_input(inp)
Ejemplo n.º 6
0
 def test_scf_input(self):
     """Testing scf_input"""
     from abipy.abio.factories import scf_input
     kppa = 800
     inp = scf_input(self.si_structure,
                     self.si_pseudo,
                     kppa=None,
                     ecut=None,
                     pawecutdg=None,
                     nband=None,
                     accuracy="normal",
                     spin_mode="polarized",
                     smearing="fermi_dirac:0.1 eV",
                     charge=0.0,
                     scf_algorithm=None,
                     shift_mode="Monkhorst-Pack")
     inp.abivalidate()
Ejemplo n.º 7
0
 def setUpClass(cls):
     cls.si_structure = abilab.Structure.from_file(abidata.cif_file("si.cif"))
     cls.scf_inp = scf_input(cls.si_structure, abidata.pseudos("14si.pspnc"), ecut=2, kppa=10)
Ejemplo n.º 8
0
 def setUp(cls):
     cls.gan_structure = abilab.Structure.from_file(abidata.cif_file("gan.cif"))
     cls.gan_pseudos = [abidata.pseudos("31ga.pspnc").pseudo_with_symbol('Ga'),
            abidata.pseudos("7n.pspnc").pseudo_with_symbol('N')]
     cls.scf_inp = scf_input(cls.gan_structure, cls.gan_pseudos, ecut=2, kppa=10, smearing=None,
                             spin_mode="unpolarized")
Ejemplo n.º 9
0
 def setUpClass(cls):
     cls.si_structure = abilab.Structure.from_file(abidata.cif_file("si.cif"))
     cls.scf_inp = scf_input(cls.si_structure, abidata.pseudos("14si.pspnc"), ecut=2, kppa=10)
     cls.out_file = os.path.join(abidata.dirpath, 'refs', 'si_ebands', 'run.abo')
Ejemplo n.º 10
0
def make_scf_input(atoms,
                   ecut=26,
                   xc='LDA',
                   is_metal=True,
                   spin_mode='PM',
                   pp_family='gbrv',
                   pp_labels={},
                   ldau_type=0,
                   Hubbard_U_dict={},
                   **kwargs):
    """
    structure: ase atoms object.
    """

    spin_mode_dict = {'PM': 'unpolarized', 'FM': 'polarized', 'AFM': 'afm'}
    if spin_mode in spin_mode_dict:
        spin_mode = spin_mode_dict[spin_mode]
    structure, magmoms = to_abi_structure(atoms, magmoms=True)

    default_vars = dict(
        accuracy=5,
        ecut=ecut,
        iscf=7,
        iprcel=0,
        #fband=1.4,
        nbdbuf=4,
        autoparal=1,
        paral_kgb=0,
        paral_rf=0,
        nstep=80,
        prtvol=10,
        npulayit=18,
        nline=17,
        diemac=4,
        diemix=0.6,
        nnsclo=4,
        usexcnhat=1)

    if pp_family in ['gbrv', 'jth']:
        default_vars.update(dict(usexcnhat=1, pawecutdg=ecut * 2))

    non_metal_vars = {'diemac': 5, 'occopt': 1}

    metal_vars = {'diemac': 5e5, 'occopt': 3}

    PM_vars = {'nsppol': 1, 'nspinor': 1, 'nspden': 1}

    FM_vars = {
        'occopt': 3,
        'nsppol': 2,
    }

    AFM_vars = {'nsppol': 1, 'nspinor': 1, 'nspden': 2}

    if is_metal:
        default_vars.update(metal_vars)
    else:
        default_vars.update(non_metal_vars)
    if spin_mode == 'afm' and not is_metal:
        default_vars.update(AFM_vars)
    elif spin_mode == 'afm' and is_metal:
        default_vars.update(FM_vars)
    elif spin_mode == 'unpolarized':
        default_vars.update(PM_vars)
    else:
        default_vars.update(FM_vars)
    default_vars.update(kwargs)

    pseudos = find_all_pp(
        structure, xc, family=pp_family, label_dict=pp_labels)

    scf_inp = scf_input(
        structure=structure, pseudos=pseudos, ecut=ecut, spin_mode=spin_mode)

    scf_inp.set_vars(default_vars)

    if spin_mode != 'unpolarized':
        scf_inp = set_spinat(scf_inp, magmoms)

    print(scf_inp.to_string())

    return scf_inp