Video 1. Section 2 summarized into a 1:30 minute video. For a detailed explanation, follow the tutorial below.
Our Argon atoms are now being simulated without the need of energy caps to prevent the solver from diverging, but we still need to set the temperature of the system to \(T = 85 K\). Temperature in our simulation can be estimated using the Equipartition Theorem, relating
kinetic energy (\(E_k\)) with temperature (\(T\))
$$T=\left.\left\langle\sum_{m}\frac{{2E}_k}{{3k}_bN}\ \right.\right\rangle\ ,$$
where \(E_k\) is the kinetic energy, \(k_b\) is the Boltzman constant, and \(N\) is the number of particles.
It is very likely that the temperature of the current system is exceedingly high (or very far from being at 85 K), and we still need to change the energy of the system to reduce the temperature.
This can be achieved by rescaling the velocity of the particles by a factor \(\gamma\) so that the temperature is set to a desired value. The factor \(\gamma\) is computed using the following expression
$$\gamma=\frac{3{Nk}_bT_{set}}{2E_k},$$
where \(E_k\) is the kinetic energy of the particles at equilibrium (before rescaling), \(T_{set}\) is the desired system temperature, \(k_b\) is the Boltzman constant, and \(N\) is the number of particles.
Next, we present two different methods that achieve the same objective using Scymol. The first and faster method is done by using Scymol's ability to automatically run multiple simulations in series while rescaling the velocities between each simulation until the temperature value converges
to the desired value of \(T_{set}\). The second and slower method is done by manually running several simulations in series while applying the velocity changes yourself using the Modify tool in Scymol.
flt_kinetic_energy = 0 flt_kb = 0.836031 flt_Tset = 85 flt_T = 0 for dct_particle_index in dct_every_particle_info[-int_total_nbr_of_particles:]: flt_kinetic_energy += 0.5 * dct_particle_index['Mass'] * ( dct_particle_index['Vel.x'] ** 2 + dct_particle_index['Vel.y'] ** 2 + dct_particle_index['Vel.z'] ** 2) flt_gamma_factor = (3 * flt_kb * flt_Tset) / (2 * flt_kinetic_energy / int_total_nbr_of_particles) flt_T = 2 * flt_kinetic_energy / (3 * flt_kb * int_total_nbr_of_particles) print('Current Temperature: ', flt_T) if flt_T < 83 or flt_T > 87: for dct_particle_index in dct_every_particle_info[-int_total_nbr_of_particles:]: dct_particle_index['Vel.x'] *= flt_gamma_factor dct_particle_index['Vel.y'] *= flt_gamma_factor dct_particle_index['Vel.z'] *= flt_gamma_factor
Code 1. This Python code rescales the velocities of the particles on the last step of a simulation by a factor \(\gamma\). It has to be applied several times (running equilibration steps in between).
In Code 1 we are:
1) Estimating the kinetic energy of the system.
2) Calculating the \(\gamma\) factor and the current system's temperature \(T\).
3) Multiplying the particles' velocities by \(\gamma\) if \(T\) is not close to \(T_{set} = 85K\).
For more information on how to write custom Python code into the program and which variables are intrinsic to Scymol please refer to XX. Go ahead and click on Run. After it finishes, go to the Analyze tab and verify that the temperature \(T\) is around 85 K.
Before proceeding to section 3, it is important to make sure that the temperature of our system is stable at around 85 K without any further temperature control. To do this, we run 1 simulation without any velocity rescaling for 50 ps. Go into the Run tab and change the number of simulations to be run in series to just 1 and the simulation time to 50 ps. Click on Run. When the simulation finishes, make sure that the temperature of the system at the last frame is indeed close to 85 K (between 81 and 89 K) it is fine. If it is anything outside this range, apply some additional velocity rescaling steps until the temperature stabilizes around 85 K.