You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now save the file as `sscha_gold.py` and execute it with:
116
+
117
+
.. code-block:: bash
118
+
119
+
$ python sscha_gold.py > output.log
120
+
121
+
And that's it.
122
+
**Congratulations!**
123
+
115
124
116
125
While the input may seem long, it is heavily commented, but lets go through it step by step.
117
126
At the very beginning, we simply import the sscha libraries, cellconstructor, the math libraries and the force field. This is done in python with the `import` statemets.
@@ -169,6 +178,49 @@ These parameters are almost self-explaining. However, we give a brief overview o
169
178
While MD or MC calculation represent the equilibrium probability distribution over time of the system by updating a single structure, the SSCHA encodes the whole probability distribution as an analytical function. Therefore, to compute properties, we can generate on the fly the ionic configurations that represent the equilibrium distributions.
170
179
The number of random configuration is exactly how many ionic configuration we generate to compute the properties (Free energy and Stress tensors)
171
180
181
+
The code that sets up and perform the SSCHA is the following:
So you see many classes. `ensemble` represent the ensemble of ionic configurations. We initialize it with the dynamical matrix (which represent how much atoms fluctuate around the centroids) and the temperature.
213
+
`minim` is a `SSCHA_Minimizer` object, which performs the free energy minimization. It contains all the info regarding the minimization algorithm, as the initial timestep (that here we set to 0.01). You can avoid setting the time-step, as the code will automatically guess the best value.
214
+
The `relax` is a `SSCHA` object: the class that takes care about the simulation and automatizes all the steps to perform a NVT or NPT calculation.
215
+
We pass the minimizer (which contains the ensemble with the temperature), the force-field (`calculator`), the number of configurations `N_configs` and the maximum number of iterations.
216
+
217
+
In this example, most of the time is spent in the minimization, however, if we replace the force-field with ab-initio DFT, the time tu run the minimization is negligible with respect to the time to compute energies and forces on the ensemble configurations.
218
+
The total (maximum) number of energy/forces calculations is equal to the number of configurations times the number of iterations (passed through the `max_pop` argument).
219
+
220
+
The calculation is submitted with `relax.relax()`. However, before running the calculation we introduce another object, the `IOInfo`.
221
+
This tells the `relax` to save information of the free energy, its gradient and the anharmonic phonon frequencies during the minimization in the files *minim_info.dat° and *minim_info.freqs*. It is not mandatory to introduce them, but it is very usefull as it allows to visualize the minimization while it is running.
0 commit comments