{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Back to the main [Index](../index.ipynb) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
Crystalline silicon.
\n", "This lesson aims at showing you how to get the following physical properties, for an insulator:
\n", "\n", " You will learn about the use of k-points, as well as the smearing of the plane-wave kinetic energy cut-off.\n", "
\n", "def build_ngkpt_flow(options):\n",
" """\n",
" Crystalline silicon: computation of the total energy\n",
" Convergence with respect to the number of k points. Similar to tbase3_3.in\n",
"\n",
" Args:\n",
" options: Command line options.\n",
"\n",
" Return:\n",
" Abinit Flow object.\n",
" """\n",
" # Definition of the different grids\n",
" ngkpt_list = [(2, 2, 2), (4, 4, 4), (6, 6, 6), (8, 8, 8)]\n",
"\n",
" # These shifts will be the same for all grids\n",
" shiftk = [float(s) for s in "0.5 0.5 0.5 0.5 0.0 0.0 0.0 0.5 0.0 0.0 0.0 0.5".split()]\n",
"\n",
" # Build MultiDataset object (container of `ndtset` inputs).\n",
" # Structure is initialized from CIF file.\n",
" multi = abilab.MultiDataset(structure=abidata.cif_file("si.cif"),\n",
" pseudos=abidata.pseudos("14si.pspnc"), ndtset=len(ngkpt_list))\n",
"\n",
" # These variables are the same in each input.\n",
" multi.set_vars(ecut=8, toldfe=1e-6, diemac=12.0, iomode=3)\n",
"\n",
" # Each input has its own value of `ngkpt`. shiftk is constant.\n",
" for i, ngkpt in enumerate(ngkpt_list):\n",
" multi[i].set_kmesh(ngkpt=ngkpt, shiftk=shiftk)\n",
"\n",
" workdir = options.workdir if (options and options.workdir) else "flow_base3_ngkpt"\n",
"\n",
" # Split the inputs by calling multi.datasets() and pass the list of inputs to Flow.from_inputs.\n",
" return flowtk.Flow.from_inputs(workdir, inputs=multi.split_datasets())\n",
"
\n", " | ngkpt | \n", "ecut | \n", "class | \n", "
---|---|---|---|
w0_t0 | \n", "(2, 2, 2) | \n", "8 | \n", "ScfTask | \n", "
w0_t1 | \n", "(4, 4, 4) | \n", "8 | \n", "ScfTask | \n", "
w0_t2 | \n", "(6, 6, 6) | \n", "8 | \n", "ScfTask | \n", "
w0_t3 | \n", "(8, 8, 8) | \n", "8 | \n", "ScfTask | \n", "
\n", " | nkpt | \n", "energy | \n", "energy_Ha | \n", "ediff_Ha | \n", "
---|---|---|---|---|
w0/t0/outdata/out_GSR.nc | \n", "2 | \n", "-241.251546 | \n", "-8.865831 | \n", "0.006242 | \n", "
w0/t1/outdata/out_GSR.nc | \n", "10 | \n", "-241.417959 | \n", "-8.871946 | \n", "0.000126 | \n", "
w0/t2/outdata/out_GSR.nc | \n", "28 | \n", "-241.421158 | \n", "-8.872064 | \n", "0.000009 | \n", "
w0/t3/outdata/out_GSR.nc | \n", "60 | \n", "-241.421391 | \n", "-8.872073 | \n", "0.000000 | \n", "
def build_relax_flow(options):\n",
" """\n",
" Crystalline silicon: computation of the optimal lattice parameter.\n",
" Convergence with respect to the number of k points. Similar to tbase3_4.in\n",
" """\n",
" # Structural relaxation for different k-point samplings.\n",
" ngkpt_list = [(2, 2, 2), (4, 4, 4)]\n",
"\n",
" shiftk = [float(s) for s in "0.5 0.5 0.5 0.5 0.0 0.0 0.0 0.5 0.0 0.0 0.0 0.5".split()]\n",
"\n",
" multi = abilab.MultiDataset(structure=abidata.cif_file("si.cif"),\n",
" pseudos=abidata.pseudos("14si.pspnc"), ndtset=len(ngkpt_list))\n",
"\n",
" # Global variables\n",
" multi.set_vars(\n",
" ecut=8,\n",
" tolvrs=1e-9,\n",
" optcell=1,\n",
" ionmov=3,\n",
" ntime=10,\n",
" dilatmx=1.05,\n",
" ecutsm=0.5,\n",
" diemac=12,\n",
" iomode=3,\n",
" )\n",
"\n",
" for i, ngkpt in enumerate(ngkpt_list):\n",
" multi[i].set_kmesh(ngkpt=ngkpt, shiftk=shiftk)\n",
"\n",
" workdir = options.workdir if (options and options.workdir) else "flow_base3_relax"\n",
"\n",
" return flowtk.Flow.from_inputs(workdir, inputs=multi.split_datasets(), task_class=flowtk.RelaxTask)\n",
"
\n", " | alpha | \n", "a | \n", "final_energy | \n", "final_pressure | \n", "num_steps | \n", "
---|---|---|---|---|---|
w0/t0/outdata/out_HIST.nc | \n", "60.0 | \n", "3.829282 | \n", "-241.255628 | \n", "-0.013259 | \n", "4 | \n", "
w0/t1/outdata/out_HIST.nc | \n", "60.0 | \n", "3.822962 | \n", "-241.425215 | \n", "-0.008757 | \n", "4 | \n", "
\n", " | energy | \n", "a | \n", "pressure | \n", "max_force | \n", "pressure | \n", "
---|---|---|---|---|---|
w0/t0/outdata/out_GSR.nc | \n", "-241.255628 | \n", "3.829282 | \n", "-0.013259 | \n", "1.913429e-27 | \n", "-0.013259 | \n", "
w0/t1/outdata/out_GSR.nc | \n", "-241.425215 | \n", "3.822962 | \n", "-0.008757 | \n", "6.356619e-27 | \n", "-0.008757 | \n", "