def get_density(self, grid=None, spacing=0.5, fit=False): if grid is None: grid = cubegrid(self.job.get_molecule(), spacing) dens = [f.results.get_nonfrozen_density(grid, fit=fit) for f in iter(self._frags)] dens = reduce(lambda x, y: x + y, dens) return dens
def __init__(self, adfres, prop, grid=None, spacing=0.5, frag=None): """ Constructor for densfjob. @param adfres: The results of the ADF job for which the density (or related quantity) should be calculated. @type adfres: L{adfsinglepointresults} or subclass. @param prop: The property to calculate. @type prop: L{PlotProperty} @param grid: The grid to use. If None, a default L{cubegrid} is used. @type grid: subclass of L{grid} @param frag: Which fragment to use. Default is 'Active'. This can be used to get the densities of specific frozen fragments. @type frag: str """ # pylint: disable=W0621 adfjob.__init__(self) self._adfresults = adfres if grid is None: self.grid = cubegrid(adfres.get_molecule(), spacing) else: self.grid = grid if frag is None: self._frag = 'Active' else: self._frag = frag if not isinstance(prop, PlotProperty): raise PyAdfError( 'densfjob needs to be initialized with PlotProperty') else: self.prop = prop # consistency checks for properties that are not implemented if 'orbs' in self.prop.opts: if ('Loc' not in self.prop.opts['orbs']) and \ not (self.prop.opts['orbs'].keys() == ['A']): raise PyAdfError( 'CJDENSF only working for NSYM=1 (irrep A) orbitals') if self.prop.pclass == 'potential': if 'func' in self.prop.opts: if self.prop.ptype not in ['kinpot', 'nadkin']: raise PyAdfError( "Functional cannot be selected in CJDENSF " "with this potential type") self._olddensf = False
def get_potential(self, grid=None, pot='total'): if grid == None: grid = cubegrid(self.job.get_molecule(), spacing) pospot = [ f.results.get_nonfrozen_potential(grid, pot=pot) for f in self._frags.fragiter() ] cappot = [ c.results.get_nonfrozen_potential(grid, pot=pot) for c in self._frags.capiter() ] posdens = reduce(lambda x, y: x + y, pospot) capdens = reduce(lambda x, y: x + y, cappot) return posdens - capdens
def get_density(self, grid=None, spacing=0.5, fit=False): if grid == None: grid = cubegrid(self.job.get_molecule(), spacing) posdens = [ f.results.get_nonfrozen_density(grid, fit=fit) for f in self._frags.fragiter() ] capdens = [ c.results.get_nonfrozen_density(grid, fit=fit) for c in self._frags.capiter() ] posdens = reduce(lambda x, y: x + y, posdens) capdens = reduce(lambda x, y: x + y, capdens) return posdens - capdens