User Tools

Site Tools


events:2018_summer_school:converging_cutoff

This is an old revision of the document!


Converging the cutoff for a more difficult problem

Input files

The complete set of files for this exercise can be found here.

This exercise is similar to the previous one, but uses a setup and system more typical of CP2K usage. We will use a system of 32 H2O water molecules within a periodic box. Here is the input template:

&GLOBAL
  PRINT_LEVEL MEDIUM
  PROJECT cuttoff-test
  RUN_TYPE ENERGY_FORCE
&END GLOBAL


&FORCE_EVAL
  METHOD Quickstep
  &DFT
    BASIS_SET_FILE_NAME BASIS_MOLOPT
    POTENTIAL_FILE_NAME GTH_POTENTIALS
    WFN_RESTART_FILE_NAME ../cuttoff-test-RESTART.wfn
    CHARGE 0
    MULTIPLICITY 1
    &MGRID
      NGRIDS 4
      CUTOFF LT_cutoff
      REL_CUTOFF LT_rel_cutoff
    &END
    &QS
      EPS_DEFAULT 1.0E-12
      METHOD GPW
    &END

    &SCF
      SCF_GUESS RESTART
      EPS_SCF 5.e-7
      MAX_SCF 15
      &OT
        PRECONDITIONER FULL_ALL
        MINIMIZER DIIS
      &END OT
      &OUTER_SCF
        EPS_SCF 5.0E-7
        MAX_SCF 1
      &END OUTER_SCF
    &END SCF

    &XC
      &XC_FUNCTIONAL PBE
      &END XC_FUNCTIONAL
      &XC_GRID
        ! defaults
        XC_SMOOTH_RHO NONE
        XC_DERIV PW
      &END XC_GRID
    &END XC

  &END DFT
  &SUBSYS
    &CELL
      ABC 9.8528 9.8528 9.8528
      PERIODIC XYZ
    &END CELL

    &KIND H
      BASIS_SET DZVP-MOLOPT-SR-GTH-q1
      POTENTIAL GTH-PBE-q1
    &END

    &KIND O
      BASIS_SET DZVP-MOLOPT-SR-GTH-q6
      POTENTIAL GTH-PBE-q6
    &END KIND

    &TOPOLOGY
      COORDINATE XYZ
      COORD_FILE_NAME ../structure.xyz
      CONNECTIVITY OFF
    &END TOPOLOGY
  &END SUBSYS

  &PRINT
    &FORCES
    &END
  &END
&END FORCE_EVAL

Compared to the Si example, this is a larger system, we are using the OT optimizer in a good setup for a small to medium insulating system:

    &SCF
      SCF_GUESS RESTART
      EPS_SCF 5.e-7
      MAX_SCF 15
      &OT
        PRECONDITIONER FULL_ALL
        MINIMIZER DIIS
      &END OT
      &OUTER_SCF
        EPS_SCF 5.0E-7
        MAX_SCF 1
      &END OUTER_SCF
    &END SCF

and we are also saving the forces on the atoms

  &PRINT
    &FORCES
    &END
  &END

We save the forces as for many purposes (MD) converging the forces reasonably is more important than the total energy of the system.

The runcutoff file is a shell script as before to generate the different input files:

#!/bin/bash

cutoffs="100 200 300 400 500 600 700 800 900 1000 1100 1200"

template_file=input_template.inp
input_file=input.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 "s/LT_rel_cutoff/${rel_cutoff}/g" \
        -e "s/LT_cutoff/${ii}/g" \
    $template_file > $work_dir/$input_file
done
remember to make it executable

Running the system

When you run the shell script you should get a series of directories, cutoff_${cutoff}Ry. Run the input files in each directory (you may want to setup a script to do this).

At the end you should have a set of output files that contain the total energy of the system and the forces on each atom.

TASK
  1. Extract and plot the total energy of the system as a function of cutoff
  2. Extract and plot the force on a chosen atom from the system as a function of cutoff
  3. Extract and plot the total force on the system as a function of cutoff

Compare the convergence of forces to the default convergence criteria for geometry optimization.

events/2018_summer_school/converging_cutoff.1527760593.txt.gz · Last modified: 2018/05/31 09:56 by mwatkins