MICCoM School 2017 Ex#2 : Computation of the dielectric screening

We are going to dive into the calculation of the dielectric screening done in Exercise #1.

In this excercixe we will focus on the input for wstat.x.

[1]:
# download the pseudopotentials
!wget -N -q http://www.quantum-simulation.org/potentials/sg15_oncv/upf/Si_ONCV_PBE-1.2.upf
!wget -N -q http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.2.upf

# download the input files
!wget -N -q https://west-code.org/doc/training/silane/pw.in
!wget -N -q https://west-code.org/doc/training/silane/wstat.in

In order to compute the dielectric screening we need to read the output of a DFT calculation, therefore as first step we run the DFT calculation invoking the executable pw.x on 8 CPU cores.

[ ]:
!mpirun -n 8 pw.x -i pw.in > pw.out

2.1 : Iterative diagonalization of the static dielectric matrix

Wstat will read the output of DFT and will compute the static dielectric screening from first principles. An iterative diagonalization of the dielectric matrix is performed:

\begin{equation} \epsilon_{\mathbf{G},\mathbf{G^\prime}}(\omega=0) = \sum_{i=1}^{\texttt{n_pdep_eigen}} \, \phi_i(\mathbf{G}) \, \lambda_i \phi^\ast_i(\mathbf{G^\prime}) \end{equation}

where \(\phi_i\) and \(\lambda_i\) are the eigenvectors and eigenvalues of the dielectric matrix (extressed here in terms of plane waves).

The diagonalization is started with random potentials and then iterated using the Davidson algorithm. Details about the implementation are described in J. Chem. Theory Comput. 11, 2680 (2015) :

3613688835604c92800bdc6bb5326282

Let’s give a quick look at the input for wstat.x (description of the input variables for wstat.x can be found here: https://west-code.org/doc/West/latest/manual.html#wstat-control).

[2]:
!cat wstat.in
input_west:
    qe_prefix: silane
    west_prefix: silane
    outdir: ./

wstat_control:
    wstat_calculation: S
    n_pdep_eigen: 50

In this case we are computing 50 eigenpotentials \(\phi_i\).

We run wstat.x on 8 cores.

[ ]:
!mpirun -n 8 wstat.x -i wstat.in > wstat.out

We now load the output (JSON) of the wstat.x calculation, which can be found in the wstat.save folder.

[3]:
import json

# read data from JSON file
with open('silane.wstat.save/wstat.json', 'r') as file:
    data = json.load(file)

# pretty print the data
print(json.dumps(data, indent=2))
{
  "runjob": {
    "startdate": "17Aug2022",
    "starttime": "11:48:16",
    "completed": true,
    "endtime": "11:49: 3",
    "enddate": "17Aug2022"
  },
  "software": {
    "package": "WEST",
    "program": "WSTAT",
    "version": "5.0.0",
    "westgit": "v5.0.0-117-ga4764c0",
    "website": "https://west-code.org",
    "citation": "M. Govoni et al., J. Chem. Theory Comput. 11, 2680 (2015).",
    "qeversion": "7.1"
  },
  "config": {
    "io": {
      "islittleendian": true
    }
  },
  "parallel": {
    "nranks": 2,
    "nimage": 1,
    "npool": 1,
    "nbgrp": 1,
    "nrg": 2,
    "nproc": 36,
    "nthreads": 18
  },
  "input": {
    "input_west": {
      "qe_prefix": "silane",
      "west_prefix": "silane",
      "outdir": "./"
    },
    "wstat_control": {
      "wstat_calculation": "S",
      "n_pdep_eigen": 50,
      "n_pdep_times": 4,
      "n_pdep_maxiter": 100,
      "n_dfpt_maxiter": 250,
      "n_pdep_read_from_file": 0,
      "n_steps_write_restart": 1,
      "trev_pdep": 0.001,
      "trev_pdep_rel": 0.1,
      "tr2_dfpt": 1e-12,
      "l_kinetic_only": false,
      "l_minimize_exx_if_active": false,
      "l_use_ecutrho": false,
      "qlist": [
        1
      ]
    },
    "server_control": {
      "document": "{}"
    }
  },
  "system": {
    "basis": {
      "npw": {
        "proc": [
          0,
          0
        ],
        "min": 0,
        "max": 0,
        "sum": 0
      },
      "ngm": {
        "proc": [
          33761,
          33761
        ],
        "min": 33761,
        "max": 33761,
        "sum": 67522
      },
      "gamma_only": true,
      "ecutwfc:ry": 25.0,
      "ecutrho:ry": 100.0
    },
    "cell": {
      "units": "a.u.",
      "omega": 8000.0,
      "a1": [
        20.0,
        0.0,
        0.0
      ],
      "a2": [
        0.0,
        20.0,
        0.0
      ],
      "a3": [
        0.0,
        0.0,
        20.0
      ],
      "b1": [
        0.3141592653589793,
        0.0,
        0.0
      ],
      "b2": [
        0.0,
        0.3141592653589793,
        0.0
      ],
      "b3": [
        0.0,
        0.0,
        0.3141592653589793
      ],
      "alat": 20.0,
      "tpiba": 0.3141592653589793
    },
    "electron": {
      "nbnd": 10,
      "nkstot": 1,
      "nspin": 1,
      "nelec": 8.0,
      "npol": 1,
      "lsda": false,
      "noncolin": false,
      "lspinorb": false
    },
    "3dfft": {
      "s": [
        64,
        64,
        64
      ],
      "p": [
        64,
        64,
        64
      ]
    },
    "bzsamp": {
      "k": [
        {
          "id": 1,
          "crystcoord": [
            0.0,
            0.0,
            0.0
          ]
        }
      ]
    }
  },
  "memory": {
    "units": "Mb",
    "evc": 0.643768310546875,
    "nlpp": 1.030029296875,
    "rhor": 2.0,
    "rhog": 0.25757598876953125,
    "gshells": 0.00644683837890625,
    "dvg": 12.8753662109375,
    "dng": 12.8753662109375,
    "hr_distr": 0.30517578125,
    "vr_distr": 0.30517578125,
    "dvpsi": 0.25750732421875,
    "dpsi": 0.25750732421875
  },
  "exec": {
    "ndav": 4,
    "davitr": [
      {
        "dav_iter": -1,
        "ev": [
          -1.2597920008819483,
          -1.1804779646517969,
          -1.175580460074221,
          -1.170518746592387,
          -0.8158737820824444,
          -0.8096754873563821,
          -0.8033831247039404,
          -0.62039804066553,
          -0.6136203594064366,
          -0.45019331265994583,
          -0.44239323686944776,
          -0.42268428347765336,
          -0.416012182312741,
          -0.4084879715160957,
          -0.39098061818947955,
          -0.3512029237530092,
          -0.22027387351142783,
          -0.21289590673766676,
          -0.2041839130170979,
          -0.1660880211287726,
          -0.15965608370088566,
          -0.1552883084827036,
          -0.15234064510917447,
          -0.143857899323352,
          -0.13655836919398315,
          -0.12508487904799487,
          -0.11536109963123706,
          -0.10456409201425686,
          -0.10040247220382374,
          -0.09867616011172382,
          -0.09330067587708964,
          -0.0916552366402037,
          -0.08516162225345796,
          -0.0795681347971717,
          -0.0776539135068234,
          -0.07304575739190704,
          -0.06890001305874492,
          -0.06013132171363926,
          -0.05778137970333775,
          -0.05591237038810109,
          -0.0509077772190793,
          -0.04951424523341026,
          -0.04763759661095598,
          -0.044351337974306175,
          -0.04316160584579328,
          -0.040659153031352716,
          -0.037772942437092796,
          -0.03575458038574352,
          -0.03375983194311376,
          -0.015404864207819143
        ],
        "conv": [
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false
        ],
        "notcnv": 50,
        "time_elap:sec": 10.647040843963623,
        "time_elap:hum": "10.6s",
        "time_iter:sec": 10.647039890289307,
        "time_iter:hum": "10.6s",
        "sternop_ncalls": 1011,
        "dfpt_tr2": 1e-06,
        "dfpt_dim": 50,
        "diago_dim": 50
      },
      {
        "dav_iter": 1,
        "ev": [
          -1.274669262856979,
          -1.191233126651762,
          -1.1911372186790126,
          -1.1910927260406916,
          -0.824038483075076,
          -0.8240002268690774,
          -0.8238956417270615,
          -0.6355693532960318,
          -0.6293311025971919,
          -0.6293136543691495,
          -0.5003892985129232,
          -0.5003494912230143,
          -0.5002323979529588,
          -0.42986783128967204,
          -0.4298528244958721,
          -0.4297918509659828,
          -0.23227286781718065,
          -0.2321787875120815,
          -0.23200884756624351,
          -0.1828921791800945,
          -0.1826848361490161,
          -0.18222892923333261,
          -0.177805375195659,
          -0.17667025906007094,
          -0.1766262941256459,
          -0.14556840202990465,
          -0.14524438545742782,
          -0.14483353898097315,
          -0.12069987806246231,
          -0.11907036725131165,
          -0.11870682338887412,
          -0.11806024634421383,
          -0.11575538176978406,
          -0.11514033672369446,
          -0.11428156707804332,
          -0.11347844852372045,
          -0.1100424161491943,
          -0.09206794087956337,
          -0.09142528990929158,
          -0.08969111404766479,
          -0.07825588445754512,
          -0.07556895056360285,
          -0.07371117786545715,
          -0.07139690372455104,
          -0.06941561843036656,
          -0.06807761786518568,
          -0.06267641135471971,
          -0.0620083019432895,
          -0.060720162479739416,
          -0.06012016292744806
        ],
        "conv": [
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false
        ],
        "notcnv": 50,
        "time_elap:sec": 24.821818828582764,
        "time_elap:hum": "24.8s",
        "time_iter:sec": 14.055088996887207,
        "time_iter:hum": "14.0s",
        "sternop_ncalls": 1724,
        "dfpt_tr2": 1e-12,
        "dfpt_dim": 50,
        "diago_dim": 100
      },
      {
        "dav_iter": 2,
        "ev": [
          -1.2746728967192669,
          -1.1912366831068857,
          -1.1911409515023197,
          -1.1910954480003133,
          -0.824048221448877,
          -0.8240039383270612,
          -0.8239031395244087,
          -0.6357819680353657,
          -0.6293420281327683,
          -0.6293230974942247,
          -0.5004955532584358,
          -0.5004753659767057,
          -0.5004186849179404,
          -0.4299170032090784,
          -0.42990242737289514,
          -0.4298811043521491,
          -0.23238064072522885,
          -0.23237661873153226,
          -0.23236256392772858,
          -0.18322811151035312,
          -0.183206322271527,
          -0.18319736075624335,
          -0.1783941626981762,
          -0.17748991572873946,
          -0.17748834477003364,
          -0.14591977008680587,
          -0.14591521573902963,
          -0.14590207816008297,
          -0.12254815349331225,
          -0.12010730978908299,
          -0.12010494538130652,
          -0.12009128378907326,
          -0.11633861102985972,
          -0.11633116729138301,
          -0.11527607102284627,
          -0.11527137384814852,
          -0.11522630798253378,
          -0.09404203190012454,
          -0.09402822422743992,
          -0.09399079676205715,
          -0.07990870451086036,
          -0.07985335237323775,
          -0.07974288081934075,
          -0.07465042239973901,
          -0.07300127696747791,
          -0.0729447947486286,
          -0.06561191883525687,
          -0.06553677427113208,
          -0.06526874797489894,
          -0.06305144100785147
        ],
        "conv": [
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          false,
          false,
          false,
          false,
          false,
          true,
          false,
          true,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false,
          false
        ],
        "notcnv": 21,
        "time_elap:sec": 39.157527923583984,
        "time_elap:hum": "39.1s",
        "time_iter:sec": 14.061255931854248,
        "time_iter:hum": "14.0s",
        "sternop_ncalls": 1692,
        "dfpt_tr2": 1e-12,
        "dfpt_dim": 50,
        "diago_dim": 150
      },
      {
        "dav_iter": 3,
        "ev": [
          -1.2746728968767393,
          -1.191236683277209,
          -1.1911409516541394,
          -1.1910954481604128,
          -0.8240482223450494,
          -0.8240039387166243,
          -0.8239031402340875,
          -0.6357819954647485,
          -0.6293420298879835,
          -0.6293230986819593,
          -0.5004955922157738,
          -0.5004753882686617,
          -0.5004187431738554,
          -0.42991703259816355,
          -0.42990244579729825,
          -0.42988113665586336,
          -0.2323809717108895,
          -0.2323769049118985,
          -0.23236338028560383,
          -0.1832302254169517,
          -0.18320713792148025,
          -0.18319986685613107,
          -0.1783962545919138,
          -0.1774921608258205,
          -0.17749049520377067,
          -0.1459215063374214,
          -0.1459186005572583,
          -0.14590667283121697,
          -0.12256418044611023,
          -0.120118433006157,
          -0.12011401697977397,
          -0.12010990536055687,
          -0.11634223496636772,
          -0.11634118188225365,
          -0.11528637396522501,
          -0.11528175325786023,
          -0.11528151261070778,
          -0.09407981906621285,
          -0.0940764821118962,
          -0.09407435908369244,
          -0.07995305427142767,
          -0.07994979223120462,
          -0.07994840482883717,
          -0.07477637496930246,
          -0.07309847636971722,
          -0.07309674211812003,
          -0.06577740888139338,
          -0.06577163149381046,
          -0.06576642264816979,
          -0.0631333140415683
        ],
        "conv": [
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true,
          true
        ],
        "notcnv": 0,
        "time_elap:sec": 46.0455048084259,
        "time_elap:hum": "46.0s",
        "time_iter:sec": 6.423842906951904,
        "time_iter:hum": "06.4s",
        "sternop_ncalls": 709,
        "dfpt_tr2": 1e-12,
        "dfpt_dim": 21,
        "diago_dim": 171
      }
    ]
  },
  "timing": {
    "WSTAT": {
      "cpu:sec": 726.85296,
      "cpu:hum": "12m-06.8s",
      "wall:sec": 46.85351300239563,
      "wall:hum": "46.8s",
      "nocalls": 2
    },
    "wstat_readin": {
      "cpu:sec": 1.166348,
      "cpu:hum": "01.1s",
      "wall:sec": 0.4056539535522461,
      "wall:hum": "00.4s",
      "nocalls": 1
    },
    "fetch_input": {
      "cpu:sec": 0.06025700000000023,
      "cpu:hum": "< 00.1s",
      "wall:sec": 0.008002996444702148,
      "wall:hum": "< 00.1s",
      "nocalls": 2
    },
    "fft": {
      "cpu:sec": 0.43111799999999967,
      "cpu:hum": "00.4s",
      "wall:sec": 0.24176311492919922,
      "wall:hum": "00.2s",
      "nocalls": 9
    },
    "fft_scatter": {
      "cpu:sec": 131.43538300000637,
      "cpu:hum": "02m-11.4s",
      "wall:sec": 8.329422950744629,
      "wall:hum": "08.3s",
      "nocalls": 20891
    },
    "init_vloc": {
      "cpu:sec": 0.20121199999999995,
      "cpu:hum": "00.2s",
      "wall:sec": 0.014452934265136719,
      "wall:hum": "< 00.1s",
      "nocalls": 2
    },
    "init_us_1": {
      "cpu:sec": 0.21319900000000014,
      "cpu:hum": "00.2s",
      "wall:sec": 0.014662027359008789,
      "wall:hum": "< 00.1s",
      "nocalls": 2
    },
    "v_of_rho": {
      "cpu:sec": 0.613094,
      "cpu:hum": "00.6s",
      "wall:sec": 0.04138898849487305,
      "wall:hum": "< 00.1s",
      "nocalls": 1
    },
    "v_xc": {
      "cpu:sec": 0.574013,
      "cpu:hum": "00.5s",
      "wall:sec": 0.037950992584228516,
      "wall:hum": "< 00.1s",
      "nocalls": 1
    },
    "v_h": {
      "cpu:sec": 0.03834499999999985,
      "cpu:hum": "< 00.1s",
      "wall:sec": 0.0033731460571289062,
      "wall:hum": "< 00.1s",
      "nocalls": 1
    },
    "do_setup": {
      "cpu:sec": 0.28444899999999995,
      "cpu:hum": "00.2s",
      "wall:sec": 0.019685029983520508,
      "wall:hum": "< 00.1s",
      "nocalls": 1
    },
    "init_pw_ar": {
      "cpu:sec": 0.26424499999999984,
      "cpu:hum": "00.2s",
      "wall:sec": 0.018043041229248047,
      "wall:hum": "< 00.1s",
      "nocalls": 1
    },
    "hinit0": {
      "cpu:sec": 0.219916,
      "cpu:hum": "00.2s",
      "wall:sec": 0.014929056167602539,
      "wall:hum": "< 00.1s",
      "nocalls": 1
    },
    "chidiago": {
      "cpu:sec": 725.390754,
      "cpu:hum": "12m-05.3s",
      "wall:sec": 46.420153856277466,
      "wall:hum": "46.4s",
      "nocalls": 1
    },
    "sqvc_init": {
      "cpu:sec": 0.06507600000000013,
      "cpu:hum": "< 00.1s",
      "wall:sec": 0.003932952880859375,
      "wall:hum": "< 00.1s",
      "nocalls": 1
    },
    "randomize": {
      "cpu:sec": 1.496603,
      "cpu:hum": "01.4s",
      "wall:sec": 0.09444904327392578,
      "wall:hum": "< 00.1s",
      "nocalls": 1
    },
    "paramgs": {
      "cpu:sec": 1.15286100000003,
      "cpu:hum": "01.1s",
      "wall:sec": 0.18256330490112305,
      "wall:hum": "00.1s",
      "nocalls": 5
    },
    "dfpt": {
      "cpu:sec": 708.363246,
      "cpu:hum": "11m-48.3s",
      "wall:sec": 44.345003843307495,
      "wall:hum": "44.3s",
      "nocalls": 5
    },
    "init_us_2": {
      "cpu:sec": 0.20198900000002595,
      "cpu:hum": "00.2s",
      "wall:sec": 0.013321161270141602,
      "wall:hum": "< 00.1s",
      "nocalls": 5
    },
    "init_us_2:cp": {
      "cpu:sec": 0.2010139999998728,
      "cpu:hum": "00.2s",
      "wall:sec": 0.01326131820678711,
      "wall:hum": "< 00.1s",
      "nocalls": 5
    },
    "fftw": {
      "cpu:sec": 453.9737659999984,
      "cpu:hum": "07m-33.9s",
      "wall:sec": 28.309765100479126,
      "wall:hum": "28.3s",
      "nocalls": 20882
    },
    "alphapc": {
      "cpu:sec": 0.8240560000002688,
      "cpu:hum": "00.8s",
      "wall:sec": 0.05235481262207031,
      "wall:hum": "< 00.1s",
      "nocalls": 221
    },
    "wstat_restar": {
      "cpu:sec": 7.084378000000015,
      "cpu:hum": "07.0s",
      "wall:sec": 0.9346446990966797,
      "wall:hum": "00.9s",
      "nocalls": 4
    },
    "pdep_write": {
      "cpu:sec": 7.500691999999617,
      "cpu:hum": "07.5s",
      "wall:sec": 1.0133132934570312,
      "wall:hum": "01.0s",
      "nocalls": 750
    },
    "linstern": {
      "cpu:sec": 629.1100380000005,
      "cpu:hum": "10m-29.1s",
      "wall:sec": 39.38912582397461,
      "wall:hum": "39.3s",
      "nocalls": 171
    },
    "stern": {
      "cpu:sec": 504.9378340000003,
      "cpu:hum": "08m-24.9s",
      "wall:sec": 31.56019163131714,
      "wall:hum": "31.5s",
      "nocalls": 5136
    },
    "h_psi": {
      "cpu:sec": 491.86367999999896,
      "cpu:hum": "08m-11.8s",
      "wall:sec": 30.72730803489685,
      "wall:hum": "30.7s",
      "nocalls": 5136
    },
    "h_psi:pot": {
      "cpu:sec": 484.3170999999988,
      "cpu:hum": "08m-04.3s",
      "wall:sec": 30.249082326889038,
      "wall:hum": "30.2s",
      "nocalls": 5136
    },
    "vloc_psi": {
      "cpu:sec": 461.5674859999992,
      "cpu:hum": "07m-41.5s",
      "wall:sec": 28.807156801223755,
      "wall:hum": "28.8s",
      "nocalls": 5136
    },
    "h_psi:calbec": {
      "cpu:sec": 11.147343999998725,
      "cpu:hum": "11.1s",
      "wall:sec": 0.7090952396392822,
      "wall:hum": "00.7s",
      "nocalls": 5136
    },
    "calbec": {
      "cpu:sec": 9.853644999997869,
      "cpu:hum": "09.8s",
      "wall:sec": 0.631899356842041,
      "wall:hum": "00.6s",
      "nocalls": 5136
    },
    "add_vuspsi": {
      "cpu:sec": 9.011515000000372,
      "cpu:hum": "09.0s",
      "wall:sec": 0.576535701751709,
      "wall:hum": "00.5s",
      "nocalls": 5136
    },
    "alphapv": {
      "cpu:sec": 9.26880699999947,
      "cpu:hum": "09.2s",
      "wall:sec": 0.5923843383789062,
      "wall:hum": "00.5s",
      "nocalls": 5136
    },
    "build_hr": {
      "cpu:sec": 1.3007139999999708,
      "cpu:hum": "01.3s",
      "wall:sec": 0.08092212677001953,
      "wall:hum": "< 00.1s",
      "nocalls": 4
    },
    "diagox": {
      "cpu:sec": 2.1716060000001107,
      "cpu:hum": "02.1s",
      "wall:sec": 0.13570284843444824,
      "wall:hum": "00.1s",
      "nocalls": 4
    },
    "redistr_vr": {
      "cpu:sec": 0.0,
      "cpu:hum": "< 00.1s",
      "wall:sec": 0.0010519027709960938,
      "wall:hum": "< 00.1s",
      "nocalls": 3
    },
    "update_vr": {
      "cpu:sec": 0.15649499999994987,
      "cpu:hum": "00.1s",
      "wall:sec": 0.1746368408203125,
      "wall:hum": "00.1s",
      "nocalls": 3
    },
    "chidiago:las": {
      "cpu:sec": 0.0001440000000911823,
      "cpu:hum": "< 00.1s",
      "wall:sec": 7.152557373046875e-06,
      "wall:hum": "< 00.1s",
      "nocalls": 1
    },
    "refresh_vr": {
      "cpu:sec": 0.9202150000000984,
      "cpu:hum": "00.9s",
      "wall:sec": 0.057260990142822266,
      "wall:hum": "< 00.1s",
      "nocalls": 1
    },
    "pdep_db": {
      "cpu:sec": 0.9658789999999726,
      "cpu:hum": "00.9s",
      "wall:sec": 0.11427998542785645,
      "wall:hum": "00.1s",
      "nocalls": 1
    }
  }
}

We plot the 50 eigenvalues \(\lambda_i\) of the dielectric matrix.

[4]:
import numpy as np
import matplotlib.pyplot as plt

# y : eigenvalues of the dielectic matrix
y = data['exec']['davitr'][-1]['ev']
# x : index of eigenvalue
x = np.arange(1, len(y)+1, 1)

print('y : ', y)
print('x : ', x)

# plot
fig, ax = plt.subplots(1, 1)
ax.plot(x, y, 'ro-')

plt.xlabel('i')
plt.ylabel('Eigenvalue')

plt.title('PDEP')

plt.show()
y :  [-1.2746728968767393, -1.191236683277209, -1.1911409516541394, -1.1910954481604128, -0.8240482223450494, -0.8240039387166243, -0.8239031402340875, -0.6357819954647485, -0.6293420298879835, -0.6293230986819593, -0.5004955922157738, -0.5004753882686617, -0.5004187431738554, -0.42991703259816355, -0.42990244579729825, -0.42988113665586336, -0.2323809717108895, -0.2323769049118985, -0.23236338028560383, -0.1832302254169517, -0.18320713792148025, -0.18319986685613107, -0.1783962545919138, -0.1774921608258205, -0.17749049520377067, -0.1459215063374214, -0.1459186005572583, -0.14590667283121697, -0.12256418044611023, -0.120118433006157, -0.12011401697977397, -0.12010990536055687, -0.11634223496636772, -0.11634118188225365, -0.11528637396522501, -0.11528175325786023, -0.11528151261070778, -0.09407981906621285, -0.0940764821118962, -0.09407435908369244, -0.07995305427142767, -0.07994979223120462, -0.07994840482883717, -0.07477637496930246, -0.07309847636971722, -0.07309674211812003, -0.06577740888139338, -0.06577163149381046, -0.06576642264816979, -0.0631333140415683]
x :  [ 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
 49 50]
../../_images/tutorials_MICCoM_School_2017_miccom_002_14_1.png

We can track how the eigenvalues converge during the iterative diagonalization.

[5]:
import numpy as np
import matplotlib.pyplot as plt

# y : eigenvalues of the dielectic matrix (now for every iteration)
y = []
for i in range(data['exec']['ndav']) :
    y.append(data['exec']['davitr'][i]['ev'])
# x : index of the eigenvalues
x = np.arange(1, len(y[0])+1, 1)

# plot
fig, ax = plt.subplots(1, 1)

for i in range(data['exec']['ndav']) :
    ax.plot(x, y[i], 'o-', label='iter'+str(i+1))

plt.xlabel('i')
plt.ylabel('Eigenvalue')

plt.legend()

plt.title('PDEP')
plt.show()
../../_images/tutorials_MICCoM_School_2017_miccom_002_16_0.png
Question: How do we compute 70 eigenpotentials?

Edit the file below, execute it, and plot the eigenvalues! ~

[ ]:
import yaml

# read data: wstat.in --> input_data
with open('wstat.in') as file:
    input_data = yaml.load(file, Loader=yaml.FullLoader)

# pretty print
print('input_data')
print(yaml.dump(input_data, sort_keys=False))

# modify the variable n_pdep_eigen in input_data
# input_data[..........  EDIT HERE ...............] = 70

# write data to YAML file: input_data --> wstat_70.in
with open('wstat_70.in', 'w') as file:
    yaml.dump(input_data, file, sort_keys=False)

# show content of the file
print('wstat_70.in')
!cat wstat_70.in
[ ]:
!mpirun -n 8 wstat.x -i wstat_70.in > wstat_70.out

Now plot the data and compare.