def __init__(self, atoms, restart=None, logfile='-', trajectory=None, dt=0.1, maxmove=0.2,dtmax=1.0,Nmin=5,finc=1.1,fdec=0.5, astart=0.1,fa=0.99,a=0.1): Optimizer.__init__(self, atoms, restart, logfile, trajectory) # if dt is not None: self.dt = dt self.Nsteps = 0 self.maxmove = maxmove self.dtmax = dtmax self.Nmin = Nmin self.finc = finc self.fdec = fdec self.astart = astart self.fa = fa self.a = a
def __init__(self, atoms, restart=None, logfile='-', trajectory=None, maxstep=0.2, dR=0.1, memory=25, alpha=0.05, method=None, damping=1.): Optimizer.__init__(self, atoms, restart, logfile, trajectory) if maxstep > 1.0: raise ValueError( 'Wanna fly? I know the calculation is too slow. ' + 'But you have to follow the rules.\n'+ ' The maximum step size %.1f' % maxstep +' is too big! \n'+ ' Try to set the maximum step size'+ ' below 0.2.') self.maxstep = maxstep self.dR = dR self.memory = memory self.alpha = alpha self.method = method self.damping = damping
def __init__(self, atoms, restart=None, logfile='-', trajectory=None, fmax=None, converged=None, hessianupdate='BFGS',hessian=None,forcemin=True, verbosity=None,maxradius=None, diagonal=20.,radius=None, transitionstate = False): Optimizer.__init__(self, atoms, restart, logfile, trajectory) self.eps = 1e-12 self.hessianupdate = hessianupdate self.forcemin = forcemin self.verbosity = verbosity self.diagonal = diagonal self.atoms = atoms n = len(self.atoms) * 3 if radius is None: self.radius = 0.05*np.sqrt(n)/10.0 else: self.radius = radius if maxradius is None: self.maxradius = 0.5*np.sqrt(n) else: self.maxradius = maxradius # 0.01 < radius < maxradius self.radius = max(min( self.radius, self.maxradius ), 0.0001) self.transitionstate = transitionstate # check if this is a nudged elastic band calculation if hasattr(atoms,'springconstant'): self.forcemin=False self.t0 = time.time()
def __init__(self, atoms, restart=None, logfile='-', trajectory=None, maxstep=None): """Quasi-Newton optimizer. Parameters: restart: string Pickle file used to store hessian matrix. If set, file with such a name will be searched and hessian matrix stored will be used, if the file exists. trajectory: string Pickle file used to store trajectory of atomic movement. maxstep: float Used to set the maximum distance an atom can move per iteration (default value is 0.04 Å). """ Optimizer.__init__(self, atoms, restart, logfile, trajectory) if maxstep is not None: if maxstep > 1.0: raise ValueError('You are using a much too large value for ' + 'the maximum step size: %.1f Å' % maxstep) self.maxstep = maxstep
def __init__(self, atoms, restart=None, logfile='-', trajectory=None, dt=None): Optimizer.__init__(self, atoms, restart, logfile, trajectory) if dt is not None: self.dt = dt
c = KeepInPlane(i['DIFFATOM'], (i['CONSATOM1'], i['CONSATOM2'])) atoms.wrap(atoms.get_scaled_positions()[i['DIFFATOM']]) atoms.set_calculator(Vasp()) i = Incar.from_file('INCAR') if i['EDIFFG'] < 0: i['NSW'] = 5000 i['NELM'] = 25 i['NELMIN'] = 3 i['IBRION'] = 3 i['POTIM'] = 0 i['PC_EDIFFG'] = i['EDIFFG'] i['EDIFFG'] = 1e-5 if 'IOPT' in i: del i['IOPT'] i.write_file('INCAR') atoms.set_constraint(c) Optimizer.converged = converged_fmax_or_emax dyn = Optimizer(atoms, trajectory='run.traj', restart='history.pckl', logfile='ase.out') dyn.run(fmax=-i['PC_EDIFFG']) if iterate: print('Converged') atoms = read('POSCAR') # type: Atoms dyn = Optimizer(atoms, trajectory='run.traj', restart='history.pckl') dyn.run(fmax=-i['PC_EDIFFG']) c = iterate() print('Done') {% endblock python %}