User Tools

Site Tools


howto:geometry_optimisation

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
Last revisionBoth sides next revision
geometry_optimisation [2014/01/28 08:31] ibethunehowto:geometry_optimisation [2022/12/21 13:28] oschuett
Line 1: Line 1:
-====== Introduction ======+====== How to run Geometry Optimisation ======
  
 +===== Introduction =====
 This tutorial is designed to illustrate how to relax the structure This tutorial is designed to illustrate how to relax the structure
-of a system (without changing the cell dimensions) using '' CP2K ''. We+of a system (without changing the cell dimensions) using ''CP2K''. We
 use the relaxation of a water (H\(_2\)O) molecule as an example. use the relaxation of a water (H\(_2\)O) molecule as an example.
  
-The example files are contained in {{:geometry_optimisation.tgz|geometry_optimisation.tgz}} that comes with this tutorial. The calculation was carried out with '' CP2K '' version+The example files are contained in {{:geometry_optimisation.tgz|geometry_optimisation.tgz}} that comes with this tutorial. The calculation was carried out with ''CP2K'' version
 2.4. 2.4.
  
Line 16: Line 17:
 tutorial [[converging_cutoff|Converging the CUTOFF and REL_CUTOFF]]). tutorial [[converging_cutoff|Converging the CUTOFF and REL_CUTOFF]]).
  
-====== Input Files ======+DIIS (direct inversion in the iterative subspace or direct inversion of the iterative subspace), also known as Pulay mixing, is an extrapolation technique. DIIS was developed by Peter Pulay in the field of computational quantum chemistry with the intent to accelerate and stabilize the convergence of the Hartree–Fock self-consistent field method.
  
 +
 +Note that the ''ALPHA'' and ''NBUFFER'' parameters might have to be reduced to avoid a  [[https://github.com/cp2k/cp2k/issues/2360|bad condition number]].
 +
 +===== Input Files =====
 The input file for a geometry calculation is shown below: The input file for a geometry calculation is shown below:
  
Line 101: Line 106:
   &END CONSTRAINT   &END CONSTRAINT
 &END MOTION &END MOTION
- </code>+</code>
  
-The reader should already be familiar with the [[http://manual.cp2k.org/trunk/CP2K_INPUT/GLOBAL.html|'' GLOBAL '']] and +The reader should already be familiar with the [[http://manual.cp2k.org/trunk/CP2K_INPUT/GLOBAL.html|''GLOBAL'']] and 
-[[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL.html|'' FORCE_EVAL '']] sections. For geometry optimisation calculations, we +[[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL.html|''FORCE_EVAL'']] sections. For geometry optimisation calculations, we 
-must set [[http://manual.cp2k.org/trunk/CP2K_INPUT/GLOBAL.html#desc_RUN_TYPE|'' RUN_TYPE '']] in '' GLOBAL '' section to '' GEO_OPT '':+must set [[http://manual.cp2k.org/trunk/CP2K_INPUT/GLOBAL.html#desc_RUN_TYPE|''RUN_TYPE'']] in ''GLOBAL'' section to ''GEO_OPT'':
  
 <code cp2k> <code cp2k>
 RUN_TYPE GEO_OPT RUN_TYPE GEO_OPT
- </code>+</code>
  
 In this example, we note that we have chosen diagonalisation of the In this example, we note that we have chosen diagonalisation of the
Line 117: Line 122:
  
 The important section for geometry optimisation settings are The important section for geometry optimisation settings are
-contained in subsection [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT.html|'' GEO_OPT '']] of [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION.html|'' MOTION '']] section. Note that +contained in subsection [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT.html|''GEO_OPT'']] of [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION.html|''MOTION'']] section. Note that 
-'' GEO_OPT '' subsection only applies to the calculation where the cell+''GEO_OPT'' subsection only applies to the calculation where the cell
 dimensions do not change. Calculations which allows the relaxation dimensions do not change. Calculations which allows the relaxation
 of the cell are covered in a separate tutorial. of the cell are covered in a separate tutorial.
Line 136: Line 141:
   &END CG   &END CG
 &END GEO_OPT &END GEO_OPT
- </code>+</code>
  
-The [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT.html#desc_TYPE|'' TYPE '']] keyword sets whether the geometry optimisation is for +The [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT.html#desc_TYPE|''TYPE'']] keyword sets whether the geometry optimisation is for 
-finding the local minima ('' MINIMIZATION '') or for finding the saddle +finding the local minima (''MINIMIZATION'') or for finding the saddle 
-point transition state ('' TRANSITION_STATE ''). The keywords [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT.html#desc_MAX_DR|'' MAX_DR '']], +point transition state (''TRANSITION_STATE''). The keywords [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT.html#desc_MAX_DR|''MAX_DR'']], 
-[[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT.html#desc_MAX_FORCE|'' MAX_FORCE '']], [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT.html#desc_RMS_DR|'' RMS_DR '']] and [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT.html#desc_RMS_FORCE|'' RMS_FORCE '']] set the criteria of whether an +[[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT.html#desc_MAX_FORCE|''MAX_FORCE'']], [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT.html#desc_RMS_DR|''RMS_DR'']] and [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT.html#desc_RMS_FORCE|''RMS_FORCE'']] set the criteria of whether an 
-optimised geometry is reached. '' MAX_DR '' and '' RMS_DR '' (in Bohr) are+optimised geometry is reached. ''MAX_DR'' and ''RMS_DR'' (in Bohr) are
 the tolerance on the maximum and root-mean-square of atomic the tolerance on the maximum and root-mean-square of atomic
 displacements from the previous geometry optimisation iteration; displacements from the previous geometry optimisation iteration;
-'' MAX_FORCE '' and '' RMS_FORCE '' (in Bohr/Hartree) are the tolerance on+''MAX_FORCE'' and ''RMS_FORCE'' (in Bohr/Hartree) are the tolerance on
 the maximum and root-mean-square of atomic forces. The geometry is the maximum and root-mean-square of atomic forces. The geometry is
 considered to be optimised //only when all four criteria are considered to be optimised //only when all four criteria are
-satisfied//. The keyword [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT.html#desc_MAX_ITER|'' MAX_ITER '']] sets the maximum number of +satisfied//. The keyword [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT.html#desc_MAX_ITER|''MAX_ITER'']] sets the maximum number of 
-geometry optimisation iterations. [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT.html#desc_OPTIMIZER|'' OPTIMIZER '']] sets the algorithm for+geometry optimisation iterations. [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT.html#desc_OPTIMIZER|''OPTIMIZER'']] sets the algorithm for
 finding the stationary points; in this example we have chosen the finding the stationary points; in this example we have chosen the
-conjugate gradients ('' CG '') method.+conjugate gradients (''CG'') method.
  
-The [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT/CG.html|'' CG '']] subsection sets options for the conjugate gradients+The [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/GEO_OPT/CG.html|''CG'']] subsection sets options for the conjugate gradients
 algorithm. In this case, we have configured it so that no steepest algorithm. In this case, we have configured it so that no steepest
 descent steps are to be performed before the start of the conjugate descent steps are to be performed before the start of the conjugate
Line 167: Line 172:
   &END FIXED_ATOMS   &END FIXED_ATOMS
 &END CONSTRAINT &END CONSTRAINT
- </code>+</code>
  
-We can add constraints to atomic movements by using the [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/CONSTRAINT.html|'' CONSTRAINT '']] +We can add constraints to atomic movements by using the [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/CONSTRAINT.html|''CONSTRAINT'']] 
-subsection in '' MOTION '' section. In this example, we choose to fix +subsection in ''MOTION'' section. In this example, we choose to fix 
-particular atoms using the [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/CONSTRAINT/FIXED_ATOMS.html|'' FIXED_ATOMS '']] subsection. The keyword +particular atoms using the [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/CONSTRAINT/FIXED_ATOMS.html|''FIXED_ATOMS'']] subsection. The keyword 
-[[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/CONSTRAINT/FIXED_ATOMS.html#desc_COMPONENTS_TO_FIX|'' COMPONENTS_TO_FIX '']] sets which of the '' X '' '' Y '' '' Z '' directions are to+[[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/CONSTRAINT/FIXED_ATOMS.html#desc_COMPONENTS_TO_FIX|''COMPONENTS_TO_FIX'']] sets which of the ''X'' ''Y'' ''Z'' directions are to
 be fixed, and in this case, the atoms will be completely pinned in be fixed, and in this case, the atoms will be completely pinned in
-all directions ('' XYZ ''). The list of atoms to be constrained are +all directions (''XYZ''). The list of atoms to be constrained are 
-given by the [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/CONSTRAINT/FIXED_ATOMS.html#desc_LIST|'' LIST '']] keyword:+given by the [[http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/CONSTRAINT/FIXED_ATOMS.html#desc_LIST|''LIST'']] keyword:
  
 <code cp2k> <code cp2k>
 LIST 1 2 3 ... N LIST 1 2 3 ... N
- </code>+</code>
  
-The numbers to the right of '' LIST '' are the list of atomic indices,+The numbers to the right of ''LIST'' are the list of atomic indices,
 and correspond to the order (from top to bottom) of the atoms given and correspond to the order (from top to bottom) of the atoms given
-in the [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/SUBSYS/COORD.html|'' COORD '']] subsection of [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/SUBSYS.html|'' SUBSYS '']] (of [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL.html|'' FORCE_EVAL '']]). In our+in the [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/SUBSYS/COORD.html|''COORD'']] subsection of [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/SUBSYS.html|''SUBSYS'']] (of [[http://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL.html|''FORCE_EVAL'']]). In our
 example, we have fixed the oxygen atom during geometry optimisation, example, we have fixed the oxygen atom during geometry optimisation,
 so that the water molecule will not move around while its structure so that the water molecule will not move around while its structure
 is being relaxed. is being relaxed.
-====== Results ====== 
  
-The example is run using the serial version of the '' CP2K '' binaries:+ 
 +===== Results ===== 
 +The example is run using the serial version of the ''CP2K'' binaries:
  
 <code> <code>
 cp2k.sopt -o H2O.out H2O.inp & cp2k.sopt -o H2O.out H2O.inp &
- </code>+</code>
  
 After the job has finished, you should obtain the following files: After the job has finished, you should obtain the following files:
  
-  * '' H2O.out '' +  * ''H2O.out'' 
-  * '' H2O-pos-1.xyz '' +  * ''H2O-pos-1.xyz'' 
-  * '' H2O-1.restart '' +  * ''H2O-1.restart'' 
-  * '' H2O-1.restart.bak-1 '' +  * ''H2O-1.restart.bak-1'' 
-  * '' H2O-1.restart.bak-2 '' +  * ''H2O-1.restart.bak-2'' 
-  * '' H2O-1.restart.bak-3 ''+  * ''H2O-1.restart.bak-3''
  
-Again, the file '' H2O.out '' contains the main output of the +Again, the file ''H2O.out'' contains the main output of the 
-job. '' H2O-pos-1.xyz '' contains the trace of atomic coordinates at +job. ''H2O-pos-1.xyz'' contains the trace of atomic coordinates at 
-each geometry optimisation step in the '' xyz '' file format. The last+each geometry optimisation step in the ''xyz'' file format. The last
 set of atomic coordinates corresponds to the relaxed set of atomic coordinates corresponds to the relaxed
-structure. '' H2O-1.restart '' is a '' CP2K '' input file, similar to +structure. ''H2O-1.restart'' is a ''CP2K'' input file, similar to 
-'' H2O.inp '', which contains the latest atomic coordinates of the water+''H2O.inp'', which contains the latest atomic coordinates of the water
 molecule. Should the job die for some reason, you can continue the molecule. Should the job die for some reason, you can continue the
 job using the latest atomic coordinates by using command: job using the latest atomic coordinates by using command:
Line 215: Line 221:
 <code> <code>
 cp2k.sopt -o H2O.out H2O-1.restart & cp2k.sopt -o H2O.out H2O-1.restart &
- </code>+</code>
  
-You can of course also use '' H2O-1.restart '' as a template for writing+You can of course also use ''H2O-1.restart'' as a template for writing
 an input for further calculations using the relaxed atomic an input for further calculations using the relaxed atomic
 structures. structures.
  
-The files '' H2O-1.restart.bak-* '' are backup restart files with+The files ''H2O-1.restart.bak-*'' are backup restart files with
 atomic coordinates obtained from the previous 1, 2 and 3 geometry atomic coordinates obtained from the previous 1, 2 and 3 geometry
-optimisation iterations. '' H2O-1.restart.bak-1 '' should be the same as +optimisation iterations. ''H2O-1.restart.bak-1'' should be the same as 
-'' H2O-1.restart ''.+''H2O-1.restart''.
  
-In the main output file '' H2O.out '', at the end of each geometry+In the main output file ''H2O.out'', at the end of each geometry
 optimisation step, we will have the following information: optimisation step, we will have the following information:
  
Line 251: Line 257:
  Conv. for gradients        =                   NO  Conv. for gradients        =                   NO
 --------------------------------------------------- ---------------------------------------------------
- </code>+</code>
  
 The above output segment states that at the end of geometry The above output segment states that at the end of geometry
Line 257: Line 263:
 -17.1643447508 (Ha) and none of the criteria for optimised geometry -17.1643447508 (Ha) and none of the criteria for optimised geometry
 has been reached. The iteration therefore will carry on, until all has been reached. The iteration therefore will carry on, until all
-criteria becomes "'' YES ''".+criteria becomes "''YES''".
  
 At the end of geometry optimisation, one should obtain something At the end of geometry optimisation, one should obtain something
Line 284: Line 290:
  Conv. in RMS gradients                      YES  Conv. in RMS gradients                      YES
 --------------------------------------------------- ---------------------------------------------------
- </code>+</code>
  
 which clearly shows all criteria have been satisfied. which clearly shows all criteria have been satisfied.
Line 342: Line 348:
  
 ENERGY| Total FORCE_EVAL ( QS ) energy (a.u.):              -17.164634771108034 ENERGY| Total FORCE_EVAL ( QS ) energy (a.u.):              -17.164634771108034
- </code>+</code>
  
howto/geometry_optimisation.txt · Last modified: 2024/01/15 09:23 by oschuett