# Non-constant Vacuum potential

I relaxed Na2S2 molecule in QuantumEspresso and plotted the planar average of potential energy across z axis so as to find the Vacuum potential. This is the output I got : As you can see the vacuum potential is not constant making it impossible to calculate it. While following the same procedure for Na2S I got the following: as you can see the vacuum potential is a constant value. What could be a reason for what happened in the case of Na2S2? How can I solve it ?

Thank you!

The input file for the geometry optimization of Na2S2:

&CONTROL
calculation='relax'
title='graphene'
prefix='graphene'
restart_mode='from_scratch'
outdir='../tmp'
wf_collect=.true.
pseudo_dir='~/work/pot/'
/
&SYSTEM
ibrav = 4,
a = 14.58 ,
c= 20,
nat = 4
ntyp = 2
vdw_corr = 'dft-d3'
ecutwfc = 50.0 ,
ecutrho = 250.0 ,
occupations='smearing'
smearing='gaussian'
degauss=0.001
nbnd=30
/
&ELECTRONS
electron_maxstep = 200,
conv_thr = 1.0d-10 ,
/
&IONS
ion_dynamics = 'bfgs'
/

ATOMIC_SPECIES
Na 22.989 Na.pbe-spnl-kjpaw_psl.1.0.0.UPF
S 32.065 S.pbe-n-kjpaw_psl.1.0.0.UPF

ATOMIC_POSITIONS (angstrom)
Na           -2.1578688813       -0.0711007913        0.0959862818
S             0.0279507567        0.7976264059        1.1138133631
S            -1.4993815540        2.3462755509        0.6717950344
Na            0.8998813708        2.9052562024       -0.0587466613

K_POINTS automatic
2 2 1 0 0 0

• I have no experience with QE but you might want to add a dipole correction: quantum-espresso.org/Doc/INPUT_PW.html#dipfield May 18 at 6:10
• @Fabian Thank you sooo much. That got me somewhere to start. when I add dipole correction gave me two vacuum potentials. From reading, this usually refers to difference in work function at different sides of slabs(Hope I am right!). But I have a chose quite a large unit cell and its a small molecule, will it have a dipole interaction? May 21 at 17:45
• I agree with @Fabian that this looks like a dipole interaction. Why not do some charge decomposition and see what the classical electrostatic field looks like? Remember that you are simulating an infinitely periodic set of molecules, so the field is not the same as from an isolated molecule. Jun 20 at 12:40

As mentioned by Phil Hasnip in the comments, placing a $$\mathrm{Na_2S_2}$$ molecule under periodic boundary conditions is akin to simulating a 3d array of these molecules. If the molecule has a nonzero dipole moment, this give rise to an electric (dipole) field between adjacent 2d "planes" of molecules. Unless you take care to orient the dipole of your molecule along a specific cartesian axis, it can point in any direction of the cell. I.e. the effect you are seeing along the z direction may as well exist along x and y with different magnitudes proportional to the component of the molecular dipole in that direction.