def __init__(self, show_text_output=False, write_gpw_file=None, inititer=0, **kwargs): GPAWFactory.__init__(self, show_text_output=show_text_output, write_gpw_file=write_gpw_file, **kwargs) self.inititer = inititer self.maxiter = kwargs['maxiter'] self.eigensolver = kwargs['eigensolver']
def calculator_factory(name, **kwargs): """Create an ASE calculator factory.""" if name == 'abinit': from ase.calculators.abinit import Abinit return CalculatorFactory(Abinit, 'Abinit', 'label', **kwargs) if name == 'aims': from ase.calculators.aims import Aims return CalculatorFactory(Aims, 'aims', 'label', **kwargs) if name == 'nwchem': from ase.calculators.nwchem import NWChem return CalculatorFactory(NWChem, 'NWChem', 'label', 'no k-points', **kwargs) if name == 'asap': from asap3 import EMT return CalculatorFactory(EMT, 'Asap', None, 'no k-points', **kwargs) if name == 'elk': from ase.calculators.elk import ELK return CalculatorFactory(ELK, 'ELK', 'label', **kwargs) if name == 'fleur': from ase.calculators.fleur import FLEUR return CalculatorFactory(FLEUR, 'FLEUR', 'workdir', **kwargs) if name == 'gpaw': from gpaw.factory import GPAWFactory return GPAWFactory(**kwargs) if name == 'hotbit': from hotbit import Calculator return CalculatorFactory(Calculator, 'Hotbit', 'txt', 'no k-points', **kwargs) if name == 'jacapo': from ase.calculators.jacapo import Jacapo return CalculatorFactory(Jacapo, 'Jacapo', 'nc', **kwargs) if name == 'vasp': from ase.calculators.vasp import Vasp return CalculatorFactory(Vasp, 'Vasp', None, **kwargs) classname = classnames.get(name, name.title()) module = __import__('ase.calculators.' + name, {}, None, [classname]) Class = getattr(module, classname) if name in ['emt', 'gaussian', 'lammpsrun', 'lj', 'mopac', 'morse']: kpts = 'no k-points' else: kpts = None if name in ['emt', 'lj', 'morse']: label = None else: label = 'label' return CalculatorFactory(Class, classname, label, kpts, **kwargs)
def __call__(self, name, atoms): calculator = GPAWFactory.__call__(self, name, atoms) calculator.set(nbands=-2) if name.split('-')[0] in ['Ne', 'Ar', 'Kr', 'Xe', 'Rn', 'K', 'Ca', 'Cs', 'Ba', 'Sr', 'Rb']: # MDTMP: not enough orbitals - use dzp! calculator.set(nbands=-1) calculator.set(basis='dzp') if name.split('-')[0] in ['Rb']: calculator.set(nbands=-1) if name.split('-')[0] in ['In', 'Cs', 'Sb', 'Ni', 'Ta', 'As', 'V', 'Ni', 'Li', 'Rb', 'Tl']: calculator.set(nbands=-3) if name.split('-')[0] in ['Ca', 'Zn', 'Zr', 'Pb', 'Sr', 'Xe', 'Rn', 'Ru', 'N', 'Os', 'Cl', 'Cd']: calculator.set(nbands=-4) if name.split('-')[0] in ['Sc']: calculator.set(nbands=-5) if name.split('-')[0] in ['Ba', 'Os']: calculator.set(nbands=-6) if name.split('-')[0] in ['K']: calculator.set(nbands=-7) if name.split('-')[0] in ['Ne', 'Ar', 'Kr']: calculator.set(nbands=-8) if name.split('-')[0] in ['Cr']: calculator.set(nbands=-10) if name.split('-')[0] in ['Ti', 'Cr', 'Fe', 'Y', 'Nb', 'Mo', 'Te', 'Hf', 'Re', 'Hg', 'Sb', 'Ca', 'Pd', 'Ni', 'Ta', 'Ru', 'Rh', 'V', 'Ag', 'Ir', 'W', 'Pt', 'Mn', 'Sn', 'Zn', 'Os', 'Mg', 'Zn', 'Na', 'Bi', 'Sc', 'Zr', ]: calculator.set(eigensolver='cg') calculator.set(parallel={'band': 1}) if name.split('-')[0] in ['Li', 'Na']: # https://listserv.fysik.dtu.dk/pipermail/gpaw-developers/2012-May/002870.html calculator.set(h=0.05) if name.split('-')[0] in ['Cs']: calculator.set(usesymm=False) calculator.set(eigensolver='cg') calculator.set(parallel={'band': 1}) if name.split('-')[0] in ['Mn']: calculator.set(mixer=MixerDif()) calculator.set(maxiter=450) if name.split('-')[0] in ['Cr']: calculator.set(mixer=MixerDif()) calculator.set(maxiter=650) return calculator
def __call__(self, name, atoms): calculator = GPAWFactory.__call__(self, name, atoms) if name.split('-')[0] in ['Li', 'Na']: # https://listserv.fysik.dtu.dk/pipermail/gpaw-developers/2012-May/002870.html calculator.set(h=0.11) if self.inititer > 0: try: calculator.set(eigensolver='cg') calculator.set(maxiter=self.inititer) atoms.set_calculator(calculator) atoms.get_potential_energy() except ConvergenceError: pass calculator.set(maxiter=self.maxiter) calculator.set(eigensolver=self.eigensolver) return calculator
calcopts.update({'nbands': -int(nbands)}) if run.startswith('szpdzp'): calcopts.update({'basis': 'szp(dzp)'}) if run.startswith('szdzp'): calcopts.update({'basis': 'sz(dzp)'}) if run.startswith('dzp'): calcopts.update({'basis': 'dzp'}) if 'cg' in run: calcopts.update({'eigensolver': 'cg'}) else: calcopts.update({'eigensolver': 'rmm-diis'}) if run.startswith('cgdzp'): calcopts.update({'basis': 'dzp'}) calcopts.update({'mixer': eval(rundefs[run])}) calcfactory = GPAWFactory(**calcopts) collection = Collection(data, atom_names + molecule_names, cell) task = Task( calcfactory=calcfactory, tag=tag, use_lock_files=True, collection=collection, cell=cell, ) keys = collection.keys() for m in ['Na2', 'NaCl']: # those seem to need cg keys.remove(m) task.run(keys)
if optimizer is not None: tag += '_%s' % optimizer calcopts_default = { 'mode': 'lcao', 'basis': 'dzp', 'xc': 'PBE', 'width': 0.0, 'fixmom': True, 'nbands': -2, # make systems converge 'mixer': Mixer(0.05, 2), 'maxiter': 300, } calcfactory_default = GPAWFactory(**calcopts_default) calcopts_d16 = calcopts_default.copy() calcopts_d16.update({'convergence': {'density': 1.e-6}}) calcfactory_d16 = GPAWFactory(**calcopts_d16) calcfactory = calcfactory_default collection = Collection(data, names, cell) taskopts = {'fmax': 0.05, 'steps': 100} if optimizer is not None: if 'D16' not in optimizer: taskopts.update({'optimizer': optimizer}) calcfactory = calcfactory_default else:
def __init__(self, show_text_output=False, write_gpw_file=None, **kwargs): GPAWFactory.__init__(self, show_text_output=show_text_output, write_gpw_file=write_gpw_file, **kwargs)
if len(sys.argv) == 1: optimizer = None else: optimizer = sys.argv[1] tag = 'htb_pw' if optimizer is not None: tag += '_%s' % optimizer calcfactory = GPAWFactory( mode=PW(), xc='PBE', width=0.1, maxiter=400, mixer=Mixer(0.10, 2), eigensolver='cg', # avoid problems with band parallelization communicator=serial_comm, ) taskopts = {'sfmax': 0.01, 'ssteps': 50} if optimizer is not None: taskopts.update({'soptimizer': optimizer}) task = Task(xc='LDA', calcfactory=calcfactory, tag=tag, use_lock_files=True, **taskopts)
def __call__(self, name, atoms): calculator = GPAWFactory.__call__(self, name, atoms) calculator.set(nbands=-2) if name.split('-')[0] in [ 'Ne', 'Ar', 'Kr', 'Xe', 'Rn', 'K', 'Ca', 'Cs', 'Ba', 'Sr', 'Rb' ]: # MDTMP: not enough orbitals - use dzp! calculator.set(nbands=-1) calculator.set(basis='dzp') if name.split('-')[0] in ['Rb']: calculator.set(nbands=-1) if name.split('-')[0] in [ 'In', 'Cs', 'Sb', 'Ni', 'Ta', 'As', 'V', 'Ni', 'Li', 'Rb', 'Tl' ]: calculator.set(nbands=-3) if name.split('-')[0] in [ 'Ca', 'Zn', 'Zr', 'Pb', 'Sr', 'Xe', 'Rn', 'Ru', 'N', 'Os', 'Cl', 'Cd' ]: calculator.set(nbands=-4) if name.split('-')[0] in ['Sc']: calculator.set(nbands=-5) if name.split('-')[0] in ['Ba', 'Os']: calculator.set(nbands=-6) if name.split('-')[0] in ['K']: calculator.set(nbands=-7) if name.split('-')[0] in ['Ne', 'Ar', 'Kr']: calculator.set(nbands=-8) if name.split('-')[0] in ['Cr']: calculator.set(nbands=-10) if name.split('-')[0] in [ 'Ti', 'Cr', 'Fe', 'Y', 'Nb', 'Mo', 'Te', 'Hf', 'Re', 'Hg', 'Sb', 'Ca', 'Pd', 'Ni', 'Ta', 'Ru', 'Rh', 'V', 'Ag', 'Ir', 'W', 'Pt', 'Mn', 'Sn', 'Zn', 'Os', 'Mg', 'Zn', 'Na', 'Bi', 'Sc', 'Zr', ]: calculator.set(eigensolver='cg') calculator.set(parallel={'band': 1}) if name.split('-')[0] in ['Li', 'Na']: # https://listserv.fysik.dtu.dk/pipermail/gpaw-developers/2012-May/002870.html calculator.set(h=0.05) if name.split('-')[0] in ['Cs']: calculator.set(symmetry='off') calculator.set(eigensolver='cg') calculator.set(parallel={'band': 1}) if name.split('-')[0] in ['Mn']: calculator.set(mixer=MixerDif()) calculator.set(maxiter=450) if name.split('-')[0] in ['Cr']: calculator.set(mixer=MixerDif()) calculator.set(maxiter=650) return calculator