Exemple #1
0
    def __init__(self,
                 atoms,
                 timestep,
                 temperature,
                 taut=0.5e3 * units.fs,
                 pressure=1.01325,
                 taup=1e3 * units.fs,
                 compressibility=4.57e-5,
                 fixcm=True,
                 trajectory=None,
                 logfile=None,
                 loginterval=1,
                 append_trajectory=False):

        NVTBerendsen.__init__(self,
                              atoms,
                              timestep,
                              temperature,
                              taut,
                              fixcm,
                              trajectory,
                              logfile,
                              loginterval,
                              append_trajectory=append_trajectory)
        self.taup = taup
        self.pressure = pressure
        self.compressibility = compressibility
Exemple #2
0
    def __init__(self, atoms, timestep, temperature, taut, fixcm=True,
                 trajectory=None, **kwargs):

        NVTBerendsen.__init__(self, atoms, timestep, temperature, taut, 
                              fixcm, trajectory)
 
        OTF.__init__(self, **kwargs)

        self.md_engine = 'NVTBerendsen'
    def __init__(self, atoms, timestep, temperature, taut=0.5e3 *
                 units.fs, pressure=1.01325, taup=1e3 * units.fs,
                 compressibility=4.57e-5, fixcm=True, trajectory=None,
                 logfile=None, loginterval=1):

        NVTBerendsen.__init__(self, atoms, timestep, temperature,
                              taut, fixcm, trajectory, logfile,
                              loginterval)
        self.taup = taup
        self.pressure = pressure
        self.compressibility = compressibility
Exemple #4
0
 def set_initial_velocities(self, distribution, energy):
     distribution(self.atoms, energy)
     try:
         os.remove(self.traj)
     except:
         pass
     try:
         os.remove(self._log)
     except:
         pass
     NVTBerendsen.__init__(self,
                           atoms=self.atoms,
                           timestep=self.dt,
                           trajectory=self.traj,
                           loginterval=1,
                           logfile=self._log,
                           temperature=self.target_temperature,
                           taut=self.tau,
                           append_trajectory=False)
     self.update_properties()
    def __init__(self, atoms, timestep, temperature=None,
                 *, temperature_K=None, pressure=None, pressure_au=None,
                 taut=0.5e3 * units.fs, taup=1e3 * units.fs,
                 compressibility=None, compressibility_au=None, fixcm=True,
                 trajectory=None,
                 logfile=None, loginterval=1, append_trajectory=False):
        """Berendsen (constant N, P, T) molecular dynamics.

        This dynamics scale the velocities and volumes to maintain a constant
        pressure and temperature.  The shape of the simulation cell is not
        altered, if that is desired use Inhomogenous_NPTBerendsen.

        Parameters:

        atoms: Atoms object
            The list of atoms.

        timestep: float
            The time step in ASE time units.

        temperature: float
            The desired temperature, in Kelvin.

        temperature_K: float
            Alias for ``temperature``.

        pressure: float (deprecated)
            The desired pressure, in bar (1 bar = 1e5 Pa).  Deprecated,
            use ``pressure_au`` instead.

        pressure: float
            The desired pressure, in atomic units (eV/Å^3).

        taut: float
            Time constant for Berendsen temperature coupling in ASE
            time units.  Default: 0.5 ps.

        taup: float
            Time constant for Berendsen pressure coupling.  Default: 1 ps.

        compressibility: float (deprecated)
            The compressibility of the material, in bar-1.  Deprecated,
            use ``compressibility_au`` instead.

        compressibility_au: float
            The compressibility of the material, in atomic units (Å^3/eV).

        fixcm: bool (optional)
            If True, the position and momentum of the center of mass is
            kept unperturbed.  Default: True.

        trajectory: Trajectory object or str (optional)
            Attach trajectory object.  If *trajectory* is a string a
            Trajectory will be constructed.  Use *None* for no
            trajectory.

        logfile: file object or str (optional)
            If *logfile* is a string, a file with that name will be opened.
            Use '-' for stdout.

        loginterval: int (optional)
            Only write a log line for every *loginterval* time steps.  
            Default: 1

        append_trajectory: boolean (optional)
            Defaults to False, which causes the trajectory file to be
            overwriten each time the dynamics is restarted from scratch.
            If True, the new structures are appended to the trajectory
            file instead.


        """

        NVTBerendsen.__init__(self, atoms, timestep, temperature=temperature,
                              temperature_K=temperature_K,
                              taut=taut, fixcm=fixcm, trajectory=trajectory,
                              logfile=logfile, loginterval=loginterval,
                              append_trajectory=append_trajectory)
        self.taup = taup
        self.pressure = self._process_pressure(pressure, pressure_au)
        if compressibility is not None and compressibility_au is not None:
            raise TypeError(
                "Do not give both 'compressibility' and 'compressibility_au'")
        if compressibility is not None:
            # Specified in bar, convert to atomic units
            warnings.warn(FutureWarning(
                "Specify the compressibility in atomic units."))
            self.set_compressibility(
                compressibility_au=compressibility / (1e5 * units.Pascal))
        else:
            self.set_compressibility(compressibility_au=compressibility_au)