This tutorial uses results of previous tutorial
Please first run the calculations of:
and then copy the results here.
cp -r ../F5/MoS2/ .; cd MoS2
We start by creating a new directory for the relaxation procedure and copy the results of F5 into this folder.
mkdir relax ; cp * relax; cd relax
In this folder we now modify the inp.xml file to perform the force calculations and generate the
atom displacements. For this set the /fleurInput/calculationSetup/geometryOptimization/@l_f
switch to "T"
.
In the geometryOptimization
XML element you can also change the relaxation algorithm to something different (we keep
BFGS),
change the mixing
parameter, or adjust the criteria for a successful relaxation. Note that
you can limit the force calculations for each atom type to certain
orientations. This is done in the /fleurInput/atomGroups/atomGroup/force/@relaxXYZ
XML attribute. Each logical in this variable stands for one direction.
In this example we want to keep the Molybdenum atom fixed (having one
fixpoint in a structural relaxation is always a good idea because
otherwise and depending on the accuracy of the force calculation one may
obtain a small overall drift term for the whole unit cell). Set relaxXYZ
for Molybdenum to "FFF"
.
For the Sulfur atom we only consider a relaxation in z-direction (even
though in this example the forces in the other directions are
anyway). Set relaxXYZ
for Sulfur to "FFT"
.
Open an editor and modify the inp.xml
file as sketched above.
Invoke Fleur to calculate the forces for this configuration.
fleur_MPI
You will obtain a file relax.xml
. In every Fleur run this file is automatically included in the inp.xml
file whenever it is present. Investigate the file. You will first find a
list of displacements for each atom group. This is used to modify the
atom positions in the inp.xml
file. The displacements are
updated by every new force calculation. The other big block in the
relax.xml file is the relaxation history. Here you find for every
relaxation step and atom type a list of atom positions in cartesian
coordinates followed by the forces on the representative atom of this
atom type in
. You can use this list as an output, e.g., to look up the final atom positions in it, but it is also an input for Fleur that is used by the relaxation algorithm to determine the next atom positions. An experienced user may modify this file whenever a relaxation process seems to be problematic. For example in certain situations it may be a good idea to delete a part of the relaxation history: The BFGS algorithm constructs a quadratic model of the energy landscape around the equilibrium position. If the initial guess of the atom positions is too far away from the equilibrium positions such a model might not be a good approximation and then it can be advisable to delete parts of the relaxation history.
We now have to repeat the self-consistency calculation followed by
the force step several times to reach the equilibrium atom positions.
You can just invoke Fleur (keeping l_f="T"
) several times to do so. Have a look at the changes in the relax.xml
file while you do so. Note that a systematic approach to an automatization of this workflow is possible by using AiiDA
.
fleur_MPI
Repeat this step until Fleur stops with the terminal output
*****************************************
Run finished successfully
Stop message:
Structural relaxation: Done
*****************************************
Now the forces on the atoms are smaller than the respective convergence criterion and the atoms can be considered to having reached their equilibrium positions.
As soon as this is the case find the Sulfur z-positions of the last force step in the relax.xml
file and compare them to the original positions. How much did they
change? What is the energy difference between the two configurations?
cat relax.xml
Your relax.xml
file should look similar to the following output from the reference calculation (modified by removing some irrelevent digits):
<!-- Attention, absolute coordinates used here -->
<relaxation>
<displacements>
<displace> 0.0000000000 0.0000000000 0.0000000000 </displace>
<displace> 0.0000000000 0.0000000000 0.1241440877 </displace>
</displacements>
<relaxation-history>
<step energy=" -4848.0783742477">
<posforce> 0.0 -3.4367564958 0.0000000000 0.0 0.0 0.0000000000 </posforce>
<posforce> 0.0 3.4367564958 2.8500000000 0.0 0.0 0.0264193041 </posforce>
</step>
<step energy=" -4848.0796073368">
<posforce> 0.0 -3.4367564958 0.0000000000 0.0 0.0 0.0000000000 </posforce>
<posforce> 0.0 3.4367564958 2.8764193041 0.0 0.0 0.0204467483 </posforce>
</step>
<step energy=" -4848.0814980873">
<posforce> 0.0 -3.4367564958 0.0000000000 0.0 0.0 0.0000000000 </posforce>
<posforce> 0.0 3.4367564958 2.9668644801 0.0 0.0 0.0014379593 </posforce>
</step>
<step energy=" -4848.0815017836">
<posforce> 0.0 -3.4367564958 0.0000000000 0.0 0.0 0.0000000000 </posforce>
<posforce> 0.0 3.4367564958 2.9737063931 0.0 0.0 0.0000859404 </posforce>
</step>
<step energy=" -4848.0815013823">
<posforce> 0.0 -3.4367564958 0.0000000000 0.0 0.0 0.0000000000 </posforce>
<posforce> 0.0 3.4367564958 2.9741412959 0.0 0.0 0.0000005482 </posforce>
</step>
</relaxation-history>
</relaxation>
We can observe in this list of energies and forces that while the forces nearly vanish for the last relaxation step, the total energy becomes minimal for the second last step. Even though this is a very small discrepancy, one should be aware that something like this can happen due to several reasons, e.g., insufficient convergence with respect to parameters or missing force terms.
Sidenote: The cdn.hdf
file has become quite large because many densities are stored in it. You can investigate it by calling Fleur with
the -info
command line switch. You will obtain a list of
the densities together with time stamps and the distance to the previous
density. Of
course, there are ways to get rid of certain densities. One way is to
perform the Fleur calculations with the command line switch -last_extra
.
This will write another file out in every iteration that only contains the last charge density. One can then overwrite the cdn.hdf
file with
this additional file. Another way is to use Fleur command line options to actually delete densities from the cdn.hdf
file. A list of all Fleur
command line options can be obtained with the command line option -h
. But in this exercise we will not manipulate the cdn.hdf
file in such a way.
0 Comments