# [Pw_forum] Workfunction (reprise)

Stefano Baroni baroni at sissa.it
Wed Jul 21 14:04:47 CEST 2004

```Thank you, Carlo.
Beware, though, that extracting the "vacuum level" from the Kohn-Sham
potential (which includes xc) rather then from Hartree-only could be
numerically less efficient.

I think we should leave it to Aloysius as a useful exercise:

1) To understand why this is so.
2) To figure our how to extract the Hartree potential from the output
of a PWscf calculation.

Have fun!

Stefano B.

On Jul 21, 2004, at 9:40 AM, carlo sbraccia wrote:

> On Wed, 2004-07-21 at 07:45, Aloysius Soon Sze Lok wrote:
>> Dear Prof. Baroni,
>> You mentioned that the KS potential is calculated and used in the
>> code. Could
>> you please tell me how to extract it from the code at the middle of
>> the
>> vacuum?
>>
>> Many thanks, Sir.
>>
>>
>
> To extract the value of the KS potential in the middle of the vacuum
> you
>
> 1) do a self-consistent calculation for your system (this you probably
>
> 2) do a post-processing of output files with the pp.x code, setting
> plot_num = 1 (for the meaning of the this an other input variables see
> the file pwdoc/INPUT_PP)
>
> 3) compute the planar average of the KS potential using the code
> average.x (for the meaning of the input variables see the header of the
> source file PP/average.x).
>
> 4) plot the result and extract what you need (column 3 gives you an
> useful macroscopic average).
>
> Here are reported minimal templates for the input files:
>
> For pp.x code:
>
> &inputPP
>   prefix   = " ",
>   outdir   = " ",
>   filplot  = "example",
>   plot_num = 1,
> /
>
> For average.x code:
>
> 1
> example
> 1.D0
> 200
> 3
> 0.1D0
>
> carlo sbraccia
>
>
>
>
> _______________________________________________
> Pw_forum mailing list
> Pw_forum at pwscf.org
> http://www.democritos.it/mailman/listinfo/pw_forum
>
---
Stefano Baroni    ---  SISSA  &  DEMOCRITOS National Simulation Center
via Beirut 2-4 34014 Trieste Grignano / [+39] 040 3787 406 (tel) -528
(fax)

Please, if possible, don't  send me MS Word or PowerPoint attachments
Why? See:  http://www.gnu.org/philosophy/no-word-attachments.html

```