本文整理汇总了Python中vasp.Vasp.get_local_potential方法的典型用法代码示例。如果您正苦于以下问题:Python Vasp.get_local_potential方法的具体用法?Python Vasp.get_local_potential怎么用?Python Vasp.get_local_potential使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vasp.Vasp
的用法示例。
在下文中一共展示了Vasp.get_local_potential方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Vasp
# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import get_local_potential [as 别名]
from vasp import Vasp
import matplotlib.pyplot as plt
calc = Vasp('surfaces/Al-Na-nodip')
atoms = calc.get_atoms()
x, y, z, lp = calc.get_local_potential()
nx, ny, nz = lp.shape
axy_1 = [np.average(lp[:, :, z]) for z in range(nz)]
# setup the x-axis in realspace
uc = atoms.get_cell()
xaxis_1 = np.linspace(0, uc[2][2], nz)
e1 = atoms.get_potential_energy()
calc = Vasp('surfaces/Al-Na-dip-step2')
atoms = calc.get_atoms()
x, y, z, lp = calc.get_local_potential()
nx, ny, nz = lp.shape
axy_2 = [np.average(lp[:, :, z]) for z in range(nz)]
# setup the x-axis in realspace
uc = atoms.get_cell()
xaxis_2 = np.linspace(0, uc[2][2], nz)
ef2 = calc.get_fermi_level()
e2 = atoms.get_potential_energy()
print 'The difference in energy is {0} eV.'.format(e2-e1)
plt.plot(xaxis_1, axy_1, label='no dipole correction')
plt.plot(xaxis_2, axy_2, label='dipole correction')
plt.plot([min(xaxis_2), max(xaxis_2)], [ef2, ef2], 'k:', label='Fermi level')
plt.xlabel('z ($\AA$)')
plt.ylabel('xy-averaged electrostatic potential')
plt.legend(loc='best')
plt.savefig('images/dip-vs-nodip-esp.png')