def __init__(self, frag1, frag2, basis, ghostbasis, settings, potoptions): metajob.__init__(self) self.frag1 = frag1 self.frag2 = frag2 self.supermol = frag1 + frag2 # switch off symmetry (just to be sure) self.frag1.set_symmetry('NOSYM') self.frag2.set_symmetry('NOSYM') self.supermol.set_symmetry('NOSYM') # if requested, add ghost basis functions to the active fragment if ghostbasis: self.frag1 = self.frag1.add_as_ghosts(self.frag2) self.basis = basis self.settings = settings self.potoptions = potoptions # maximum number of iterations in potential reconstruction if 'CYCLES' in self.potoptions: self.cyc = self.potoptions['CYCLES'] del self.potoptions['CYCLES'] else: self.cycles = 500
def __init__(self, mol_list, jobfunc, jobfunc_kwargs=None, order=2): """ Constructor for MBEJob. @param mol_list: list of monomer molecules @type mol_list: list of L{molecule}s @param jobfunc: function to perform calculation for one fragment, returning a results object @type jobfunc: function with signature calculate_mol(mol: molecule, frozen_mols: list of molecules, **kwargs) @param jobfunc_kwargs: kwargs that will be passed to jobfunc @type jobfunc_kwargs: dict or None @param order: many-body expansion order @type order: int """ metajob.__init__(self) self.mol_list = mol_list self.jobfunc = jobfunc if jobfunc_kwargs is None: self._jobfunc_kwargs = {} else: self._jobfunc_kwargs = jobfunc_kwargs self.order = order
def __init__(self, pathNames, settings, adfsettings=None, basis=None, core=None, fde=None, adffdesettings=None): metajob.__init__(self) if pathNames is None: raise PyAdfError('pathName should be supplied') else: self.pathNames = pathNames if settings is None: raise PyAdfError('no adffdeanalysissettings provided') else: self.settings = settings self.adfsettings = adfsettings self.adffdesettings = adffdesettings if basis is None: raise PyAdfError('No basis provided in adffdeanalysisjob') else: self.basis = basis self.core = core if fde is None: self.fde = {} else: self.fde = fde
def __init__(self, mol, settings): """ Initialize a numerical differences job @param mol: The molecule on which to perform the numerical differences calculation @type mol: Pyadf.Molecule.molecule @param settings: Settings for the numerical differentiation Can be overriden by child classes @type settings: numdiffsettings """ from Molecule import OBMolecule, OBFreeMolecule metajob.__init__(self) if not (isinstance(mol, OBFreeMolecule.Molecule) or isinstance(mol, OBMolecule.OBMolecule)): raise PyAdfError("Molecule missing in numdiffjob") self.molecule = mol if settings == None: self.settings = numdiffsettings() elif isinstance(settings, numdiffsettings): self.settings = settings else: raise PyAdfError("wrong settings object in numdiffjob")
def __init__(self, ebmbe_res, order=None, grid=None, nadkin=None, nadxc=None): """ Constructor for DensityBasedMBEJob. @param ebmbe_res: results of a previous (energy-based) MBEJob @type ebmbe_res: L{MBEResults} @param order: many-body expansion order; if None, same as in mberes will be used @type order: int or None @param grid: the integration grid that will be used for the db expansion @type grid: subclass of L{Grid} @param nadkin: nonadditive kinetic-energy functional (default: PW91k) @type nadkin: str or XCFun Functional object @param nadxc: nonadditive xc functional (default: XC functional from eb-MBE single points, if available) @type nadxc: str or XCFun Functional object """ metajob.__init__(self) self.ebmbe_res = ebmbe_res if order is None: self.order = ebmbe_res.order else: self.order = order if grid is None: raise PyAdfError('DensityBasedMBEJob requires a supermolecular grid.') self.grid = grid if nadkin is None: self._nadkin = 'PW91k' elif isinstance(nadkin, xcfun.Functional): self._nadkin = nadkin elif isinstance(nadkin, str) and nadkin.upper() in ['TF', 'PW91K']: self._nadkin = nadkin else: raise PyAdfError('Invalid nonadditive kinetic-energy functional in db-MBE job') if nadxc is None: if hasattr(self.ebmbe_res.res_by_comb[(0,)].job, 'functional'): self._nadxc = self.ebmbe_res.res_by_comb[(0,)].job.functional elif hasattr(self.ebmbe_res.res_by_comb[(0,)].job, 'settings') and \ hasattr(self.ebmbe_res.res_by_comb[(0,)].job.settings, 'functional'): self._nadxc = self.ebmbe_res.res_by_comb[(0, )].job.settings.functional else: raise PyAdfError('No nonadditive xc functional specified in db-MBE job') if self._nadxc.startswith('GGA '): self._nadxc = self._nadxc[4:] elif isinstance(nadxc, xcfun.Functional): self._nadxc = nadxc elif isinstance(nadxc, str) and nadxc.upper() in ['LDA', 'BP', 'BP86', 'BLYP']: self._nadxc = nadxc else: raise PyAdfError('Invalid nonadditive xc functional in db-MBE job')
def __init__(self, frags, basis, settings=None, core=None, pointcharges=None, options=None, fde=None, fdeoptions=None, adffdesetts=None): """ Initialize an FDE job. For most of the parameters see class L{adffragmentsjob}. @param fde: options for the FDE run; In addition to the standard options Freeze-Thaw (FT) can be controlled; By default a parallel FT will be done; For normal FT use 'NORMALFT' @type fde: dictionary """ metajob.__init__(self) if isinstance(frags, list): self._frags = fragmentlist(frags) else: self._frags = frags self._basis = basis self._settings = settings self._core = core self._pc = pointcharges self._options = options self._adffdesettings = adffdesetts if fde is None: self._fde = {} else: import copy self._fde = copy.copy(fde) if 'RELAXCYCLES' in self._fde: self._cycles = self._fde['RELAXCYCLES'] + 1 del self._fde['RELAXCYCLES'] else: self._cycles = 1 if 'NORMALFT' in self._fde: self._normalft = True del self._fde['NORMALFT'] else: self._normalft = False if fdeoptions is None: self._fdeoptions = {} else: self._fdeoptions = fdeoptions # make all fragments frozen and apply fdeoptions for f in iter(self._frags): f.isfrozen = True f.set_fdeoptions(self._fdeoptions)
def __init__(self, frags, adfoptions, diracoptions): metajob.__init__(self) if isinstance(frags, list): self._frags = fragmentlist(frags) else: self._frags = frags self._adfoptions = adfoptions self._diracoptions = diracoptions self._cycles = 0 if "fde" in self._adfoptions: if 'RELAXCYCLES' in self._adfoptions["fde"]: self._cycles = self._adfoptions["fde"]['RELAXCYCLES'] del self._adfoptions["fde"]['RELAXCYCLES']
def __init__(self, frags, basis, settings=None, core=None, pointcharges=None, fitbas=None, options=None): """ Initialize a MFCC job. @param frags: the list of MFCC fragment @type frags: L{cappedfragmentlist} @param basis: @type basis: @param settings: @type settings: @param core: @type core: @param pointcharges: @type pointcharges: @param fitbas: @type fitbas @param options: @type options: """ metajob.__init__(self) self._frags = frags self._basis = basis self._settings = settings self._core = core self._pc = pointcharges self._fitbas = fitbas self._options = options
def __init__(self, mol, settings, scfsettings, atoms='all', coordinates=('x', 'y', 'z')): """ Initialize a numerical gradient job @param mol: The molecule on which to perform the numerical gradient calculation @type mol: Pyadf.Molecule.molecule @param settings: settings for the numerical gradients run @type settings: numgradsettings @param scfsettings: settings for the ADF single point runs at the displaced geometries @type scfsettings: scfsettings @param atoms: Atoms for which the gradient shall be computed @type atoms: int or list of int @param coordinates: coordinates for which the gradient shall be computed (x, y or z) @type coordinates: str or list of str """ import ADFSinglePoint metajob.__init__(self) self.molecule = mol if settings is None: self.settings = numgradsettings() elif isinstance(settings, numgradsettings): self.settings = settings else: raise PyAdfError("numgradsettings missing in adfnumgradsjob") if not isinstance(scfsettings, ADFSinglePoint.adfscfsettings): raise PyAdfError("scfsettings missing in adfnumgradsjob") self.scfsettings = scfsettings if isinstance(atoms, int): atoms = [atoms] elif isinstance(atoms, list): for a in atoms: if not isinstance(a, int): raise PyAdfError( "int or list of int required for atoms to compute gradients" ) self.atoms = atoms if isinstance(coordinates, str): coordinates = [coordinates] check = ['x', 'y', 'z', 'X', 'Y', 'Z'] if isinstance(coordinates, list) or isinstance(coordinates, tuple): self.coordinates = [] for c in coordinates: if c not in check: raise PyAdfError( "wrong coordinates provided in adfnumgradsjob") else: self.coordinates.append(c.lower()) self.gradients = None
def __init__(self, molecules, settings, adfsettings=None, basis=None, core=None, fde=None, adffdesettings=None): """ Constructor of adffdeanalysisjob. @param molecules: molecules for which to run the analysis @type molecules: list of L{molecule} objects @param settings: settings for the adffdeanalysisjob @type settings: L{adffdeanalysissettings} @param adfsettings: settings for the ADF runs @type adfsettings: L{adfsettings} @param basis: basis set for the ADF runs @type basis: str @param core: frozen core for ADF runs @type core: str @param fde: settings for the fde runs @type fde: dictionary (see ADFFragments.py) """ metajob.__init__(self) if not isinstance(molecules, list): raise PyAdfError('molecule should be an instance of list') else: self.molecules = molecules if settings is None: raise PyAdfError('no adffdeanalysissettings provided') else: self.settings = settings self.adfsettings = adfsettings self.adffdesettings = adffdesettings if basis is None: raise PyAdfError('No basis provided in adffdeanalysisjob') else: self.basis = basis self.core = core if fde is None: self.fde = {} else: self.fde = fde