def get_fragment_density(self, grid=None, fit=False, orbs=None, order=None, frag=None): if (orbs is not None) and (not 'Loc' in orbs.keys()): if (order is not None) and (order > 1): raise PyAdfError("Derivatives not implemented for orbital densities.") if (frag is not None) and not (frag == 'active') : raise PyAdfError("Orbital densities only available for acyive fragment") return self.get_orbital_density(grid, orbs) elif (order is not None) and (order > 1): # the density itself prop = PlotPropertyFactory.newDensity('dens', fit=fit, orbs=orbs) dres = densfjob(self, prop, grid=grid, frag=frag).run() gfs = [dres.get_gridfunction()] # density gradient if order >= 1: prop = PlotPropertyFactory.newDensity('grad', fit=fit, orbs=orbs) dres = densfjob(self, prop, grid=grid, frag=frag).run() gfs.append(dres.get_gridfunction()) # density hessian if order >= 2: prop = PlotPropertyFactory.newDensity('hess', fit=fit, orbs=orbs) dres = densfjob(self, prop, grid=grid, frag=frag).run() gfs.append(dres.get_gridfunction()) return GridFunctionDensityWithDerivatives(gfs) else: prop = PlotPropertyFactory.newDensity('dens', fit, orbs) dres = densfjob(self, prop, grid=grid, frag=frag).run() return dres.get_gridfunction()
def get_nonfrozen_potential(self, grid=None, spacing=0.5, pot="total"): """ Returns the potential of the electron density of the nonfrozen (active) subsystem. @param grid: The grid to use. For details, see L{Plot.Grids}. @type grid: subclass of L{grid} """ prop = PlotPropertyFactory.newPotential(pot.lower()) res = densfjob(self, prop, grid=grid, frag='Active').run() return res.get_gridfunction()
def get_embedding_potential(self, grid=None, pot="total"): """ Returns the FDE embedding potential. @param grid: The grid to use. For details, see L{Plot.Grids}. @type grid: subclass of L{grid} """ if not self.job.is_fde_job(): raise PyAdfError("Can get embedding potenial only for FDE jobs") if pot.lower() == "total": prop = PlotPropertyFactory.newPotential("embpot") elif pot.lower() == "nuc": prop = PlotPropertyFactory.newPotential("embnuc") elif pot.lower() == "coul": prop = PlotPropertyFactory.newPotential("embcoul") elif pot.lower() == "xc": prop = PlotPropertyFactory.newPotential("nadxc") elif pot.lower() == "kin": prop = PlotPropertyFactory.newPotential("nadkin") elif pot.lower().startswith("kinpot"): s1, s2 = pot.split(None, 1) prop = PlotPropertyFactory.newPotential("nadkin", func=s2) else: raise PyAdfError("Unknown potential requested") res = densfjob(self, prop, grid=grid, frag="ALL").run() return res.get_gridfunction()
def get_frozen_potential(self, grid=None, pot="total"): """ Returns the potential belonging to the frozen electron density. @param grid: The grid to use. For details, see L{Plot.Grids}. @type grid: subclass of L{grid} """ if not self.job.is_fde_job(): raise PyAdfError("Can get frozen potential only for FDE jobs") prop = PlotPropertyFactory.newPotential(pot.lower()) frozenpot = [] for f in self.job.get_fragmentlist().get_frozen_frags(): afrozenpot = densfjob(self, prop, grid=grid, frag=f.fragname).run() frozenpot.append(afrozenpot.get_gridfunction()) frozenpot = reduce(lambda x, y: x + y, frozenpot) return frozenpot