def test_new_with_decorators(self): """Testing AbinitInput.new_with_decorators.""" spinor_deco = ideco.SpinDecorator("spinor") smearing_deco = ideco.SmearingDecorator("nosmearing") new_inp = self.si_ebands.new_with_decorators(spinor_deco) new_inp = self.si_ebands.new_with_decorators( [spinor_deco, smearing_deco])
def test_dict_methods(self): """ Testing AbinitInput dict methods """ inp = ebands_input(abidata.cif_file("si.cif"), abidata.pseudos("14si.pspnc"), kppa=10, ecut=2)[0] inp = ideco.SpinDecorator("spinor")(inp) inp_dict = inp.as_dict() #self.assertIsInstance(inp_dict['abi_kwargs'], collections.OrderedDict) assert "abi_args" in inp_dict and len(inp_dict["abi_args"]) == len(inp) assert all(k in inp for k, _ in inp_dict["abi_args"]) self.assertPMGSONable(inp)
def test_spin_decorator(self): """Testing spin decorator.""" spinor_deco = ideco.SpinDecorator("spinor") self.assertMSONable(spinor_deco) print(spinor_deco) new_inp = spinor_deco(self.si_ebands) print(new_inp) # kptopt is set to 4 if non-collinear magnetism and kptopt == 3 is not specified. for dt in new_inp: assert dt["nsppol"] == 1 and dt["nspinor"] == 2 and dt["kptopt"] == 4 #self.validate_inp(new_inp) # kptopt should not be changes if it's set to 3 and non-collinear magnetism inp_with_kpt3 = self.si_ebands.deepcopy() inp_with_kpt3.kptopt = 3