def build_structure(self, ref="ae"): """ Returns the crystalline structure associated to this entry. Use the optimized lattice parameters obtained from reference ref. Returns None if no lattice parameter is available. """ # Get structure type and lattice parameters stype, a = self.struct_type, getattr(self, ref) # Handle missing value. if a is None: return None if stype == "bcc": return Structure.bcc(a, species=[self.symbol]) elif stype == "fcc": return Structure.fcc(a, species=[self.symbol]) elif stype == "rocksalt": return Structure.rocksalt(a, self.species) elif stype == "ABO3": return Structure.ABO3(a, self.species) elif stype == "hH": return half_heusler(a, self.species) raise ValueError("Don't know how to construct %s structure" % stype)
def build_structure(self, ref="ae"): """ Returns the crystalline structure associated to this entry. Use the optimized lattice parameters obtained from reference ref. Returns None if no lattice parameter is available. """ # Get structure type and lattice parameters stype, a = self.struct_type, getattr(self, ref) # Handle missing value. if a is None: return None if stype == "bcc": return Structure.bcc(a, species=[self.symbol]) elif stype == "fcc": return Structure.fcc(a, species=[self.symbol]) elif stype == "rocksalt": return Structure.rocksalt(a, self.species) elif stype == "ABO3": return Structure.ABO3(a, self.species) elif stype == "hH": raise NotImplementedError() #return Structure.hH(a, sites) raise ValueError("Don't know how to construct %s structure" % stype)
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))