NVTBerendsen¶
- class NVTBerendsen(initial_velocity=None, time_step=None, reservoir_temperature=None, heating_rate=None, thermostat_timescale=None)¶
The NVT Berendsen integrator class which implements the Berendsen thermostat.
- Parameters:
initial_velocity (
ConfigurationVelocities
|ZeroVelocities
|MaxwellBoltzmannDistribution
) – A class that implements a distribution of initial velocities for the particles in the MD simulation. Default:MaxwellBoltzmannDistribution
time_step (PhysicalQuantity of type time) – The time-step interval used in the MD simulation. Default:
1 * fs
reservoir_temperature (PhysicalQuantity of type temperature | list) – The reservoir temperature in the simulation. The temperature can be given as a single temperature value for the entire system, or as a list of 2-tuples of str and PhysicalQuantity of type temperature, applying local thermostats to the tagged groups of atoms. E.g.
[('group1', 280.0 * Kelvin), ('group2', 320.0 * Kelvin)]
. Default:300.0 * Kelvin
heating_rate (PhysicalQuantity of type temperature/time | None) – The heating rate of the target temperature. A value of None disables the heating of the system. Default:
0.0 * Kelvin / fs
thermostat_timescale (PhysicalQuantity of type time) – The time constant for Berendsen temperature coupling. Default:
100.0 * fs
- kineticEnergy(configuration)¶
- Parameters:
configuration (DistributedConfiguration) – The current configuration to calculate the kinetic energy of.
- Returns:
The kinetic energy of the current configuration.
- Return type:
PhysicalQuantity of type energy
- thermostats()¶
- Returns:
The list of thermostats.
- Return type:
list
- timeStep()¶
- Returns:
The time step.
- Return type:
PhysicalQuantity of type time
- uniqueString()¶
Return a unique string representing the state of the object.
Usage Example¶
Perform a molecular dynamics run of 50 steps on FCC Si, using the Berendsen thermostat:
# Set up configuration
bulk_configuration = BulkConfiguration(
bravais_lattice=FaceCenteredCubic(5.4306*Angstrom),
elements=[Silicon, Silicon],
fractional_coordinates=[[0.0, 0.0, 0.0], [0.25, 0.25, 0.25]]
)
# Set calculator
calculator = TremoloXCalculator(parameters=Tersoff_Si_1988b())
bulk_configuration.setCalculator(calculator)
# Set up MD method
method = NVTBerendsen(
time_step=1*femtoSecond,
reservoir_temperature=300*Kelvin,
thermostat_timescale=100*femtoSecond,
heating_rate=0*Kelvin/picoSecond,
initial_velocity=None
)
# Run MD simulation
md_trajectory = MolecularDynamics(
bulk_configuration,
constraints=[],
trajectory_filename='trajectory.nc',
steps=50,
log_interval=10,
method=method
)
Apply two thermostats to tagged groups of atoms of the configuration:
# Set up MD method with two thermostats on tagged groups of atoms.
method = NVTBerendsen(
time_step=1*femtoSecond,
reservoir_temperature=[('region1', 300*Kelvin), ('region2', 600*Kelvin)],
thermostat_timescale=100*femtoSecond,
heating_rate=0*Kelvin/picoSecond,
initial_velocity=None
)
Notes¶
The Berendsen thermostat can be used to approximately simulate a canonical NVT-ensemble, as described in Ref. [1].
You can specify one or more thermostats acting on tagged sub-groups of atoms of the configuration, by giving a list of
(tag-name, temperature)
-tuples instead of a single, globalreservoir_temperature
value.If a non-zero
heating_rate
is specified, the reservoir temperature will be changed linearly during the simulation, according to the specified heating rate.