<div dir="ltr">Dear All,<div><br></div><div>I am trying to calculate the work function for a Methyl Magnesium Halide Perovskite. I followed the workfunction example in quantum espresso. I am unsure how to appropriately generate the <a href="http://average.in">average.in</a> file., how to define the appropriate parameters like the weight, number of points and number of files.</div><div><br></div><div>Please find below the script used and parts of the resulting .pot and average.out files.</div><div><br></div><div><b>script for post processing</b></div><div><br></div><div><div># post-processing for potential </div><div>cat > <a href="http://dimamgwfct100.pp.in">dimamgwfct100.pp.in</a> << EOF</div><div>&inputPP</div><div>   prefix ='dimamgwfct100'</div><div>   outdir='/home/olubi/Downloads/espresso-5.2.1/examples/Daddy_Final/OUTPUT',</div><div>   plot_num=11</div><div>   filplot = 'dimamgwfct100.pot'</div><div>/</div><div> </div><div>&plot</div><div>   iflag=3,</div><div>   output_format=5</div><div>/ </div><div>EOF</div><div>$ECHO "  running pp.x to obtain 3D potential file ...\c"</div><div>$PP_COMMAND < <a href="http://dimamgwfct100.pp.in">dimamgwfct100.pp.in</a> > dimamgwfct100.pp.out</div><div>$ECHO " done"</div><div><br></div><div># calculating macroscopic averages of Au(100)</div><div>cat > <a href="http://dimamgwfct100.avg.in">dimamgwfct100.avg.in</a> <<EOF</div><div>1</div><div>dimamgwfct100.pot</div><div>1.D0</div><div>1440</div><div>3</div><div>8.275</div><div>EOF</div><div>$ECHO "  Obtaining 1D macroscopic average of potential ...\c"</div><div>$AVG_COMMAND < <a href="http://dimamgwfct100.avg.in">dimamgwfct100.avg.in</a> > dimamgwfct100.avg.out</div><div>$ECHO " done"</div><div><br></div><div><br></div><div><br></div><div><br></div><div># post-processing for potential</div><div>cat > <a href="http://dimamgwfct.bulkref.pp.in">dimamgwfct.bulkref.pp.in</a> << EOF</div><div>&inputPP</div><div>   prefix='dimamgwfct',</div><div>   outdir='/home/olubi/Downloads/espresso-5.2.1/examples/Daddy_Final/OUTPUT',</div><div>   plot_num=11</div><div>   filplot = 'dimamgwfctbulkrefpot'</div><div>/</div><div> </div><div>&plot</div><div>   iflag=3,</div><div>   output_format=5</div><div>/ </div><div>EOF</div><div>$ECHO "  running pp.x to obtain 3D Bulk potential file ...\c"</div><div>$PP_COMMAND < <a href="http://dimamgwfct.bulkref.pp.in">dimamgwfct.bulkref.pp.in</a> > dimamgwfct.bulkref.pp.out</div><div>$ECHO " done"</div><div><br></div><div># calculating macroscopic averages of Au(100)</div><div>cat > <a href="http://dimamgwfct.bulkref.avg.in">dimamgwfct.bulkref.avg.in</a> <<EOF</div><div>1</div><div>dimamgwfctbulkrefpot</div><div>1.D0</div><div>300</div><div>3</div><div>16.550</div><div>EOF</div><div>$ECHO "  Obtaining 1D macroscopic average of bulk potential ...\c"</div><div>$AVG_COMMAND < <a href="http://dimamgwfct.bulkref.avg.in">dimamgwfct.bulkref.avg.in</a> > dimamgwfct.bulkref.avg.out</div><div>$ECHO " done"</div><div><br></div><div># Extract the Fermi energies and V references</div><div># script written specific to this example</div><div>eFermiSlab=`grep "Fermi" dimamgwfct100.out | cut -d  \  -f 13`</div><div>eFermiBulk=`grep "Fermi" dimamgwfct.out | cut -d  \  -f 14`</div><div>vVac=`grep "0.000000000" dimamgwfct100.avg.out | cut -d  \  -f 13`</div><div>vBulk=`grep "0.000000000" dimamgwfct.bulkref.avg.out | cut -d  \  -f 12`</div><div>vSlab=`grep "17.8087" dimamgwfct100.avg.out | cut -d \  -f 10`</div><div><br></div><div>vVac=`awk "BEGIN{print $vVac*13.6058}"`</div><div>vBulk=`awk "BEGIN{print $vBulk*13.6058}"`</div><div>vSlab=`awk "BEGIN{print $vSlab*13.6058}"`</div><div>eFermiBulk=`awk "BEGIN{print $eFermiBulk-$vBulk+$vSlab}"`</div><div><br></div><div>wf1=`awk "BEGIN{ print $vVac-$eFermiSlab }"`</div><div>wf2=`awk "BEGIN{ print $vVac-$eFermiBulk }"`</div><div><br></div><div>$ECHO "  Writing work function results to file ...\c"</div><div>cat> dimamgwfct100.wf.data <<EOF</div><div><br></div><div>The work function calculated without a bulk reference:</div><div>WF = $wf1</div><div><br></div><div>The work function calculated with a bulk reference:</div><div>WF = $wf2</div></div><div><br></div><div><b>Beginning of .pot file for 100 plane</b></div><div><div style="font-weight:bold">                                                                          </div><div><b>   </b>  108     108     180     108     108     180      24       5</div><div>     0       16.56632194      0.00000000      0.00000000      0.00000000      0.00000000      0.00000000</div><div>   1.0000000000000000        0.0000000000000000        0.0000000000000000     </div><div>   6.4029979969246658E-003   1.0012548879144743        0.0000000000000000     </div><div>   0.0000000000000000        0.0000000000000000        1.7110324279189459     </div><div>     2641.6547294604       10.8571428571       35.0000000000    11</div><div>   1   C     4.00</div><div>   2   H     1.00</div><div>   3   I     7.00</div><div>   4   Mg   10.00</div><div>   5   N     5.00</div><div>   1       0.509446389    0.492791623    0.559742015    4</div><div>   2       0.000000000    0.000000000    0.570328173    4</div><div>   3       0.517505566    0.176633377    0.093958779    2</div><div>   4       0.018171426    0.679787989    0.097724419    2</div><div>   5       0.854528498    0.480455162    0.103852995    2</div><div>   6       0.349779862    0.989036575    0.114808565    2</div><div>   7       0.166146347    0.546420838    0.144634598    2</div><div>   8       0.661852101    0.041923744    0.145261691    2</div><div>   9       0.988793462    0.358947875    0.161627203    2</div><div>  10       0.484600377    0.862298732    0.162253099    2</div><div>  11       0.888630990    0.455043313    0.290316005    2</div><div>  12       0.562918800    0.146959186    0.290695854    2</div><div>  13       0.064245898    0.644756083    0.292677230    2</div><div>  14       0.393784563    0.958653495    0.297471543    2</div><div>  15       0.552496026    0.092107640    0.179069810    1</div><div>  16       0.055514153    0.592927125    0.179435971    1</div><div>  17       0.026514550    0.068546010    0.161380643    3</div><div>  18       0.531207221    0.573453718    0.174855537    3</div><div>  19       0.256175753    0.322402071    0.507168833    3</div><div>  20       0.756971120    0.827856565    0.512503832    3</div><div>  21       0.776690460    0.324701954    0.528825370    3</div><div>  22       0.268965400    0.830871344    0.530952184    3</div><div>  23       0.940804551    0.466077142    0.183667354    5</div><div>  24       0.440613929    0.970125873    0.188324784    5</div><div>  1.415127205E-01  1.347532799E-01  1.305030460E-01  1.287659848E-01  1.298591029E-01</div><div>  1.333791453E-01  1.392880613E-01  1.470437818E-01  1.564614200E-01  1.669733143E-01</div><div>  1.777375645E-01  1.880961363E-01  1.973804007E-01  2.055579590E-01  2.125306063E-01</div><div>  2.178967766E-01  2.210074106E-01  2.221449231E-01  2.217231800E-01  2.192275589E-01</div><div>  2.144537984E-01  2.082230048E-01  2.004408793E-01  1.905480500E-01  1.795190825E-01</div><div>  1.671962050E-01  1.534814663E-01  1.390224134E-01  1.235112250E-01  1.075527514E-01</div><div>  9.170726503E-02  7.583614901E-02  6.063869359E-02  4.709593615E-02  3.514292447E-02</div><div>  2.535448869E-02  1.815724328E-02  1.391586871E-02  1.258371196E-02  1.389578594E-02</div><div>  1.724471024E-02  2.206644009E-02  2.821602286E-02  3.472444824E-02  4.158982829E-02</div><div>  4.826227726E-02  5.447876693E-02  6.036251552E-02  6.570012448E-02  7.054588553E-02</div><div>  7.513853907E-02  7.962830803E-02  8.388374239E-02  8.809028382E-02  9.251305549E-02</div><div>  9.677266008E-02  1.010125143E-01  1.053647068E-01  1.098528852E-01  1.145482262E-01</div><div>  1.191882612E-01  1.237267573E-01  1.280837445E-01  1.324842332E-01  1.363557622E-01</div><div>  1.400385316E-01  1.438081943E-01  1.469971836E-01  1.497889726E-01  1.527298525E-01</div><div>  1.554276431E-01  1.582134984E-01  1.616132194E-01  1.649098844E-01  1.685866851E-01</div><div>  1.729056002E-01  1.775426920E-01  1.824219170E-01  1.875415421E-01  1.932178687E-01</div><div>  1.990137612E-01  2.048709822E-01  2.108276541E-01  2.166000721E-01  2.224284842E-01</div><div>  2.279999730E-01  2.333910665E-01  2.385298781E-01  2.431493846E-01  2.472800073E-01</div><div>  2.507567595E-01  2.535854524E-01  2.557091723E-01  2.566494690E-01  2.566150212E-01</div><div>  2.555354401E-01  2.529597318E-01  2.488992424E-01  2.437647244E-01  2.369945626E-01</div><div>  2.283131095E-01  2.187532513E-01  2.082371910E-01  1.969285544E-01  1.847097202E-01</div><div>  1.724153245E-01  1.607082240E-01  1.502579117E-01  1.231365331E-01  1.154593472E-01</div><div>  1.106165764E-01  1.086943409E-01  1.100573532E-01  1.142992010E-01  1.212255777E-01</div><div>  1.303653510E-01  1.411454091E-01  1.530886415E-01  1.656875052E-01  1.780964551E-01</div><div>  1.893617938E-01  1.990255821E-01  2.072334631E-01  2.140617365E-01  2.186249443E-01</div><div>  2.206807154E-01  2.208689688E-01  2.192202182E-01  2.151512212E-01  2.093134032E-01</div><div>  2.019863278E-01  1.925004493E-01  1.816798480E-01  1.696729593E-01  1.561837353E-01</div><div>  1.419386704E-01  1.268464510E-01  1.111037951E-01  9.549278522E-02  7.993228911E-02</div><div>  6.496672248E-02  5.163172532E-02  3.991031977E-02  3.032003768E-02  2.310359248E-02</div><div>  1.885139871E-02  1.741204725E-02  1.835145502E-02  2.134731340E-02  2.576121267E-02</div></div><div><br></div><div><br></div><div><b>Beginning of average.out file for 100 plane</b></div><div><br></div><div><div><br></div><div>     Program AVERAGE v.5.2.0 starts on 16Aug2017 at  7:45:38 </div><div><br></div><div>     This program is part of the open-source Quantum ESPRESSO suite</div><div>     for quantum simulation of materials; please cite</div><div>         "P. Giannozzi et al., J. Phys.:Condens. Matter 21 395502 (2009);</div><div>          URL <a href="http://www.quantum-espresso.org">http://www.quantum-espresso.org</a>", </div><div>     in publications or presentations arising from this work. More details at</div><div>     <a href="http://www.quantum-espresso.org/quote">http://www.quantum-espresso.org/quote</a></div><div><br></div><div>     Serial version</div><div>     Reading header from file  dimamgwfct100.pot</div><div><br></div><div>   Info: using nr1, nr2, nr3 values from input</div><div><br></div><div>   Info: using nr1, nr2, nr3 values from input</div><div><br></div><div>     G-vector sticks info</div><div>     --------------------</div><div>     sticks:   dense  smooth     PW     G-vecs:    dense   smooth      PW</div><div>     Sum        8313    3065    811               974319   217831   29897</div><div>     Tot        4157    1533    406</div><div><br></div><div>     Reading data from file  dimamgwfct100.pot</div><div>    0.000000000    0.172782172   -0.025560735</div><div>    0.019684385    0.171748303   -0.026270885</div><div>    0.039368770    0.170682342   -0.026963219</div><div>    0.059053154    0.169583283   -0.027638382</div><div>    0.078737539    0.168450060   -0.028296998</div><div>    0.098421924    0.167281545   -0.028939673</div><div>    0.118106309    0.166076557   -0.029566990</div><div>    0.137790693    0.164833865   -0.030179510</div><div>    0.157475078    0.163552198   -0.030777774</div><div>    0.177159463    0.162230257   -0.031362300</div><div>    0.196843848    0.160866723   -0.031933586</div><div>    0.216528232    0.159460268   -0.032492113</div><div>    0.236212617    0.158009563   -0.033038343</div><div>    0.255897002    0.156513281   -0.033572724</div><div>    0.275581387    0.154970104   -0.034095690</div><div>    0.295265771    0.153378712   -0.034607659</div><div>    0.314950156    0.151737781   -0.035109038</div><div>    0.334634541    0.150045973   -0.035600222</div><div>    0.354318926    0.148301910   -0.036081593</div><div>    0.374003310    0.146504157   -0.036553519</div><div>    0.393687695    0.144651196   -0.037016356</div><div>    0.413372080    0.142741385   -0.037470448</div><div>    0.433056465    0.140772932   -0.037916123</div><div>    0.452740849    0.138743846   -0.038353692</div><div>    0.472425234    0.136651908   -0.038783453</div><div>    0.492109619    0.134494624   -0.039205686</div><div>    0.511794004    0.132269190   -0.039620654</div><div>    0.531478388    0.129972467   -0.040028602</div><div>    0.551162773    0.127600953   -0.040429756</div><div>    0.570847158    0.125150771   -0.040824323</div><div>    0.590531543    0.122617671   -0.041212494</div><div>    0.610215927    0.119997041   -0.041594439</div><div>    0.629900312    0.117283936   -0.041970309</div><div>    0.649584697    0.114473118   -0.042340240</div><div>    0.669269082    0.111559115   -0.042704348</div><div>    0.688953467    0.108536289   -0.043062733</div><div>    0.708637851    0.105398910   -0.043415480</div><div>    0.728322236    0.102141246   -0.043762661</div><div>    0.748006621    0.098757646   -0.044104334</div><div>    0.767691006    0.095242631   -0.044440544</div><div>    0.787375390    0.091590975   -0.044771329</div><div>    0.807059775    0.087797782   -0.045096717</div><div>    0.826744160    0.083858555   -0.045416729</div><div>    0.846428545    0.079769249   -0.045731383</div><div>    0.866112929    0.075526321   -0.046040689</div><div>    0.885797314    0.071126760   -0.046344658</div><div>    0.905481699    0.066568110   -0.046643295</div><div>    0.925166084    0.061848484   -0.046936608</div><div>    0.944850468    0.056966572   -0.047224602</div><div>    0.964534853    0.051921634   -0.047507283</div></div><div><br></div><div>Kindest Regards,</div><div>Praise Olutuase</div><div>Post Graduate Student,</div><div>University of Ibadan NIgeria.</div></div>