howto:converging_cutoff
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| howto:converging_cutoff [2017/06/20 14:29] – 130.237.185.202 | howto:converging_cutoff [2024/05/29 15:46] (current) – oschuett | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== How to Converge the CUTOFF and REL_CUTOFF ====== | + | This page has been moved to: https://manual.cp2k.org/trunk/methods/dft/cutoff.html |
| - | + | ||
| - | ===== Introduction ===== | + | |
| - | '' | + | |
| - | simulation packages, requires the use of a real-space (RS) | + | |
| - | integration grid to represent certain functions, such as the | + | |
| - | electron density and the product Gaussian functions. '' | + | |
| - | uses a multi-grid system for mapping the product Gaussians onto the | + | |
| - | RS grid(s), so that wide and smooth Gaussian functions are mapped | + | |
| - | onto a coarser grid than narrow and sharp Gaussians. The electron | + | |
| - | density is always mapped onto the finest grid. | + | |
| - | + | ||
| - | Choosing a fine enough integration grid for a calculation is crucial | + | |
| - | in obtaining meaningful and accurate results. In this tutorial, we | + | |
| - | will show the reader how to systematically find the correct settings | + | |
| - | for obtaining a sufficiently fine integration grid for his/her | + | |
| - | calculation. | + | |
| - | + | ||
| - | This tutorial assumes the reader already has some knowledge of how | + | |
| - | to perform a simple energy calculation using '' | + | |
| - | be found in tutorial: [[static_calculation|Calculating Energy and Forces using Quickstep]]). | + | |
| - | + | ||
| - | A completed example from an earlier calculation can be obtained from | + | |
| - | the file {{: | + | |
| - | calculations were carried out using CP2K version 2.4. | + | |
| - | + | ||
| - | + | ||
| - | ==== '' | + | |
| - | Before we go through the input file, it is worthwhile to explain | + | |
| - | how the multi-grid is constructed in '' | + | |
| - | Gaussians are mapped onto the different grid levels. Hopefully this | + | |
| - | will offer the reader a clear picture of how the key control | + | |
| - | parameters affect the grids, and thus the overall accuracy of a | + | |
| - | calculation. | + | |
| - | + | ||
| - | All multi-grid related settings for a calculation is controlled via | + | |
| - | keywords in [[inp> | + | |
| - | [[inp> | + | |
| - | [[inp> | + | |
| - | defines the planewave cutoff (default unit is in Ry) for the | + | |
| - | //finest// level of the multi-grid. | + | |
| - | the finer the grid. The corresponding planewave cutoffs for the | + | |
| - | subsequent grid levels (from finer to coarser) are defined by the | + | |
| - | formula: | + | |
| - | \begin{equation*} | + | |
| - | E^i_{\mathrm{cut}} = \frac{E_{\mathrm{cut}}^1} | + | |
| - | {\alpha^{(i-1)}} | + | |
| - | \end{equation*} | + | |
| - | where \(\alpha\) has a default value of 3.0, and since '' | + | |
| - | versions 2.0, can be configured by the keyword | + | |
| - | [[inp> | + | |
| - | the finer grid for all multi-grid levels. | + | |
| - | + | ||
| - | Having constructed the multi-grid, '' | + | |
| - | the Gaussians onto the grids. The keyword [[inp> | + | |
| - | which product Gaussians are mapped onto which level of the | + | |
| - | multi-grid. | + | |
| - | that the number of grid points covered by the Gaussian---no matter | + | |
| - | how wide or narrow---are roughly the same. [[inp> | + | |
| - | planewave cutoff of a reference grid covered by a Gaussian with | + | |
| - | unit standard deviation (\(e^{\vert\vec{r}\vert^2}\)). A Gaussian | + | |
| - | is mapped onto the coarsest level of the multi-grid, on which the | + | |
| - | 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 | + | |
| - | a reference grid defined by [[inp> | + | |
| - | + | ||
| - | Therefore, the two most important keywords effecting the | + | |
| - | integration grid and the accuracy of a calculation are [[inp> | + | |
| - | [[inp> | + | |
| - | and the calculation may become inaccurate; and if '' | + | |
| - | too low, then even if you have a high [[inp> | + | |
| - | be mapped onto the coarsest level of the multi-grid, and thus the | + | |
| - | effective integration grid for the calculation may still be too | + | |
| - | coarse. | + | |
| - | + | ||
| - | + | ||
| - | ===== Example: Bulk Si with 8 atoms in a cubic cell ===== | + | |
| - | We demonstrate the process using an example based on Bulk Si with 8 | + | |
| - | atoms in a face centred cubic unit cell. | + | |
| - | + | ||
| - | + | ||
| - | ==== Template Input File ==== | + | |
| - | To systematically find the best [[inp> | + | |
| - | which are sufficient for a given accuracy (say, \(10^{-6}\) Ry in total | + | |
| - | energy), we need to perform a series of single point energy | + | |
| - | calculations. It is much easier to use a set of scripts that can | + | |
| - | automate this process. | + | |
| - | + | ||
| - | To do this, we first write a template input file: '' | + | |
| - | as shown below: | + | |
| - | + | ||
| - | <code cp2k> | + | |
| - | & | + | |
| - | PROJECT Si_bulk8 | + | |
| - | RUN_TYPE ENERGY | + | |
| - | PRINT_LEVEL MEDIUM | + | |
| - | &END GLOBAL | + | |
| - | & | + | |
| - | METHOD Quickstep | + | |
| - | &DFT | + | |
| - | BASIS_SET_FILE_NAME | + | |
| - | POTENTIAL_FILE_NAME | + | |
| - | & | + | |
| - | NGRIDS 4 | + | |
| - | CUTOFF LT_cutoff | + | |
| - | REL_CUTOFF LT_rel_cutoff | + | |
| - | &END MGRID | + | |
| - | &QS | + | |
| - | EPS_DEFAULT 1.0E-10 | + | |
| - | &END QS | + | |
| - | &SCF | + | |
| - | SCF_GUESS ATOMIC | + | |
| - | EPS_SCF 1.0E-6 | + | |
| - | MAX_SCF 1 | + | |
| - | ADDED_MOS 10 | + | |
| - | CHOLESKY INVERSE | + | |
| - | &SMEAR ON | + | |
| - | METHOD FERMI_DIRAC | + | |
| - | ELECTRONIC_TEMPERATURE [K] 300 | + | |
| - | &END SMEAR | + | |
| - | & | + | |
| - | ALGORITHM STANDARD | + | |
| - | &END DIAGONALIZATION | + | |
| - | & | + | |
| - | METHOD BROYDEN_MIXING | + | |
| - | ALPHA 0.4 | + | |
| - | BETA 0.5 | + | |
| - | NBROYDEN 8 | + | |
| - | &END MIXING | + | |
| - | &END SCF | + | |
| - | &XC | + | |
| - | & | + | |
| - | &END XC_FUNCTIONAL | + | |
| - | &END XC | + | |
| - | &END DFT | + | |
| - | & | + | |
| - | &KIND Si | + | |
| - | ELEMENT | + | |
| - | BASIS_SET SZV-GTH-PADE | + | |
| - | POTENTIAL GTH-PADE-q4 | + | |
| - | &END KIND | + | |
| - | &CELL | + | |
| - | SYMMETRY CUBIC | + | |
| - | A | + | |
| - | B | + | |
| - | C | + | |
| - | &END CELL | + | |
| - | & | + | |
| - | Si 0.000000000 | + | |
| - | Si 0.000000000 | + | |
| - | Si 2.715348700 | + | |
| - | Si 2.715348700 | + | |
| - | Si 4.073023100 | + | |
| - | Si 1.357674400 | + | |
| - | Si 1.357674400 | + | |
| - | Si 4.073023100 | + | |
| - | &END COORD | + | |
| - | &END SUBSYS | + | |
| - | & | + | |
| - | & | + | |
| - | &END TOTAL_NUMBERS | + | |
| - | &END PRINT | + | |
| - | &END FORCE_EVAL | + | |
| - | </ | + | |
| - | + | ||
| - | We go through this input file quickly. Readers who have gone | + | |
| - | through the [[static_calculation|tutorial on how to perform a simple static energy and | + | |
| - | force calculation]] using '' | + | |
| - | understanding most parts the above input. | + | |
| - | + | ||
| - | Some noticeable settings are: | + | |
| - | <code cp2k> | + | |
| - | & | + | |
| - | PROJECT Si_bulk8 | + | |
| - | RUN_TYPE ENERGY | + | |
| - | PRINT_LEVEL MEDIUM | + | |
| - | &END GLOBAL | + | |
| - | </ | + | |
| - | The keyword [[inp> | + | |
| - | calculate the energies of the system, forces will not be | + | |
| - | calculated. Since we are only interested in the convergence of the | + | |
| - | integration grid, just looking at the total energy usually suffices; | + | |
| - | and since we will be performing a series of computations, | + | |
| - | cheaper each run is the better. We set [[inp> | + | |
| - | that the information about how many Gaussian functions are mapped | + | |
| - | onto which grid are printed. We need this information to analyse the | + | |
| - | suitability of the chosen [[inp> | + | |
| - | + | ||
| - | The most important part in the template input is: | + | |
| - | <code cp2k> | + | |
| - | & | + | |
| - | NGRIDS 4 | + | |
| - | CUTOFF LT_cutoff | + | |
| - | REL_CUTOFF LT_rel_cutoff | + | |
| - | &END MGRID | + | |
| - | </ | + | |
| - | The symbols '' | + | |
| - | the automated scripts will search for and replace with the relevant | + | |
| - | values. The default units for both [[inp> | + | |
| - | Ry. | + | |
| - | + | ||
| - | In '' | + | |
| - | <code cp2k> | + | |
| - | MAX_SCF 1 | + | |
| - | </ | + | |
| - | So that no self-consistent loops will be performed. This is okay for | + | |
| - | checking the integration grid, because irrespective of | + | |
| - | self-consistency, | + | |
| - | consistent energies. | + | |
| - | + | ||
| - | + | ||
| - | ==== Converging '' | + | |
| - | We start by setting [[inp> | + | |
| - | systematically vary [[inp> | + | |
| - | usually sufficient for most calculations, | + | |
| - | be checked later when we vary [[inp> | + | |
| - | + | ||
| - | + | ||
| - | === Generating Inputs === | + | |
| - | We want to perform a series of calculations, | + | |
| - | from 50 Ry to 500 Ry in steps of 50 Ry. From experience, the | + | |
| - | desired [[inp> | + | |
| - | energy should be well within this range. To do this, we first need | + | |
| - | to make sure the basis and pseudopotential parameter files | + | |
| - | '' | + | |
| - | together with '' | + | |
| - | such as the file '' | + | |
| - | <code bash> | + | |
| - | # | + | |
| - | + | ||
| - | cutoffs=" | + | |
| - | + | ||
| - | basis_file=BASIS_SET | + | |
| - | potential_file=GTH_POTENTIALS | + | |
| - | template_file=template.inp | + | |
| - | input_file=Si_bulk8.inp | + | |
| - | + | ||
| - | rel_cutoff=60 | + | |
| - | + | ||
| - | for ii in $cutoffs ; do | + | |
| - | work_dir=cutoff_${ii}Ry | + | |
| - | if [ ! -d $work_dir ] ; then | + | |
| - | mkdir $work_dir | + | |
| - | else | + | |
| - | rm -r $work_dir/ | + | |
| - | fi | + | |
| - | sed -e " | + | |
| - | -e " | + | |
| - | $template_file > $work_dir/ | + | |
| - | cp $basis_file $work_dir | + | |
| - | cp $potential_file $work_dir | + | |
| - | done | + | |
| - | </ | + | |
| - | + | ||
| - | The user should remember to set the permission of the new script | + | |
| - | file to be executable: | + | |
| - | < | + | |
| - | chmod u+x ./ | + | |
| - | </ | + | |
| - | + | ||
| - | Entering the command line | + | |
| - | < | + | |
| - | ./ | + | |
| - | </ | + | |
| - | generates directories '' | + | |
| - | each containing '' | + | |
| - | '' | + | |
| - | that [[inp> | + | |
| - | values in the range between 50 Ry and 500 Ry. | + | |
| - | + | ||
| - | + | ||
| - | === Running Calculations === | + | |
| - | With the input files generated and checked, the next step is to | + | |
| - | run them. A bash script such as '' | + | |
| - | the job: | + | |
| - | + | ||
| - | <code bash> | + | |
| - | # | + | |
| - | + | ||
| - | cutoffs=" | + | |
| - | + | ||
| - | cp2k_bin=cp2k.popt | + | |
| - | input_file=Si_bulk8.inp | + | |
| - | output_file=Si_bulk8.out | + | |
| - | no_proc_per_calc=2 | + | |
| - | no_proc_to_use=16 | + | |
| - | + | ||
| - | counter=1 | + | |
| - | max_parallel_calcs=$(expr $no_proc_to_use / $no_proc_per_calc) | + | |
| - | for ii in $cutoffs ; do | + | |
| - | work_dir=cutoff_${ii}Ry | + | |
| - | cd $work_dir | + | |
| - | if [ -f $output_file ] ; then | + | |
| - | rm $output_file | + | |
| - | fi | + | |
| - | mpirun -np $no_proc_per_calc $cp2k_bin -o $output_file $input_file & | + | |
| - | cd .. | + | |
| - | mod_test=$(echo " | + | |
| - | if [ $mod_test -eq 0 ] ; then | + | |
| - | wait | + | |
| - | fi | + | |
| - | counter=$(expr $counter + 1) | + | |
| - | done | + | |
| - | wait | + | |
| - | </ | + | |
| - | + | ||
| - | The above script is slightly complex, because it allows several | + | |
| - | jobs to run in parallel. Setting the variable '' | + | |
| - | the path to the '' | + | |
| - | '' | + | |
| - | the number of MPI processes to be used in parallel for each | + | |
| - | job. '' | + | |
| - | used for running all of the jobs. In the above example, the jobs | + | |
| - | are run on a 24 core local workstation, | + | |
| - | used for performing the [[inp> | + | |
| - | 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 | + | |
| - | given in '' | + | |
| - | + | ||
| - | The reader can write their own script where they see fit, and if | + | |
| - | he/she just want the jobs to run in serial, then there is no need | + | |
| - | for this complexity. | + | |
| - | + | ||
| - | Again | + | |
| - | < | + | |
| - | chmod u+x ./ | + | |
| - | </ | + | |
| - | followed by | + | |
| - | < | + | |
| - | ./ | + | |
| - | </ | + | |
| - | runs the calculations in the background. This calculation only | + | |
| - | took a couple of minutes to complete on our local workstation. | + | |
| - | + | ||
| - | + | ||
| - | === Analysing Results === | + | |
| - | After all of the calculations have finished, all the information | + | |
| - | about total energies and distribution of Gaussians on the | + | |
| - | multi-grid are written in the '' | + | |
| - | directories. | + | |
| - | + | ||
| - | The total energy can be found in the section of the output shown | + | |
| - | below (in this example from '' | + | |
| - | + | ||
| - | < | + | |
| - | SCF WAVEFUNCTION OPTIMIZATION | + | |
| - | + | ||
| - | | + | |
| - | | + | |
| - | + | ||
| - | | + | |
| - | | + | |
| - | Core density on regular grids: | + | |
| - | Total charge density on r-space grids: | + | |
| - | Total charge density g-space grids: | + | |
| - | + | ||
| - | 1 NoMix/Diag. 0.40E+00 | + | |
| - | 1 NoMix/Diag. 0.40E+00 | + | |
| - | + | ||
| - | *** SCF run NOT converged *** | + | |
| - | + | ||
| - | + | ||
| - | | + | |
| - | Core density on regular grids: | + | |
| - | Total charge density on r-space grids: | + | |
| - | Total charge density g-space grids: | + | |
| - | + | ||
| - | | + | |
| - | Self energy of the core charge distribution: | + | |
| - | Core Hamiltonian energy: | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | Fermi energy: | + | |
| - | + | ||
| - | Total energy: | + | |
| - | </ | + | |
| - | + | ||
| - | Regexp search | + | |
| - | < | + | |
| - | "^[ \t]*Total energy:" | + | |
| - | </ | + | |
| - | will find the relevant line. | + | |
| - | + | ||
| - | Similarly, information on distribution of Gaussians on the | + | |
| - | multi-grid can be found in the section: | + | |
| - | < | + | |
| - | ------------------------------------------------------------------------------- | + | |
| - | ---- | + | |
| - | ------------------------------------------------------------------------------- | + | |
| - | count for grid 1: | + | |
| - | count for grid 2: | + | |
| - | count for grid 3: | + | |
| - | count for grid 4: | + | |
| - | total gridlevel count : 10496 | + | |
| - | </ | + | |
| - | which tells us that for [[inp> | + | |
| - | Ry, 2720 product Gaussians | + | |
| - | 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 can be read from the right-hand-side columns. Here '' | + | |
| - | means the Hartree energy unit, 1 Ha = 2 Ry. | + | |
| - | + | ||
| - | It is much easier if we can gather all the information together | + | |
| - | into one file, which allows us to plot the results. | + | |
| - | done, again, by using a simple script. '' | + | |
| - | below is such an example: | + | |
| - | + | ||
| - | <code bash> | + | |
| - | # | + | |
| - | + | ||
| - | cutoffs=" | + | |
| - | + | ||
| - | input_file=Si_bulk8.inp | + | |
| - | output_file=Si_bulk8.out | + | |
| - | plot_file=cutoff_data.ssv | + | |
| - | + | ||
| - | rel_cutoff=60 | + | |
| - | + | ||
| - | echo "# Grid cutoff vs total energy" | + | |
| - | echo "# Date: $(date)" | + | |
| - | echo "# PWD: $PWD" >> $plot_file | + | |
| - | echo "# REL_CUTOFF = $rel_cutoff" | + | |
| - | echo -n "# Cutoff (Ry) | Total Energy (Ha)" >> $plot_file | + | |
| - | grid_header=true | + | |
| - | for ii in $cutoffs ; do | + | |
| - | work_dir=cutoff_${ii}Ry | + | |
| - | total_energy=$(grep -e '^[ \t]*Total energy' | + | |
| - | ngrids=$(grep -e '^[ \t]*QS| Number of grid levels:' | + | |
| - | awk ' | + | |
| - | if $grid_header ; then | + | |
| - | for ((igrid=1; igrid <= ngrids; igrid++)) ; do | + | |
| - | printf " | NG on grid %d" $igrid >> $plot_file | + | |
| - | done | + | |
| - | printf " | + | |
| - | grid_header=false | + | |
| - | fi | + | |
| - | printf "%10.2f %15.10f" | + | |
| - | for ((igrid=1; igrid <= ngrids; igrid++)) ; do | + | |
| - | grid=$(grep -e '^[ \t]*count for grid' $work_dir/ | + | |
| - | awk -v igrid=$igrid '(NR == igrid){print $5}' | + | |
| - | printf " | + | |
| - | done | + | |
| - | printf " | + | |
| - | done | + | |
| - | </ | + | |
| - | + | ||
| - | Type | + | |
| - | < | + | |
| - | chmod u+x ./ | + | |
| - | </ | + | |
| - | and then run it using | + | |
| - | < | + | |
| - | ./ | + | |
| - | </ | + | |
| - | will produce a file named '' | + | |
| - | < | + | |
| - | # Grid cutoff vs total energy | + | |
| - | # Date: Mon Jan 20 21:20:34 GMT 2014 | + | |
| - | # PWD: / | + | |
| - | # REL_CUTOFF = 60 | + | |
| - | # Cutoff (Ry) | Total Energy (Ha) | NG on grid 1 | NG on grid 2 | NG on grid 3 | NG on grid 4 | + | |
| - | | + | |
| - | 100.00 | + | |
| - | 150.00 | + | |
| - | 200.00 | + | |
| - | 250.00 | + | |
| - | 300.00 | + | |
| - | 350.00 | + | |
| - | 400.00 | + | |
| - | 450.00 | + | |
| - | 500.00 | + | |
| - | </ | + | |
| - | + | ||
| - | The data shows that given the [[inp> | + | |
| - | [[inp> | + | |
| - | less than \(10^{-8}\) Ha. The reader may also notice that as [[inp> | + | |
| - | increases, the number of Gaussians being assigned to the finest | + | |
| - | grids decreases. Therefore, simply increasing [[inp> | + | |
| - | increasing [[inp> | + | |
| - | in energy, as more and more Gaussians get pushed to coarser grid | + | |
| - | levels, negating the increase in [[inp> | + | |
| - | + | ||
| - | In this example, the test results point to 250 Ry as a good choice | + | |
| - | for [[inp> | + | |
| - | distribution of Gaussian functions on the grids are reasonable: it | + | |
| - | 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 coarser grids. | + | |
| - | + | ||
| - | + | ||
| - | ==== Converging '' | + | |
| - | In the next step, we vary the value of [[inp> | + | |
| - | [[inp> | + | |
| - | + | ||
| - | + | ||
| - | === Generating Inputs === | + | |
| - | For the energy convergence test with varying [[inp> | + | |
| - | follow a similar procedure as that for [[inp> | + | |
| - | template input file '' | + | |
| - | '' | + | |
| - | + | ||
| - | <code bash> | + | |
| - | # | + | |
| - | + | ||
| - | rel_cutoffs=" | + | |
| - | + | ||
| - | basis_file=BASIS_SET | + | |
| - | potential_file=GTH_POTENTIALS | + | |
| - | template_file=template.inp | + | |
| - | input_file=Si_bulk8.inp | + | |
| - | + | ||
| - | cutoff=250 | + | |
| - | + | ||
| - | for ii in $rel_cutoffs ; do | + | |
| - | work_dir=rel_cutoff_${ii}Ry | + | |
| - | if [ ! -d $work_dir ] ; then | + | |
| - | mkdir $work_dir | + | |
| - | else | + | |
| - | rm -r $work_dir/ | + | |
| - | fi | + | |
| - | sed -e " | + | |
| - | -e " | + | |
| - | $template_file > $work_dir/ | + | |
| - | cp $basis_file $work_dir | + | |
| - | cp $potential_file $work_dir | + | |
| - | done | + | |
| - | </ | + | |
| - | + | ||
| - | Setting the permission for the script to " | + | |
| - | it produces directories '' | + | |
| - | each containing files '' | + | |
| - | '' | + | |
| - | [[inp> | + | |
| - | 100 respectively. | + | |
| - | + | ||
| - | + | ||
| - | === Running Calculations === | + | |
| - | Again to run the calculations, | + | |
| - | '' | + | |
| - | + | ||
| - | <code bash> | + | |
| - | # | + | |
| - | + | ||
| - | rel_cutoffs=" | + | |
| - | + | ||
| - | cp2k_bin=cp2k.popt | + | |
| - | input_file=Si_bulk8.inp | + | |
| - | output_file=Si_bulk8.out | + | |
| - | no_proc_per_calc=2 | + | |
| - | no_proc_to_use=16 | + | |
| - | + | ||
| - | counter=1 | + | |
| - | max_parallel_calcs=$(expr $no_proc_to_use | + | |
| - | for ii in $rel_cutoffs ; do | + | |
| - | work_dir=rel_cutoff_${ii}Ry | + | |
| - | cd $work_dir | + | |
| - | if [ -f $output_file ] ; then | + | |
| - | rm $output_file | + | |
| - | fi | + | |
| - | mpirun -np $no_proc_per_calc $cp2k_bin -o $output_file $input_file & | + | |
| - | cd .. | + | |
| - | mod_test=$(echo " | + | |
| - | if [ $mod_test -eq 0 ] ; then | + | |
| - | wait | + | |
| - | fi | + | |
| - | counter=$(expr $counter + 1) | + | |
| - | done | + | |
| - | wait | + | |
| - | </code> | + | |
| - | + | ||
| - | In the above example, again, we have used 16 cores in total, and | + | |
| - | with each job using 2 MPI processes. To run the jobs, use: | + | |
| - | < | + | |
| - | ./rel_cutoff_run.sh & | + | |
| - | </code> | + | |
| - | + | ||
| - | + | ||
| - | === Analysing Results === | + | |
| - | Total energies and distribution of Gaussian functions on the | + | |
| - | multi-grid are obtained the same way from the results as that for | + | |
| - | the [[inp> | + | |
| - | + | ||
| - | To put all of the results from the [[inp> | + | |
| - | one place, we can make some minor modifications to | + | |
| - | '' | + | |
| - | + | ||
| - | <code bash> | + | |
| - | # | + | |
| - | + | ||
| - | rel_cutoffs=" | + | |
| - | + | ||
| - | input_file=Si_bulk8.inp | + | |
| - | output_file=Si_bulk8.out | + | |
| - | plot_file=rel_cutoff_data.ssv | + | |
| - | + | ||
| - | cutoff=250 | + | |
| - | + | ||
| - | echo "# Rel Grid cutoff vs total energy" | + | |
| - | echo "# Date: $(date)" | + | |
| - | echo "# PWD: $PWD" >> $plot_file | + | |
| - | echo "# CUTOFF = ${cutoff}" | + | |
| - | echo -n "# Rel Cutoff (Ry) | Total Energy (Ha)" >> $plot_file | + | |
| - | grid_header=true | + | |
| - | for ii in $rel_cutoffs ; do | + | |
| - | work_dir=rel_cutoff_${ii}Ry | + | |
| - | total_energy=$(grep -e '^[ \t]*Total energy' | + | |
| - | ngrids=$(grep -e '^[ \t]*QS| Number of grid levels:' | + | |
| - | awk ' | + | |
| - | if $grid_header ; then | + | |
| - | for ((igrid=1; igrid <= ngrids; igrid++)) ; do | + | |
| - | printf " | NG on grid %d" $igrid >> $plot_file | + | |
| - | done | + | |
| - | printf " | + | |
| - | grid_header=false | + | |
| - | fi | + | |
| - | printf " | + | |
| - | for ((igrid=1; igrid <= ngrids; igrid++)) ; do | + | |
| - | grid=$(grep -e '^[ \t]*count for grid' $work_dir/ | + | |
| - | awk -v igrid=$igrid '(NR == igrid){print $5}' | + | |
| - | printf " | + | |
| - | done | + | |
| - | printf " | + | |
| - | done | + | |
| - | </ | + | |
| - | + | ||
| - | Making the script executable, and running the script using | + | |
| - | < | + | |
| - | ./ | + | |
| - | </ | + | |
| - | produces the following results written in file | + | |
| - | '' | + | |
| - | + | ||
| - | < | + | |
| - | # Rel Grid cutoff vs total energy | + | |
| - | # Date: Mon Jan 20 00:45:14 GMT 2014 | + | |
| - | # PWD: / | + | |
| - | # CUTOFF = 250 | + | |
| - | # Rel Cutoff (Ry) | Total Energy (Ha) | NG on grid 1 | NG on grid 2 | NG on grid 3 | NG on grid 4 | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | 100.00 | + | |
| - | </ | + | |
| - | + | ||
| - | The results show that as one increases the value of [[inp> | + | |
| - | more Gaussians get mapped onto the finer grids. The error in total | + | |
| - | energy reduces to less than \(10^{-8}\) Ha when [[inp> | + | |
| - | greater or equal to 60 Ry. The results thus indicate that 60 Ry is | + | |
| - | indeed a suitable choice for the value of [[inp> | + | |
| - | + | ||
| - | So finally we conclude that the setting | + | |
| - | <code cp2k> | + | |
| - | & | + | |
| - | CUTOFF 250 | + | |
| - | REL_CUTOFF 60 | + | |
| - | &END MGRID | + | |
| - | </ | + | |
| - | is sufficient for a calculation with the required accuracy. | + | |
howto/converging_cutoff.1497968992.txt.gz · Last modified: (external edit)
