def nadkin(self): if isinstance(self._nadkin, xcfun.Functional): return self._nadkin elif self._nadkin.upper() == 'TF': return xcfun.Functional({'tfk': 1.0}) elif self._nadkin.upper() == 'PW91K': return xcfun.Functional({'pw91k': 1.0}) else: raise PyAdfError('Unknown nonadditive kinetic energy functional ' + str(self._nadkin) + 'in db-MBE job')
def nadxc(self): if isinstance(self._nadxc, xcfun.Functional): return self._nadxc elif self._nadxc.upper() == 'LDA': return xcfun.Functional({'lda': 1.0}) elif self._nadxc.upper() in ['BP', 'BP86']: return xcfun.Functional({'BeckeX': 1.0, 'P86C': 1.0}) elif self._nadxc.upper() in ['BLYP']: return xcfun.Functional({'BeckeX': 1.0, 'LYP': 1.0}) else: raise PyAdfError('Unknown nonadditive xc functional ' + str(self._nadxc) + ' in db-MBE job')
def test_lda_old(): fun_xc_name = 'LDA' fun_xc_weight = 1.0 fun_xc = xcfun.Functional({fun_xc_name: fun_xc_weight}) n = numpy.array([1.0]) result = fun_xc.eval_potential_n(n) energy = result[0, 0] potential = result[0, 1] print("Functional used: ", fun_xc_name, " weight ", fun_xc_weight) print(" density: ", n) print(" energy: ", energy) print(" potential: ", potential) assert_allclose(energy, -0.8101513) assert_allclose(potential, -1.06468341)
def main(): version = xcfun.xcfun_version() splash = xcfun.xcfun_splash() print "\n Sample use of python interface to xcfun" print "\n\nXCFun version ",version print splash fun_xc_name = 'LDA' fun_xc_weigth = 1.0 fun_xc = xcfun.Functional({fun_xc_name : fun_xc_weigth}) n_gn_gnn = numpy.zeros((1,10)) n_gn_gnn[0,:] = [1.0, 0.2, 0.2, 0.2, 0, 0, 0, 0, 0, 0] n = numpy.zeros((1,1)) n[0,:] = [1.0] result = fun_xc.eval_potential_n(n) energy = result[0,0] potential = result[0,1] print "Functional used: ",fun_xc_name," weight ",fun_xc_weigth print " density: ",n print " energy: ",energy print " potential: ",potential resut_energy = -0.8101513 resut_potential = -1.06468341 tol = 1.0e-7 energy_diff = energy - resut_energy potential_diff = potential - resut_potential if ((abs(energy_diff) > tol) or (abs(potential_diff) > tol)): sys.exit(EXIT_FAILURE) sys.exit()
def pbe_fun(): return xcfun.Functional({'PBE': 1.0})
def lda_fun(): return xcfun.Functional({'LDA': 1.0})
def set_fun_nad_xc(self): self.fun_nad_xc = xcfun.Functional(self.settings.nad_xc)
def set_fun_nad_kin(self): self.fun_nad_kin = xcfun.Functional(self.settings.nad_kin)
def set_fun_nad_xc(self): self.fun_nad_xc = xcfun.Functional(self.settings.nad_xc) self.check_fun_type(self.fun_nad_xc)
def set_fun_nad_kin(self): self.fun_nad_kin = xcfun.Functional(self.settings.nad_kin) self.check_fun_type(self.fun_nad_kin)