[docs]@dataclasses.dataclassclassTemperatureRampModifier(DynamicsModifier):"""Ramp the temperature from start_temperature to temperature. Attributes ---------- start_temperature: float, optional temperature to start from, if None, the temperature of the thermostat is used. end_temperature: float temperature to ramp to. interval: int, default 1 interval in which the temperature is changed. total_steps: int total number of steps in the simulation. References ---------- Code taken from ipsuite/calculators/ase_md.py """end_temperature:floattotal_steps:intstart_temperature:t.Optional[float]=Noneinterval:int=1defmodify(self,thermostat,step):# we use the thermostat, so we can also modify e.g. temperatureifself.start_temperatureisNone:# different thermostats call the temperature attribute differentlyiftemp:=getattr(thermostat,"temp",None):self.start_temperature=temp/units.kBeliftemp:=getattr(thermostat,"temperature",None):self.start_temperature=temp/units.kBelse:raiseAttributeError("No temperature attribute found in thermostat.")percentage=step/(self.total_steps-1)new_temperature=(1-percentage)*self.start_temperature+percentage*self.end_temperatureifstep%self.interval==0:thermostat.set_temperature(temperature_K=new_temperature)