exercises:2019_conexs_newcastle:ex1
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
exercises:2019_conexs_newcastle:ex1 [2019/09/10 12:30] – [Part 2: Running an single-point calculation] abussy | exercises:2019_conexs_newcastle:ex1 [2020/08/21 10:15] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 114: | Line 114: | ||
&END COORD | &END COORD | ||
</ | </ | ||
- | sets up our simulation cell and atomic coordinates respectively. In the &KIND sections, | + | sets up our simulation cell and atomic coordinates respectively. By default, CP2K will run your calculations with periodic boundary conditions but since we are using a large simulation box, the molecule does not interact with its own copies and we are effectively looking at it in gas phase. In the &KIND sections, |
< | < | ||
&KIND H | &KIND H | ||
Line 137: | Line 137: | ||
or | or | ||
< | < | ||
- | ./cp2k.sopt water.inp | tee water.out | + | sbatch |
</ | </ | ||
- | if you want to follow | + | if you are logged in to the cluster and have modified the //cp2k.sh// accordingly. When the program is finished, you will have two new files in your working directory: |
< | < | ||
water.out | water.out | ||
Line 220: | Line 220: | ||
=====Part 3: Geometry optimization===== | =====Part 3: Geometry optimization===== | ||
- | In our previous calculation, | + | In our previous calculation, |
+ | < | ||
+ | & | ||
+ | & | ||
+ | OPTIMIZER BFGS | ||
+ | MAX_DR | ||
+ | MAX_FORCE 4.5E-04 | ||
+ | RMS_DR | ||
+ | RMS_FORCE 3.0E-04 | ||
+ | &END | ||
+ | & | ||
+ | & | ||
+ | COMPONENTS_TO_FIX XYZ | ||
+ | LIST 1 | ||
+ | &END | ||
+ | &END CONSTRAINT | ||
+ | &END MOTION | ||
+ | </ | ||
+ | In the & | ||
+ | < | ||
+ | & | ||
+ | PROJECT h2o_opt | ||
+ | RUN_TYPE GEO_OPT | ||
+ | IOLEVEL LOW | ||
+ | &END GLOBAL | ||
+ | </ | ||
+ | |||
+ | We are now ready to start the calculation. As before, type e.g. | ||
+ | < | ||
+ | ./cp2k.sopt -i water_opt.inp -o water_opt.out & | ||
+ | </ | ||
+ | or | ||
+ | < | ||
+ | ./cp2k.sopt water.inp | tee water.out | ||
+ | </ | ||
+ | into your terminal to start the calculation. A geometry optimization contains more SCF cycles and so this calculation will take more time than before. Once the system has converged, we can examine the output file to evaluate our calculation. At each step in the optimization, | ||
+ | < | ||
+ | | ||
+ | Optimization Method | ||
+ | Total Energy | ||
+ | Real energy change | ||
+ | Predicted change in energy = -0.0002336556 | ||
+ | Scaling factor | ||
+ | Step size = | ||
+ | Trust radius | ||
+ | Decrease in energy | ||
+ | Used time = | ||
+ | |||
+ | Convergence check : | ||
+ | Max. step size | ||
+ | Conv. limit for step size = | ||
+ | Convergence in step size | ||
+ | RMS step size = | ||
+ | Conv. limit for RMS step | ||
+ | Convergence in RMS step = NO | ||
+ | Max. gradient | ||
+ | Conv. limit for gradients | ||
+ | Conv. for gradients | ||
+ | RMS gradient | ||
+ | Conv. limit for RMS grad. = | ||
+ | Conv. for gradients | ||
+ | | ||
+ | </ | ||
+ | describing each step. It is very important to check that your geometry optimization has converged properly, and this can be done by looking at the end of the output file. The last step should look something like this: | ||
+ | < | ||
+ | | ||
+ | Optimization Method | ||
+ | Total Energy | ||
+ | Real energy change | ||
+ | Predicted change in energy = -0.0000002260 | ||
+ | Scaling factor | ||
+ | Step size = | ||
+ | Trust radius | ||
+ | Decrease in energy | ||
+ | Used time = | ||
+ | |||
+ | Convergence check : | ||
+ | Max. step size | ||
+ | Conv. limit for step size = | ||
+ | Convergence in step size | ||
+ | RMS step size = | ||
+ | Conv. limit for RMS step | ||
+ | Convergence in RMS step = YES | ||
+ | Max. gradient | ||
+ | Conv. limit for gradients | ||
+ | Conv. in gradients | ||
+ | RMS gradient | ||
+ | Conv. limit for RMS grad. = | ||
+ | Conv. in RMS gradients | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | Make sure that the calculation has converged by all criteria. You should also have several more files in your working directory, including e.g. | ||
+ | |||
+ | *h2o_opt-1.restart | ||
+ | *h2o_opt-1.restart.bak-1 | ||
+ | *h2o_opt-pos-1.xyz | ||
+ | |||
+ | The h2o_opt-1.restart contains all the input required to restart a calculation from the last step in the calculation. Its h2o_opt-1.restart.bak-1 analogue is the backup containing information from the previous step, and so on. The last file h2o_opt-pos-1.xyz contains the atomic trajectory of the optimization. | ||
+ | |||
+ | Try to open it in e.g. Molden(?) to visualize the steps. | ||
+ | |||
+ | Here we can see that the bond angle is now 102.8°, which is better but still quite far from the accepted 104.45°. Also comparing the final total energy to our first single-point calculation, | ||
+ | |||
+ | =====Part 4: Computing PDOS===== | ||
+ | |||
+ | Now that we have obtained a more reasonable geometry, we will know attempt to compute the eigenvalues of our Kohn-Sham orbitals and compare the energy levels to the attached experimental spectra. We will also use this opportunity to try out the option to restart a calculation. | ||
+ | -0.316280 | ||
+ | To restart our calculation from the previous geometry optimization, | ||
+ | h2o_opt-RESTART.wfn | ||
+ | h2o_opt-1.restart | ||
+ | to our current working directory. To make the code read these files, we have to add a section | ||
+ | < | ||
+ | & | ||
+ | RESTART_FILE_NAME h2o_opt-1.restart | ||
+ | &END EXT_RESTART | ||
+ | </ | ||
+ | as well as adding | ||
+ | < | ||
+ | SCF_GUESS RESTART | ||
+ | RESTART_FILE_NAME h2o_opt-RESTART.wfn | ||
+ | </ | ||
+ | to the &SCF and &DFT sections respectively. To print the PDOS, we also need to add the &PDOS section under &DFT | ||
+ | < | ||
+ | & | ||
+ | &PDOS | ||
+ | | ||
+ | NLUMO 2 | ||
+ | &END | ||
+ | &END | ||
+ | </ | ||
+ | and specify the spectra file names for example if we want to include unoccupied virtual orbitals. The final input can e.g. look like this: | ||
+ | < | ||
+ | &DFT | ||
+ | BASIS_SET_FILE_NAME GTH_BASIS_SETS | ||
+ | POTENTIAL_FILE_NAME GTH_POTENTIALS | ||
+ | LSD 0 | ||
+ | RESTART_FILE_NAME h2o_opt-RESTART.wfn | ||
+ | &QS | ||
+ | METHOD GPW | ||
+ | EPS_DEFAULT 1.0E-10 | ||
+ | &END QS | ||
+ | &SCF | ||
+ | MAX_SCF | ||
+ | EPS_SCF | ||
+ | SCF_GUESS RESTART | ||
+ | & | ||
+ | METHOD DIRECT_P_MIXING | ||
+ | ALPHA 0.6 | ||
+ | &END MIXING | ||
+ | & | ||
+ | ALGORITHM STANDARD | ||
+ | &END DIAGONALIZATION | ||
+ | &END SCF | ||
+ | & | ||
+ | NGRIDS 4 | ||
+ | CUTOFF 300 | ||
+ | REL_CUTOFF 60 | ||
+ | &END | ||
+ | &XC | ||
+ | & | ||
+ | &END XC_FUNCTIONAL | ||
+ | &END XC | ||
+ | & | ||
+ | &PDOS | ||
+ | FILENAME ./h2o | ||
+ | NLUMO 2 | ||
+ | &END | ||
+ | & | ||
+ | &END DFT | ||
+ | </ | ||
+ | When the calculation is done, open the file | ||
+ | *h2o-k1-1.pdos | ||
+ | and compare your calculated energies to the experimental measurements reported in the attached paper, e.g. Fig. 1. As a reminder, one 1 a.u. = 27.212 eV. Look in particular on the energy differences between the three valence states. | ||
+ | |||
+ | {{: | ||
+ | ---- | ||
+ | =====Part 5: (Optional) Testing your parameters===== | ||
+ | |||
+ | If you followed this exercise closely, chances are that the computed orbital energies in your PDOS files are quite similar to the experimental ones, given an ad hoc shift of the energies. However, the 1b2 orbital will be slightly off. Can we do better by tweaking our input, or can we get as good results with a faster method? In this exercise, we will investigate and try to get a feel for how different parameters affect the accuracy and time consumption of your calculation. Go back to Part 3 and Part 4 and redo the calculation while changing the following parameters | ||
+ | < | ||
+ | & | ||
+ | |||
+ | CUTOFF | ||
+ | |||
+ | BASIS_SET | ||
+ | |||
+ | EPS_SCF | ||
+ | </ | ||
+ | (choose one of the suggested in the brackets). The suggestions are given from less accurate to more accurate. When you feel comfortable, | ||
+ |
exercises/2019_conexs_newcastle/ex1.1568118628.txt.gz · Last modified: 2020/08/21 10:15 (external edit)