howto:converging_cutoff
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
converging_cutoff [2014/02/03 11:20] – remove tailing line in code blocks oschuett | howto:converging_cutoff [2020/08/21 10:15] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
+ | ===== Introduction ===== | ||
'' | '' | ||
simulation packages, requires the use of a real-space (RS) | simulation packages, requires the use of a real-space (RS) | ||
Line 24: | Line 25: | ||
calculations were carried out using CP2K version 2.4. | calculations were carried out using CP2K version 2.4. | ||
- | ===== '' | ||
- | Before we go through the input file, it is worth while to explain | + | ==== '' |
+ | Before we go through the input file, it is worthwhile | ||
how the multi-grid is constructed in '' | how the multi-grid is constructed in '' | ||
Gaussians are mapped onto the different grid levels. Hopefully this | Gaussians are mapped onto the different grid levels. Hopefully this | ||
- | will offer the reader | + | will offer the reader a clear picture of how the key control |
parameters affect the grids, and thus the overall accuracy of a | parameters affect the grids, and thus the overall accuracy of a | ||
calculation. | calculation. | ||
All multi-grid related settings for a calculation is controlled via | All multi-grid related settings for a calculation is controlled via | ||
- | keywords in [[http:// | + | keywords in [[inp>FORCE_EVAL/ |
- | [[http:// | + | [[inp>FORCE_EVAL|FORCE_EVAL]]. The number of levels for the multi-grid is defined by |
- | [[http:// | + | [[inp>FORCE_EVAL/ |
defines the planewave cutoff (default unit is in Ry) for the | defines the planewave cutoff (default unit is in Ry) for the | ||
//finest// level of the multi-grid. | //finest// level of the multi-grid. | ||
Line 48: | Line 49: | ||
where \(\alpha\) has a default value of 3.0, and since '' | where \(\alpha\) has a default value of 3.0, and since '' | ||
versions 2.0, can be configured by the keyword | versions 2.0, can be configured by the keyword | ||
- | [[http:// | + | [[inp>FORCE_EVAL/ |
the finer grid for all multi-grid levels. | the finer grid for all multi-grid levels. | ||
Having constructed the multi-grid, '' | Having constructed the multi-grid, '' | ||
- | the Gaussians onto the grids. The keyword [[http:// | + | the Gaussians onto the grids. The keyword [[inp>FORCE_EVAL/ |
which product Gaussians are mapped onto which level of the | which product Gaussians are mapped onto which level of the | ||
multi-grid. | multi-grid. | ||
that the number of grid points covered by the Gaussian---no matter | that the number of grid points covered by the Gaussian---no matter | ||
- | how wide or narrow---are roughly the same. [[http:// | + | how wide or narrow---are roughly the same. [[inp>FORCE_EVAL/ |
planewave cutoff of a reference grid covered by a Gaussian with | planewave cutoff of a reference grid covered by a Gaussian with | ||
unit standard deviation (\(e^{\vert\vec{r}\vert^2}\)). A Gaussian | unit standard deviation (\(e^{\vert\vec{r}\vert^2}\)). A Gaussian | ||
Line 62: | Line 63: | ||
function will cover number of grid points greater than or equal to | function will cover number of grid points greater than or equal to | ||
the number of grid points \(e^{\lvert\vec{r}\rvert^2}\) will cover on | the number of grid points \(e^{\lvert\vec{r}\rvert^2}\) will cover on | ||
- | a reference grid defined by [[http:// | + | a reference grid defined by [[inp>FORCE_EVAL/ |
Therefore, the two most important keywords effecting the | Therefore, the two most important keywords effecting the | ||
- | integration grid and the accuracy of a calculation are [[http:// | + | integration grid and the accuracy of a calculation are [[inp>FORCE_EVAL/ |
- | [[http:// | + | [[inp>FORCE_EVAL/ |
and the calculation may become inaccurate; and if '' | and the calculation may become inaccurate; and if '' | ||
- | too low, then even if you have a high [[http:// | + | too low, then even if you have a high [[inp>FORCE_EVAL/ |
be mapped onto the coarsest level of the multi-grid, and thus the | be mapped onto the coarsest level of the multi-grid, and thus the | ||
effective integration grid for the calculation may still be too | effective integration grid for the calculation may still be too | ||
coarse. | coarse. | ||
- | ====== Example: Bulk Si with 8 atoms in a cubic cell ====== | ||
+ | |||
+ | ===== Example: Bulk Si with 8 atoms in a cubic cell ===== | ||
We demonstrate the process using an example based on Bulk Si with 8 | We demonstrate the process using an example based on Bulk Si with 8 | ||
atoms in a face centred cubic unit cell. | atoms in a face centred cubic unit cell. | ||
- | ===== Template Input File ===== | ||
- | To systematically find the best [[http:// | + | ==== Template Input File ==== |
+ | To systematically find the best [[inp>FORCE_EVAL/ | ||
which are sufficient for a given accuracy (say, \(10^{-6}\) Ry in total | which are sufficient for a given accuracy (say, \(10^{-6}\) Ry in total | ||
energy), we need to perform a series of single point energy | energy), we need to perform a series of single point energy | ||
Line 175: | Line 177: | ||
&END GLOBAL | &END GLOBAL | ||
</ | </ | ||
- | The keyword [[http:// | + | The keyword [[inp>GLOBAL#RUN_TYPE|RUN_TYPE]] is set to '' |
calculate the energies of the system, forces will not be | calculate the energies of the system, forces will not be | ||
calculated. Since we are only interested in the convergence of the | calculated. Since we are only interested in the convergence of the | ||
integration grid, just looking at the total energy usually suffices; | integration grid, just looking at the total energy usually suffices; | ||
and since we will be performing a series of computations, | and since we will be performing a series of computations, | ||
- | cheaper each run is the better. We set [[http:// | + | cheaper each run is the better. We set [[inp>GLOBAL#PRINT_LEVEL|PRINT_LEVEL]] to '' |
that the information about how many Gaussian functions are mapped | that the information about how many Gaussian functions are mapped | ||
onto which grid are printed. We need this information to analyse the | onto which grid are printed. We need this information to analyse the | ||
- | suitability of the chosen [[http:// | + | suitability of the chosen [[inp>FORCE_EVAL/ |
The most important part in the template input is: | The most important part in the template input is: | ||
Line 195: | Line 197: | ||
The symbols '' | The symbols '' | ||
the automated scripts will search for and replace with the relevant | the automated scripts will search for and replace with the relevant | ||
- | values. The default units for both [[http:// | + | values. The default units for both [[inp>FORCE_EVAL/ |
Ry. | Ry. | ||
Line 206: | Line 208: | ||
self-consistency, | self-consistency, | ||
consistent energies. | consistent energies. | ||
- | ===== Converging '' | ||
- | We start by setting [[http:// | + | |
- | systematically vary [[http:// | + | ==== Converging '' |
+ | We start by setting [[inp>FORCE_EVAL/ | ||
+ | systematically vary [[inp>FORCE_EVAL/ | ||
usually sufficient for most calculations, | usually sufficient for most calculations, | ||
- | be checked later when we vary [[http:// | + | be checked later when we vary [[inp>FORCE_EVAL/ |
- | ==== Generating Inputs ==== | ||
- | We want to perform a series of calculations, | + | === Generating Inputs === |
+ | We want to perform a series of calculations, | ||
from 50 Ry to 500 Ry in steps of 50 Ry. From experience, the | from 50 Ry to 500 Ry in steps of 50 Ry. From experience, the | ||
- | desired [[http:// | + | desired [[inp>FORCE_EVAL/ |
energy should be well within this range. To do this, we first need | energy should be well within this range. To do this, we first need | ||
to make sure the basis and pseudopotential parameter files | to make sure the basis and pseudopotential parameter files | ||
Line 263: | Line 266: | ||
each containing '' | each containing '' | ||
'' | '' | ||
- | that [[http:// | + | that [[inp>FORCE_EVAL/ |
values in the range between 50 Ry and 500 Ry. | values in the range between 50 Ry and 500 Ry. | ||
- | ==== Running Calculations ==== | ||
+ | |||
+ | === Running Calculations === | ||
With the input files generated and checked, the next step is to | With the input files generated and checked, the next step is to | ||
run them. A bash script such as '' | run them. A bash script such as '' | ||
Line 309: | Line 313: | ||
used for running all of the jobs. In the above example, the jobs | used for running all of the jobs. In the above example, the jobs | ||
are run on a 24 core local workstation, | are run on a 24 core local workstation, | ||
- | used for performing the [[http:// | + | used for performing the [[inp>FORCE_EVAL/ |
and 2 cores are used for each calculation. This means up to 8 jobs | and 2 cores are used for each calculation. This means up to 8 jobs | ||
will run in parallel, until the jobs are exhausted from the list | will run in parallel, until the jobs are exhausted from the list | ||
Line 328: | Line 332: | ||
runs the calculations in the background. This calculation only | runs the calculations in the background. This calculation only | ||
took a couple of minutes to complete on our local workstation. | took a couple of minutes to complete on our local workstation. | ||
- | ==== Analysing Results ==== | ||
+ | |||
+ | === Analysing Results === | ||
After all of the calculations have finished, all the information | After all of the calculations have finished, all the information | ||
about total energies and distribution of Gaussians on the | about total energies and distribution of Gaussians on the | ||
Line 390: | Line 395: | ||
total gridlevel count : 10496 | total gridlevel count : 10496 | ||
</ | </ | ||
- | which tells us that for [[http:// | + | which tells us that for [[inp>FORCE_EVAL/ |
Ry, 2720 product Gaussians has been distributed to grid level 1, | Ry, 2720 product Gaussians has been distributed to grid level 1, | ||
the finest level, 5000 for level 2, 2760 for level 3 and 16 for | the finest level, 5000 for level 2, 2760 for level 3 and 16 for | ||
Line 425: | Line 430: | ||
awk ' | awk ' | ||
if $grid_header ; then | if $grid_header ; then | ||
- | for ((igrid=1; igrid <= $ngrids; igrid++)) ; do | + | for ((igrid=1; igrid <= ngrids; igrid++)) ; do |
printf " | NG on grid %d" $igrid >> $plot_file | printf " | NG on grid %d" $igrid >> $plot_file | ||
done | done | ||
Line 432: | Line 437: | ||
fi | fi | ||
printf " | printf " | ||
- | for ((igrid=1; igrid <= $ngrids; igrid++)) ; do | + | for ((igrid=1; igrid <= ngrids; igrid++)) ; do |
grid=$(grep -e '^[ \t]*count for grid' $work_dir/ | grid=$(grep -e '^[ \t]*count for grid' $work_dir/ | ||
awk -v igrid=$igrid '(NR == igrid){print $5}') | awk -v igrid=$igrid '(NR == igrid){print $5}') | ||
Line 468: | Line 473: | ||
</ | </ | ||
- | The data shows that given the [[http:// | + | The data shows that given the [[inp>FORCE_EVAL/ |
- | [[http:// | + | [[inp>FORCE_EVAL/ |
- | less than \(10^{-8}\) Ha. The reader may also notice that as [[http:// | + | less than \(10^{-8}\) Ha. The reader may also notice that as [[inp>FORCE_EVAL/ |
increases, the number of Gaussians being assigned to the finest | increases, the number of Gaussians being assigned to the finest | ||
- | grids decreases. Therefore, simply increasing [[http:// | + | grids decreases. Therefore, simply increasing [[inp>FORCE_EVAL/ |
- | increasing [[http:// | + | increasing [[inp>FORCE_EVAL/ |
in energy, as more and more Gaussians get pushed to coarser grid | in energy, as more and more Gaussians get pushed to coarser grid | ||
- | levels, negating the increase in [[http:// | + | levels, negating the increase in [[inp>FORCE_EVAL/ |
In this example, the test results point to 250 Ry as a good choice | In this example, the test results point to 250 Ry as a good choice | ||
- | for [[http:// | + | for [[inp>FORCE_EVAL/ |
distribution of Gaussian functions on the grids are reasonable: it | distribution of Gaussian functions on the grids are reasonable: it | ||
is the lowest cutoff energy where the finest grid level is used, | is the lowest cutoff energy where the finest grid level is used, | ||
- | but at the same time with the majority of the Gaussians on the | + | but at the same time with the majority of the Gaussians on the coarser grids. |
- | coarser grids. | + | |
- | ===== Converging '' | + | |
- | In the next step, we vary the value of [[http:// | ||
- | [[http:// | ||
- | ==== Generating Inputs | + | ==== Converging '' |
+ | In the next step, we vary the value of [[inp> | ||
+ | [[inp> | ||
- | For the energy convergence test with varying [[http:// | + | |
- | follow a similar procedure as that for [[http:// | + | === Generating Inputs === |
+ | For the energy convergence test with varying [[inp>FORCE_EVAL/ | ||
+ | follow a similar procedure as that for [[inp>FORCE_EVAL/ | ||
template input file '' | template input file '' | ||
'' | '' | ||
Line 526: | Line 531: | ||
each containing files '' | each containing files '' | ||
'' | '' | ||
- | [[http:// | + | [[inp>FORCE_EVAL/ |
100 respectively. | 100 respectively. | ||
- | ==== Running Calculations ==== | ||
+ | |||
+ | === Running Calculations === | ||
Again to run the calculations, | Again to run the calculations, | ||
'' | '' | ||
Line 568: | Line 574: | ||
./ | ./ | ||
</ | </ | ||
- | ==== Analysing Results ==== | ||
+ | |||
+ | === Analysing Results === | ||
Total energies and distribution of Gaussian functions on the | Total energies and distribution of Gaussian functions on the | ||
multi-grid are obtained the same way from the results as that for | multi-grid are obtained the same way from the results as that for | ||
- | the [[http:// | + | the [[inp>FORCE_EVAL/ |
- | To put all of the results from the [[http:// | + | To put all of the results from the [[inp>FORCE_EVAL/ |
one place, we can make some minor modifications to | one place, we can make some minor modifications to | ||
'' | '' | ||
Line 601: | Line 608: | ||
awk ' | awk ' | ||
if $grid_header ; then | if $grid_header ; then | ||
- | for ((igrid=1; igrid <= $ngrids; igrid++)) ; do | + | for ((igrid=1; igrid <= ngrids; igrid++)) ; do |
printf " | NG on grid %d" $igrid >> $plot_file | printf " | NG on grid %d" $igrid >> $plot_file | ||
done | done | ||
Line 608: | Line 615: | ||
fi | fi | ||
printf " | printf " | ||
- | for ((igrid=1; igrid <= $ngrids; igrid++)) ; do | + | for ((igrid=1; igrid <= ngrids; igrid++)) ; do |
grid=$(grep -e '^[ \t]*count for grid' $work_dir/ | grid=$(grep -e '^[ \t]*count for grid' $work_dir/ | ||
awk -v igrid=$igrid '(NR == igrid){print $5}') | awk -v igrid=$igrid '(NR == igrid){print $5}') | ||
Line 642: | Line 649: | ||
</ | </ | ||
- | The results show that as one increases the value of [[http:// | + | The results show that as one increases the value of [[inp>FORCE_EVAL/ |
more Gaussians get mapped onto the finer grids. The error in total | more Gaussians get mapped onto the finer grids. The error in total | ||
- | energy reduces to less than \(10^{-8}\) Ha when [[http:// | + | energy reduces to less than \(10^{-8}\) Ha when [[inp>FORCE_EVAL/ |
greater or equal to 60 Ry. The results thus indicate that 60 Ry is | greater or equal to 60 Ry. The results thus indicate that 60 Ry is | ||
- | indeed a suitable choice for the value of [[http:// | + | indeed a suitable choice for the value of [[inp>FORCE_EVAL/ |
So finally we conclude that the setting | So finally we conclude that the setting |
howto/converging_cutoff.1391426459.txt.gz · Last modified: 2020/08/21 10:15 (external edit)