def test_base(self): monkhorst = KSampling.monkhorst((3, 3, 3), (0.5, 0.5, 0.5), 0, False, False) gamma_centered = KSampling.gamma_centered((3, 3, 3), False, False) monkhorst.to_abivars() # Test dict methods self.assertMSONable(monkhorst) self.assertMSONable(gamma_centered)
def __init__(self, a_guess, struct_type, pseudo, ecut_list=None, pawecutdg=None, ngkpt=(8, 8, 8), spin_mode="unpolarized", include_soc=False, tolvrs=1.e-10, smearing="fermi_dirac:0.001 Ha", ecutsm=0.05, chksymbreak=0, workdir=None, manager=None): """ Build a :class:`Work` for the computation of the relaxed lattice parameter. Args: structure_type: fcc, bcc pseudo: :class:`Pseudo` object. ecut_list: Cutoff energy in Hartree ngkpt: MP divisions. spin_mode: Spin polarization mode. toldfe: Tolerance on the energy (Ha) smearing: Smearing technique. workdir: String specifing the working directory. manager: :class:`TaskManager` responsible for the submission of the tasks. """ super(RelaxWithGbrvParamsWork, self).__init__(workdir=workdir, manager=manager) self_pseudo = pseudo self.include_soc = include_soc self.struct_type = struct_type if struct_type == "bcc": structure = Structure.bcc(a_guess, species=[pseudo.symbol]) elif struct_type == "fcc": structure = Structure.fcc(a_guess, species=[pseudo.symbol]) # Set extra_abivars. extra_abivars = dict( pawecutdg=pawecutdg, tolvrs=tolvrs, prtwf=-1, fband=3.0, nstep=100, ntime=50, ecutsm=ecutsm, dilatmx=1.1, ) self.ecut_list = ecut_list smearing = Smearing.as_smearing(smearing) # Kpoint sampling: shiftk depends on struct_type shiftk = {"fcc": [0, 0, 0], "bcc": [0.5, 0.5, 0.5]}.get(struct_type) spin_mode = SpinMode.as_spinmode(spin_mode) ksampling = KSampling.monkhorst(ngkpt, chksymbreak=chksymbreak, shiftk=shiftk, use_time_reversal=spin_mode.nspinor==1) relax_algo = RelaxationMethod.atoms_and_cell() inp = abilab.AbinitInput(structure, pseudo) inp.add_abiobjects(ksampling, relax_algo, spin_mode, smearing) inp.set_vars(extra_abivars) # Register structure relaxation task. for ecut in self.ecut_list: self.relax_task = self.register_relax_task(inp.new_with_vars(ecut=ecut))
def __init__(self, structure, struct_type, pseudo, ecut=None, pawecutdg=None, ngkpt=(8, 8, 8), spin_mode="unpolarized", include_soc=False, toldfe=1.e-9, smearing="fermi_dirac:0.001 Ha", ecutsm=0.05, chksymbreak=0, workdir=None, manager=None, **kwargs): """ Build a :class:`Work` for the computation of the relaxed lattice parameter. Args: structure: :class:`Structure` object structure_type: fcc, bcc pseudo: :class:`Pseudo` object. ecut: Cutoff energy in Hartree ngkpt: MP divisions. spin_mode: Spin polarization mode. toldfe: Tolerance on the energy (Ha) smearing: Smearing technique. workdir: String specifing the working directory. manager: :class:`TaskManager` responsible for the submission of the tasks. """ super(GbrvRelaxAndEosWork, self).__init__(workdir=workdir, manager=manager) self.struct_type = struct_type # nband must be large enough to accomodate fractional occupancies. self._pseudo = pseudo self.include_soc = include_soc def gbrv_nband(pseudo): # nband/fband are usually too small for the GBRV calculations. # FIXME this is not optimal nband = pseudo.Z_val nband += 0.5 * nband nband = int(nband) nband = max(nband, 8) # Use even numer of bands. Needed when nspinor == 2 if nband % 2 != 0: nband += 1 return nband nband = gbrv_nband(self.dojo_pseudo) # Set extra_abivars. self.extra_abivars = dict( ecut=ecut, pawecutdg=pawecutdg, toldfe=toldfe, prtwf=-1, nband=nband, #ecutsm=0.5, #paral_kgb=paral_kgb ) self.extra_abivars.update(**kwargs) self.ecut = ecut self.smearing = Smearing.as_smearing(smearing) # Kpoint sampling: shiftk depends on struct_type shiftk = {"fcc": [0, 0, 0], "bcc": [0.5, 0.5, 0.5]}.get(struct_type) self.spin_mode = SpinMode.as_spinmode(spin_mode) self.ksampling = KSampling.monkhorst(ngkpt, chksymbreak=chksymbreak, shiftk=shiftk, use_time_reversal=self.spin_mode.nspinor==1) relax_algo = RelaxationMethod.atoms_and_cell() inp = abilab.AbinitInput(structure, pseudo) inp.add_abiobjects(self.ksampling, relax_algo, self.spin_mode, self.smearing) inp.set_vars(self.extra_abivars) # Register structure relaxation task. self.relax_task = self.register_relax_task(inp)
def __init__(self, structure, formula, struct_type, pseudos, xc, accuracy, ecut=None, pawecutdg=None, ngkpt=(8, 8, 8), fband=2.0, spin_mode="unpolarized", smearing="fermi_dirac:0.001 Ha", chksymbreak=0, workdir=None, manager=None): """ Build a :class:`Work` for the computation of the relaxed lattice parameter. Args: structure: :class:`Structure` object. struct_type: fcc, bcc pseudos: Pseudopotentials xc: Exchange-correlation type. accuracy: ecut: Cutoff energy in Hartree ngkpt: Divisions for k-mesh. fband: Input variable, used to compute the number of bands. spin_mode: Spin polarization mode. smearing: Smearing technique. chksymbreak: Input variable. workdir: String specifing the working directory. manager: :class:`TaskManager` responsible for the submission of the tasks. """ super(GbrvCompoundRelaxAndEosWork, self).__init__(workdir=workdir, manager=manager) self.pseudos = pseudos self.xc = xc if (any(xc != p.xc for p in pseudos)): raise ValueError("Input XC does not agree with XC from pseudos.") self.formula = formula self.struct_type = struct_type self.accuracy = accuracy self.ecut, self.pawecutdg = ecut, pawecutdg # Set extra_abivars. # Use tolvrs for the relaxation, toldfe for the EOS self.extra_abivars = dict( ecut=ecut, pawecutdg=pawecutdg, tolvrs=1e-10, ecutsm=0.5, mem_test=0, fband=fband, # nband must be large enough to accomodate fractional occupancies. #paral_kgb=kwargs.pop("paral_kgb", 0), #nband=nband, ) self.smearing = Smearing.as_smearing(smearing) # Kpoint sampling: shiftk depends on struct_type #shiftk = {"fcc": [0, 0, 0], "bcc": [0.5, 0.5, 0.5]}.get(struct_type) shiftk = [0, 0, 0] self.ksampling = KSampling.monkhorst(ngkpt, chksymbreak=chksymbreak, shiftk=shiftk) self.spin_mode = SpinMode.as_spinmode(spin_mode) relax_algo = RelaxationMethod.atoms_and_cell() inp = abilab.AbinitInput(structure, pseudos) inp.add_abiobjects(self.ksampling, relax_algo, self.spin_mode, self.smearing) inp.set_vars(self.extra_abivars) # Register structure relaxation task. self.relax_task = self.register_relax_task(inp)