External potential¶
Examples¶
>>> # 2.5 eV/Ang along z:
>>> from gpaw.external import ConstantElectricField
>>> calc = GPAW(external=ConstantElectricField(2.5, [0, 0, 1]), ...)

class
gpaw.external.
ConstantElectricField
(strength, direction=[0, 0, 1], tolerance=1e07)[source]¶ External constant electric field.
 strength: float
 Field strength in V/Ang.
 direction: vector
 Polarisation direction.
>>> # Two pointcharges:
>>> from gpaw.external import PointChargePotential
>>> pc = PointChargePotential([1, 1], [[4.0, 4.0, 0.0], [4.0, 4.0, 10.0]])
>>> calc = GPAW(external=pc, ...)

class
gpaw.external.
PointChargePotential
(charges, positions=None, rc=0.2, rc2=inf, width=1.0)[source]¶ Pointcharge potential.
 charges: list of float
 Charges.
 positions: (N, 3)shaped arraylike of float
 Positions of charges in Angstrom. Can be set later.
 rc: float
 Inner cutoff for Coulomb potential in Angstrom.
 rc2: float
 Outer cutoff for Coulomb potential in Angstrom.
 width: float
 Width for cutoff function for Coulomb part.
For r < rc, 1 / r is replaced by a third order polynomial in r^2 that has matching value, first derivative, second derivative and integral.
For rc2  width < r < rc2, 1 / r is multiplied by a smooth cutoff function (a third order polynomium in r).
You can also give rc a negative value. In that case, this formula is used:
(r^4  rc^4) / (r^5  rc^5)
for all values of r  no cutoff at rc2!
Your own potential¶
See an example here: gpaw/test/ext_potential/harmonic.py.