Ejemplo n.º 1
0
    def __init__(self, atoms, restart=None, logfile='-' , trajectory=None, soften = 0, factsoft = 0.7,
                 outer_optimizer=BFGS, finish_optimizer = GxOptimizer, opt_args=None, relax_max=2, liuconstr = None,
                 switchfinish = True, treat1 = True, treat2 = True, additionalcoords = [1, 2] ):
        """Structure optimizer object.
       source of the code is the following paper:
        H.-F. Wang and Z.-P. Liu: Comprehensive Mechanism and Structure-Sensitivity of Ethanol
        Oxidation on Platinum: New Transition-State Searching Method for Resolving the Complex
        Reaction Network, JACS 130 (2008), 10996

        atoms: Atoms object
            The Atoms object to relax.
        restart: str
            Filename for restart file.  Default value is *None*.
        logfile: file object or str
            If *logfile* is a string, a file with that name will be opened.
            Use '-' for stdout.
        trajectory: Trajectory object or str
            Attach trajectory object.  If *trajectory* is a string a
            PickleTrajectory will be constructed.  Use *None* for no
            trajectory.
        outer_optimizer: optimizer for the "Broyden steps"
        opt_args: **opt_args will be given to the outer optimizer, so if 
                  some addiditional arguments are wanted

        relax_max: after this amount of steps (integer) an update step
                  is performed
        liuconstr: constraint object

        treat1: if true calculate with treatment 1
        treat2: if true calculate with treatment 2
        soften: there are different implementations of treatment 2, soften
                chooses which one to take
        factsoft: treatment 2 wants a value, saying how much of change considerd
                  will be used for adjusting the neighboring atoms, different meaning
                  for the different soften values
        switchfinish: for the finishing of the calculation (if already near TS) there
                      may be the wanting for another (faster) transition state searcher
        finish_optimizer: optimizer which finishes after switchforfinish, will be used after
                          three update and four additional relaxation steps without any 
                          visible change to the coordinates
        """

        Dynamics.__init__(self, atoms, logfile, trajectory)
        # set optimizer
        if opt_args == None:
            self.dyn = outer_optimizer( atoms )
        else:
        # set optimizer with user given variables 
            self.dyn = outer_optimizer( atoms, **opt_args)

        self.restart = restart
        self.relax_max = relax_max
        self.stepsmax = None
        self.dyn.initialize()
        self.liuconstr = liuconstr
        self.treat1 = treat1
        self.treat2 = treat2
        self.soften = soften
        self.factsoft = factsoft
        self.switchfinish = switchfinish
        self.finish_optimizer = finish_optimizer
        self.logout = open('liu.output','w')
        self.adcoord = additionalcoords
Ejemplo n.º 2
0
 def __init__(self, atoms, timestep, trajectory):
     Dynamics.__init__(self, atoms, logfile=None, trajectory=trajectory)
     self.dt = timestep
     self.masses = self.atoms.get_masses()
     self.masses.shape = (-1, 1)