This is an old revision of the document!
Geometry optimization of NaCl
Cell optimization of NaCl
For studying many properties of solid materials it is important that the lattice parameters used in a simulation are close to equilibrium for the model chemistry (Hamiltonian) used. Otherwise, large stresses can be present that complicate comparison to experiment. Successful cell optimization requires that the energy changes smoothly with cell volume - and for this the energy cutoff is the most important parameter. The input file template below can be used with driver script to examine how the energy volume curve of NaCl changes with the PW cutoff.
@SET SCALE_FACTOR MY_SCALING
@SET NREP 1
@SET OPTIMIZER BFGS # LBFGS
@SET CUTOFF MY_CUTOFF
@SET SAFTEY_CUTOFF 1.1
&FORCE_EVAL
METHOD QS
&DFT
BASIS_SET_FILE_NAME BASIS_MOLOPT
POTENTIAL_FILE_NAME GTH_POTENTIALS
&MGRID
CUTOFF ${CUTOFF}
REL_CUTOFF 60
&END MGRID
&QS
EPS_DEFAULT 1.0E-12
&END QS
&SCF
SCF_GUESS RESTART
&OT ON
MINIMIZER DIIS
&END OT
&END SCF
&XC
&XC_FUNCTIONAL Pade
&END XC_FUNCTIONAL
&END XC
&END DFT
&SUBSYS
&CELL
ABC 5.620*${SCALE_FACTOR} 5.620*${SCALE_FACTOR} 5.620*${SCALE_FACTOR}
MULTIPLE_UNIT_CELL ${NREP} ${NREP} ${NREP}
#&CELL_REF
# ABC 5.620*${SAFETY_FACTOR} 5.620*${SAFETY_FACTOR} 5.620*${SAFETY_FACTOR}
# MULTIPLE_UNIT_CELL ${NREP} ${NREP} ${NREP}
#&END
&END CELL
&COORD
scaled
Na 0.000 0.000 0.000
Cl 0.500 0.500 0.500
Na 0.000 0.500 0.500
Cl 0.500 0.000 0.000
Na 0.500 0.000 0.500
Cl 0.000 0.500 0.000
Na 0.500 0.500 0.000
Cl 0.000 0.000 0.500
&END
&TOPOLOGY
MULTIPLE_UNIT_CELL ${NREP} ${NREP} ${NREP}
&END TOPOLOGY
&KIND Na
BASIS_SET DZVP-MOLOPT-SR-GTH
POTENTIAL GTH-PADE-q9
&END KIND
&KIND Cl
BASIS_SET DZVP-MOLOPT-SR-GTH
POTENTIAL GTH-PADE-q7
&END KIND
&END SUBSYS
&END FORCE_EVAL
&GLOBAL
PROJECT NaCl
RUN_TYPE ENERGY
&END GLOBAL
&MOTION
&GEO_OPT
OPTIMIZER ${OPTIMIZER}
&END
&CELL_OPT
KEEP_SYMMETRY
&END
&END MOTION
The driver script could be something like
#!/bin/bash
#
CUTOFF="280"
for ii in 0.800 0.825 0.850 0.875 0.900 0.925 0.950 0.975 1.000 1.025 1.050 1.075 1.100
do
#this assumes that the input template is in NaCl_QS.inp
sed -e "s/MY_SCALING/${ii}/g" NaCl_QS.inp > temp.inp
sed -e "s/MY_CUTOFF/${CUTOFF}/g" temp.inp > input_${ii}.inp
#this line should changed to point to your cp2k executable
mpirun -np 2 cp2k.popt input_${ii}.inp > NaCl_${CUTOFF}_${ii}.out
done
You can extract energies from the outputs with a command like
grep 'ENERGY|' *out | awk '{print $10}' > NaCl_energy_volume.dat
and you can plot the results in your favourite graphing software.
What is happening here? Try changing the PW cutoff (defined in the driver script) and using the CELL_REF variable.
Copy the input template to a new file and change the RUN_TYPE to CELL_OPT. You'll also need to ask the code to calculate the stress tensor (in FORCE_EVAL section) ANALYTICALLY! Also define the CUTOFF and SCALING_FACTOR. Start the cell optimization from small cells (SCALING_FACTOR 0.85) or large cells (SCALING_FACTOR 1.10) - do you get the same results?
If you have access a machine with several cores (16 or so ideally) check whether increasing the supercell size affects the results.
