User Tools

Site Tools


howto:converging_cutoff

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
converging_cutoff [2014/01/25 23:31] – [Template Input File] 92.30.34.169howto:converging_cutoff [2020/08/21 10:15] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Introduction ======+====== How to Converge the CUTOFF and REL_CUTOFF ======
  
-'' QUICKSTEP '', as with nearly all ab initio Density Functional Theory+===== Introduction ===== 
 +''QUICKSTEP'', as with nearly all ab initio Density Functional Theory
 simulation packages, requires the use of a real-space (RS) simulation packages, requires the use of a real-space (RS)
 integration grid to represent certain functions, such as the integration grid to represent certain functions, such as the
-electron density and the product Gaussian functions. '' QUICKSTEP ''+electron density and the product Gaussian functions. ''QUICKSTEP''
 uses a multi-grid system for mapping the product Gaussians onto the uses a multi-grid system for mapping the product Gaussians onto the
 RS grid(s), so that wide and smooth Gaussian functions are mapped RS grid(s), so that wide and smooth Gaussian functions are mapped
Line 17: Line 18:
  
 This tutorial assumes the reader already has some knowledge of how This tutorial assumes the reader already has some knowledge of how
-to perform a simple energy calculation using '' QUICKSTEP '' (this can +to perform a simple energy calculation using ''QUICKSTEP'' (this can 
-be found in tutorial: Simple energy and force calculation using +be found in tutorial: [[static_calculation|Calculating Energy and Forces using Quickstep]]).
-'' QUICKSTEP '').+
  
 A completed example from an earlier calculation can be obtained from A completed example from an earlier calculation can be obtained from
-the file '' converging_grid.tgz '' that comes with this tutorial. The +the file {{:converging_grid.tgz|converging_grid.tgz}} that comes with this tutorial. The 
-calculations were carried out using CP2K SVN trunk revision 13180.+calculations were carried out using CP2K version 2.4.
  
-===== '' QUICKSTEP '' Multi-Grid ===== 
  
-Before we go through the input file, it is worth while to explain +==== ''QUICKSTEP'' Multi-Grid ==== 
-how the multi-grid is constructed in '' QUICKSTEP '', and how the+Before we go through the input file, it is worthwhile to explain 
 +how the multi-grid is constructed in ''QUICKSTEP'', and how the
 Gaussians are mapped onto the different grid levels. Hopefully this Gaussians are mapped onto the different grid levels. Hopefully this
-will offer the reader with a clear picture of how the key control+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://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html|'' MULTIGRID '']] subsection of [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT.html|'' DFT '']] subsection in +keywords in [[inp>FORCE_EVAL/DFT/MGRID|MULTIGRID]] subsection of [[inp>FORCE_EVAL/DFT|DFT]] subsection in 
-[[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL.html|'' FORCE_EVAL '']]. The number of levels for the multi-grid is defined by +[[inp>FORCE_EVAL|FORCE_EVAL]]. The number of levels for the multi-grid is defined by 
-[[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_NGRIDS|'' NGRIDS '']], and by default this is set to 4. The keyword [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']]+[[inp>FORCE_EVAL/DFT/MGRID#NGRIDS|NGRIDS]], and by default this is set to 4. The keyword [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]]
 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.  The higher the planewave cutoff, //finest// level of the multi-grid.  The higher the planewave cutoff,
Line 47: Line 47:
                             {\alpha^{(i-1)}}                             {\alpha^{(i-1)}}
 \end{equation*} \end{equation*}
-where \(\alpha\) has a default value of 3.0, and since '' CP2K '' +where \(\alpha\) has a default value of 3.0, and since ''CP2K'' 
-versions 3.0, can be configured by the keyword +versions 2.0, can be configured by the keyword 
-[[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#list_PROGRESSION_FACTOR|'' PROGRESSION_FACTOR '']]. Therefore, the higher the value of [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']]+[[inp>FORCE_EVAL/DFT/MGRID#PROGRESSION_FACTOR|PROGRESSION_FACTOR]]. Therefore, the higher the value of [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]]
 the finer grid for all multi-grid levels. the finer grid for all multi-grid levels.
  
-Having constructed the multi-grid, '' QUICKSTEP '' then needs to map +Having constructed the multi-grid, ''QUICKSTEP'' then needs to map 
-the Gaussians onto the grids. The keyword [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']] controls+the Gaussians onto the grids. The keyword [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]] controls
 which product Gaussians are mapped onto which level of the which product Gaussians are mapped onto which level of the
-multi-grid.  '' CP2K '' tries to map each Gaussian onto a grid such+multi-grid.  ''CP2K'' tries to map each Gaussian onto a grid such
 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://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']] defines the+how wide or narrow---are roughly the same. [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]] defines the
 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 63: 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://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']].+a reference grid defined by [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]].
  
 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://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']] and +integration grid and the accuracy of a calculation are [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]] and 
-[[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTFF '']]. If [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']] is too low, then all grids will be coarse +[[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]]. If [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]] is too low, then all grids will be coarse 
-and the calculation may become inaccurate; and if '' REL_CUTOFF '' is +and the calculation may become inaccurate; and if ''REL_CUTOFF'' is 
-too low, then even if you have a high [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']], all Gaussians will+too low, then even if you have a high [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]], all Gaussians will
 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://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']] and [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']] values +==== Template Input File ==== 
-which are sufficient for a given accuracy (say, \(10^-6\) Ry in total+To systematically find the best [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]] and [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]] values 
 +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
 calculations. It is much easier to use a set of scripts that can calculations. It is much easier to use a set of scripts that can
 automate this process. automate this process.
  
-To do this, we first write a template input file: '' template.inp '',+To do this, we first write a template input file: ''template.inp'',
 as shown below: as shown below:
  
Line 161: Line 162:
   &END PRINT   &END PRINT
 &END FORCE_EVAL &END FORCE_EVAL
- </code>+</code>
  
 We go through this input file quickly. Readers who have gone We go through this input file quickly. Readers who have gone
-through the tutorial on how to perform a simple static energy and +through the [[static_calculation|tutorial on how to perform a simple static energy and 
-force calculation using '' QUICKSTEP '' should have no trouble in+force calculation]] using ''QUICKSTEP'' should have no trouble in
 understanding most parts the above input. understanding most parts the above input.
  
Line 175: Line 176:
   PRINT_LEVEL MEDIUM   PRINT_LEVEL MEDIUM
 &END GLOBAL &END GLOBAL
- </code> +</code> 
-The keyword [[http://manual.cp2k.org/trunk/CP2K_INPUT/GLOBAL.html#desc_RUN_TYPE|'' RUN_TYPE '']] is set to '' ENERGY '', this tells '' CP2K '' to only+The keyword [[inp>GLOBAL#RUN_TYPE|RUN_TYPE]] is set to ''ENERGY'', this tells ''CP2K'' to only
 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, the and since we will be performing a series of computations, the
-cheaper each run is the better. We set [[http://manual.cp2k.org/trunk/CP2K_INPUT/GLOBAL.html#desc_PRINT_LEVEL|'' PRINT_LEVEL '']] to '' MEDIUM '', so+cheaper each run is the better. We set [[inp>GLOBAL#PRINT_LEVEL|PRINT_LEVEL]] to ''MEDIUM'', so
 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://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']] value.+suitability of the chosen [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]] value.
  
 The most important part in the template input is: The most important part in the template input is:
Line 193: Line 194:
   REL_CUTOFF LT_rel_cutoff   REL_CUTOFF LT_rel_cutoff
 &END MGRID &END MGRID
- </code> +</code> 
-The symbols '' LT_cutoff '' and '' LT_rel_cutoff '' are //markers//, which+The symbols ''LT_cutoff'' and ''LT_rel_cutoff'' are //markers//, which
 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://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']] and [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']] are+values. The default units for both [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]] and [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]] are
 Ry. Ry.
  
-In '' SCF '' subsection, we have set+In ''SCF'' subsection, we have set
 <code cp2k> <code cp2k>
 MAX_SCF 1 MAX_SCF 1
- </code>+</code>
 So that no self-consistent loops will be performed. This is okay for So that no self-consistent loops will be performed. This is okay for
 checking the integration grid, because irrespective of checking the integration grid, because irrespective of
 self-consistency, grid settings with fine enough meshes should give self-consistency, grid settings with fine enough meshes should give
 consistent energies. consistent energies.
-===== Converging '' CUTOFF '' ===== 
  
-We start by setting [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']] to a relatively high number, and + 
-systematically vary [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']]. Setting [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']] to 60 Ry is+==== Converging ''CUTOFF'' ==== 
 +We start by setting [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]] to a relatively high number, and 
 +systematically vary [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]]. Setting [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]] to 60 Ry is
 usually sufficient for most calculations, and in any case this will usually sufficient for most calculations, and in any case this will
-be checked later when we vary [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']].+be checked later when we vary [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]].
  
-==== Generating Inputs ==== 
  
-We want to perform a series of calculations, with [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']] ranging+=== Generating Inputs === 
 +We want to perform a series of calculations, with [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]] ranging
 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://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']] for an accuracy of \(10^{-6}\) Ry for the total+desired [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]] for an accuracy of \(10^{-6}\) Ry for the total
 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
-'' BASIS_SET '' and '' GTH_POTENTIALS '' are in the working directory +''BASIS_SET'' and ''GTH_POTENTIALS'' are in the working directory 
-together with '' template.inp '', then one can write a bash script, +together with ''template.inp'', then one can write a bash script, 
-such as the file '' cutoff_inputs.sh '' shown below: +such as the file ''cutoff_inputs.sh'' shown below: 
-<code sh>+<code bash>
 #!/bin/bash #!/bin/bash
  
Line 249: Line 251:
     cp $potential_file $work_dir     cp $potential_file $work_dir
 done done
- </code>+</code>
  
 The user should remember to set the permission of the new script The user should remember to set the permission of the new script
Line 255: Line 257:
 <code> <code>
 chmod u+x ./cutoff_inputs.sh chmod u+x ./cutoff_inputs.sh
- </code>+</code>
  
 Entering the command line Entering the command line
 <code> <code>
 ./cutoff_inputs.sh ./cutoff_inputs.sh
- </code> +</code> 
-generates directories '' cutoff_50Ry '', '' cutoff_100Ry '', &#x2026;+generates directories ''cutoff_50Ry'', ''cutoff_100Ry'', ...
-each containing '' BASIS_SET '', '' GTH_POTENTIALS '' and an input file +each containing ''BASIS_SET'', ''GTH_POTENTIALS'' and an input file 
-'' Si_bulk8.inp '', which is exactly the same as '' template.inp '', except +''Si_bulk8.inp'', which is exactly the same as ''template.inp'', except 
-that [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']] is set to 60, and [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']] is set to the respective+that [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]] is set to 60, and [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]] is set to the respective
 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 '' cutoff_run.sh '' shown below does+run them. A bash script such as ''cutoff_run.sh'' shown below does
 the job: the job:
  
-<code sh>+<code bash>
 #!/bin/bash #!/bin/bash
  
Line 300: Line 303:
 done done
 wait wait
- </code>+</code>
  
 The above script is slightly complex, because it allows several The above script is slightly complex, because it allows several
-jobs to run in parallel. Setting the variable '' cp2k_bin '' defines +jobs to run in parallel. Setting the variable ''cp2k_bin'' defines 
-the path to the '' CP2K '' binary. In this case, the parallel version +the path to the ''CP2K'' binary. In this case, the parallel version 
-'' cp2k.popt '' is found in the system '' PATH ''. '' no_proc_per_calc '' sets+''cp2k.popt'' is found in the system ''PATH''. ''no_proc_per_calc'' sets
 the number of MPI processes to be used in parallel for each the number of MPI processes to be used in parallel for each
-job. '' no_proc_to_use '' sets the total number of processors to be+job. ''no_proc_to_use'' sets the total number of processors to be
 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, a total of 16 cores are are run on a 24 core local workstation, a total of 16 cores are
-used for performing the [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']] convergence test calculations,+used for performing the [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]] convergence test calculations,
 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
-given in '' cutoffs ''.+given in ''cutoffs''.
  
 The reader can write their own script where they see fit, and if The reader can write their own script where they see fit, and if
Line 322: Line 325:
 <code> <code>
 chmod u+x ./cutoff_run.sh chmod u+x ./cutoff_run.sh
- </code>+</code>
 followed by followed by
 <code> <code>
 ./cutoff_run.sh & ./cutoff_run.sh &
- </code>+</code>
 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
-multi-grid are written in the '' Si_bulk8.out '' files in each job+multi-grid are written in the ''Si_bulk8.out'' files in each job
 directories. directories.
  
 The total energy can be found in the section of the output shown The total energy can be found in the section of the output shown
-below (in this example from '' cutoff_100Ry/Si_bulk8.out ''):+below (in this example from ''cutoff_100Ry/Si_bulk8.out''):
  
 <code> <code>
Line 371: Line 375:
  
  Total energy:                                               -32.38045576307407  Total energy:                                               -32.38045576307407
- </code>+</code>
  
 Regexp search Regexp search
 <code> <code>
 "^[ \t]*Total energy:" "^[ \t]*Total energy:"
- </code>+</code>
 will find the relevant line. will find the relevant line.
  
Line 390: Line 394:
 count for grid        4:             16          cutoff [a.u.]            1.85 count for grid        4:             16          cutoff [a.u.]            1.85
 total gridlevel count  :          10496 total gridlevel count  :          10496
- </code> +</code> 
-which tells us that for [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']] of 100 Ry and [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']] of 60+which tells us that for [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]] of 100 Ry and [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]] of 60
 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
 level 4, the coarsest. The planewave cutoff for each multi-grid level 4, the coarsest. The planewave cutoff for each multi-grid
-level can be read from the right-hand-side columns. Here '' [a.u.] ''+level can be read from the right-hand-side columns. Here ''[a.u.]''
 means the Hartree energy unit, 1 Ha = 2 Ry. means the Hartree energy unit, 1 Ha = 2 Ry.
  
 It is much easier if we can gather all the information together It is much easier if we can gather all the information together
 into one file, which allows us to plot the results.  This can be into one file, which allows us to plot the results.  This can be
-done, again, by using a simple script. '' cutoff_analyse.sh '' shown+done, again, by using a simple script. ''cutoff_analyse.sh'' shown
 below is such an example: below is such an example:
  
-<code sh>+<code bash>
 #!/bin/bash #!/bin/bash
  
Line 426: Line 430:
              awk '{print $6}')              awk '{print $6}')
     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 433: Line 437:
     fi     fi
     printf "%10.2f  %15.10f" $ii $total_energy >> $plot_file     printf "%10.2f  %15.10f" $ii $total_energy >> $plot_file
-    for ((igrid=1; igrid <= $ngrids; igrid++)) ; do+    for ((igrid=1; igrid <= ngrids; igrid++)) ; do
         grid=$(grep -e '^[ \t]*count for grid' $work_dir/$output_file | \         grid=$(grep -e '^[ \t]*count for grid' $work_dir/$output_file | \
                awk -v igrid=$igrid '(NR == igrid){print $5}')                awk -v igrid=$igrid '(NR == igrid){print $5}')
Line 440: Line 444:
     printf "\n" >> $plot_file     printf "\n" >> $plot_file
 done done
- </code>+</code>
  
 Type Type
 <code> <code>
 chmod u+x ./cutoff_analyse.sh chmod u+x ./cutoff_analyse.sh
- </code>+</code>
 and then run it using and then run it using
 <code> <code>
 ./cutoff_analyse.sh ./cutoff_analyse.sh
- </code> +</code> 
-will produce a file named '' cutoff_data.ssv '', which looks like:+will produce a file named ''cutoff_data.ssv'', which looks like:
 <code> <code>
 # Grid cutoff vs total energy # Grid cutoff vs total energy
Line 467: Line 471:
     450.00   -32.3804554851          2032    3016    5448     450.00   -32.3804554851          2032    3016    5448
     500.00   -32.3804554850          2032    3016    5448     500.00   -32.3804554850          2032    3016    5448
- </code>+</code>
  
-The data shows that given the [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']] value of 60 Ry, setting +The data shows that given the [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]] value of 60 Ry, setting 
-[[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']] to 250 Ry and above would give an error in total energy +[[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]] to 250 Ry and above would give an error in total energy 
-less than \(10^{-8}\) Ha. The reader may also notice that as [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']]+less than \(10^{-8}\) Ha. The reader may also notice that as [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]]
 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://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']] without +grids decreases. Therefore, simply increasing [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]] without 
-increasing [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']] may eventually lead to a slow convergence+increasing [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]] may eventually lead to a slow convergence
 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://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']].+levels, negating the increase in [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]].
  
 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://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']], as the total energy is converged, and the+for [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]], as the total energy is converged, and the
 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 '' REL_CUTOFF '' =====+
  
-In the next step, we vary the value of [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']] while keeping 
-[[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']] fixed at 250 Ry. 
  
-==== Generating Inputs ====+==== Converging ''REL_CUTOFF'' ==== 
 +In the next step, we vary the value of [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]] while keeping 
 +[[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]] fixed at 250 Ry.
  
-For the energy convergence test with varying [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']], we 
-follow a similar procedure as that for [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']]. Using the same 
-template input file '' template.inp '', we can write a script called 
-'' rel_cutoff_inputs.sh '': 
  
-<code sh>+=== Generating Inputs === 
 +For the energy convergence test with varying [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]], we 
 +follow a similar procedure as that for [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]]. Using the same 
 +template input file ''template.inp'', we can write a script called 
 +''rel_cutoff_inputs.sh'': 
 + 
 +<code bash>
 #!/bin/bash #!/bin/bash
  
Line 521: Line 525:
     cp $potential_file $work_dir     cp $potential_file $work_dir
 done done
- </code>+</code>
  
 Setting the permission for the script to "executable", and running Setting the permission for the script to "executable", and running
-it produces directories '' rel_cutoff_10Ry '', '' rel_cutoff_20Ry '', &#x2026;+it produces directories ''rel_cutoff_10Ry'', ''rel_cutoff_20Ry'', ...
-each containing files '' BASIS_SET '', '' GTH_POTENTIALS '' and an input +each containing files ''BASIS_SET'', ''GTH_POTENTIALS'' and an input 
-'' Si_bulk8.inp '', which is identical to '' template.inp '', except that +''Si_bulk8.inp'', which is identical to ''template.inp'', except that 
-[[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']] is set to 250, and [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']] is set to 10, 20, &#x2026;,+[[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]] is set to 250, and [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]] is set to 10, 20, ...,
 100 respectively. 100 respectively.
-==== Running Calculations ==== 
  
 +
 +=== Running Calculations ===
 Again to run the calculations, we can use the script Again to run the calculations, we can use the script
-'' rel_cutoff_run.sh '', as shown below:+''rel_cutoff_run.sh'', as shown below:
  
-<code sh>+<code bash>
 #!/bin/bash #!/bin/bash
  
Line 562: Line 567:
 done done
 wait wait
- </code>+</code>
  
 In the above example, again, we have used 16 cores in total, and In the above example, again, we have used 16 cores in total, and
Line 568: Line 573:
 <code> <code>
 ./rel_cutoff_run.sh & ./rel_cutoff_run.sh &
- </code> +</code> 
-==== 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://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_CUTOFF|'' CUTOFF '']] calculations.+the [[inp>FORCE_EVAL/DFT/MGRID#CUTOFF|CUTOFF]] calculations.
  
-To put all of the results from the [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']] calculations in+To put all of the results from the [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]] calculations in
 one place, we can make some minor modifications to one place, we can make some minor modifications to
-'' cutoff_analyse.sh '' and save it as '' rel_cutoff_analyse.sh '':+''cutoff_analyse.sh'' and save it as ''rel_cutoff_analyse.sh'':
  
-<code sh>+<code bash>
  #!/bin/bash  #!/bin/bash
  
Line 602: Line 608:
              awk '{print $6}')              awk '{print $6}')
     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 609: Line 615:
     fi     fi
     printf "%10.2f  %15.10f" $ii $total_energy >> $plot_file     printf "%10.2f  %15.10f" $ii $total_energy >> $plot_file
-    for ((igrid=1; igrid <= $ngrids; igrid++)) ; do+    for ((igrid=1; igrid <= ngrids; igrid++)) ; do
         grid=$(grep -e '^[ \t]*count for grid' $work_dir/$output_file | \         grid=$(grep -e '^[ \t]*count for grid' $work_dir/$output_file | \
                awk -v igrid=$igrid '(NR == igrid){print $5}')                awk -v igrid=$igrid '(NR == igrid){print $5}')
Line 616: Line 622:
     printf "\n" >> $plot_file     printf "\n" >> $plot_file
 done done
- </code>+</code>
  
 Making the script executable, and running the script using Making the script executable, and running the script using
 <code> <code>
 ./rel_cutoff_analyse.sh ./rel_cutoff_analyse.sh
- </code>+</code>
 produces the following results written in file produces the following results written in file
-'' rel_cutoff_data.ssv '':+''rel_cutoff_data.ssv'':
  
 <code> <code>
Line 641: Line 647:
      90.00   -32.3804554848    2032    3016    5432      16      90.00   -32.3804554848    2032    3016    5432      16
     100.00   -32.3804554848    2032    3016    5432      16     100.00   -32.3804554848    2032    3016    5432      16
- </code>+</code>
  
-The results show that as one increases the value of [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']],+The results show that as one increases the value of [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]],
 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://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']] is+energy reduces to less than \(10^{-8}\) Ha when [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]] is
 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://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/DFT/MGRID.html#desc_REL_CUTOFF|'' REL_CUTOFF '']].+indeed a suitable choice for the value of [[inp>FORCE_EVAL/DFT/MGRID#REL_CUTOFF|REL_CUTOFF]].
  
 So finally we conclude that the setting So finally we conclude that the setting
Line 655: Line 661:
   REL_CUTOFF 60    REL_CUTOFF 60 
 &END MGRID &END MGRID
- </code>+</code>
 is sufficient for a calculation with the required accuracy. is sufficient for a calculation with the required accuracy.
  
howto/converging_cutoff.1390692665.txt.gz · Last modified: 2020/08/21 10:15 (external edit)