本文整理汇总了Python中gpaw.xc.XC.get_xc_potential_and_energy_1d方法的典型用法代码示例。如果您正苦于以下问题:Python XC.get_xc_potential_and_energy_1d方法的具体用法?Python XC.get_xc_potential_and_energy_1d怎么用?Python XC.get_xc_potential_and_energy_1d使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gpaw.xc.XC
的用法示例。
在下文中一共展示了XC.get_xc_potential_and_energy_1d方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gpaw.xc import XC [as 别名]
# 或者: from gpaw.xc.XC import get_xc_potential_and_energy_1d [as 别名]
#.........这里部分代码省略.........
if fd is None:
self.initialize_wave_functions()
n[:] = self.calculate_density()
bar = '|------------------------------------------------|'
t(bar)
niter = 0
nitermax = 117
qOK = log(1e-10)
mix = 0.4
# orbital_free needs more iterations and coefficient
if self.orbital_free:
#qOK = log(1e-14)
e_j[0] /= self.tf_coeff
mix = 0.01
nitermax = 1000
vrold = None
while True:
# calculate hartree potential
hartree(0, n * r * dr, r, vHr)
# add potential from nuclear point charge (v = -Z / r)
vHr -= Z
# calculated exchange correlation potential and energy
self.vXC[:] = 0.0
if self.xc.type == 'GLLB':
# Update the potential to self.vXC an the energy to self.Exc
Exc = self.xc.get_xc_potential_and_energy_1d(self.vXC)
else:
Exc = self.xc.calculate_spherical(self.rgd,
n.reshape((1, -1)),
self.vXC.reshape((1, -1)))
# calculate new total Kohn-Sham effective potential and
# admix with old version
vr[:] = (vHr + self.vXC * r) / self.tf_coeff
if niter > 0:
vr[:] = mix * vr + (1 - mix) * vrold
vrold = vr.copy()
# solve Kohn-Sham equation and determine the density change
self.solve()
dn = self.calculate_density() - n
n += dn
# estimate error from the square of the density change integrated
q = log(np.sum((r * dn)**2))
# print progress bar
if niter == 0:
q0 = q
b0 = 0
else:
b = int((q0 - q) / (q0 - qOK) * 50)
if b > b0:
self.txt.write(bar[b0:min(b, 50)])
self.txt.flush()
b0 = b