Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions docs/electronic_structure_calculations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ the :meth:`pydft.DFT.scf` routine to start the self-consistent field calculation
Performing this calculation shows that the total electronic energy for this
system corresponds to::

Total electronic energy: -111.130470 Ht
Total electronic energy: -110.854614 Ht

Result dictionary
-----------------
Expand Down Expand Up @@ -112,17 +112,17 @@ electron-electron repulsion and exchange-correlation energy.

The above script yields the following output::

Total electronic energy: -111.130470 Ht
Total electronic energy: -110.854614 Ht

Kinetic energy: 110.217226 Ht
Nuclear attraction: -304.930911 Ht
Electron-electron repulsion: 75.612987 Ht
Exchange energy: -12.055233 Ht
Correlation energy: -1.232632 Ht
Exchange-correlation energy: -13.287865 Ht
Kinetic energy: 110.215413 Ht
Nuclear attraction: -304.926853 Ht
Electron-electron repulsion: 75.610445 Ht
Exchange energy: -12.054947 Ht
Correlation energy: -0.956764 Ht
Exchange-correlation energy: -13.011711 Ht
Nucleus-nucleus repulsion: 21.258092 Ht

Sum: -111.130470 Ht
Sum: -110.854614 Ht

Self-consistent field matrices
------------------------------
Expand Down Expand Up @@ -165,23 +165,23 @@ Executing the script above yields output like the following. The timings depend
on the machine and runtime environment::

001 | E = -179.237419 | dE = 0.0000e+00 | 0.0010 s
002 | E = -106.662588 | dE = 0.0000e+00 | 1.2765 s
003 | E = -117.641796 | dE = 7.2575e+01 | 0.0172 s
004 | E = -107.190988 | dE = 1.0979e+01 | 0.0201 s
005 | E = -117.376118 | dE = 1.0451e+01 | 0.0203 s
006 | E = -117.085797 | dE = 1.0185e+01 | 0.0160 s
007 | E = -108.013652 | dE = 2.9032e-01 | 0.0149 s
008 | E = -107.421366 | dE = 9.0721e+00 | 0.0143 s
009 | E = -110.457951 | dE = 5.9229e-01 | 0.0151 s
010 | E = -110.419024 | dE = 3.0366e+00 | 0.0176 s
011 | E = -109.548780 | dE = 3.8927e-02 | 0.0159 s
012 | E = -111.008079 | dE = 8.7024e-01 | 0.0159 s
013 | E = -111.118875 | dE = 1.4593e+00 | 0.0163 s
014 | E = -111.130700 | dE = 1.1080e-01 | 0.0162 s
015 | E = -111.130454 | dE = 1.1825e-02 | 0.0210 s
016 | E = -111.130470 | dE = 2.4610e-04 | 0.0258 s
017 | E = -111.130470 | dE = 1.6288e-05 | 0.0188 s
018 | E = -111.130470 | dE = 9.2335e-08 | 0.0158 s
002 | E = -106.382130 | dE = 0.0000e+00 | 0.5628 s
003 | E = -117.367416 | dE = 7.2855e+01 | 0.0187 s
004 | E = -106.912634 | dE = 1.0985e+01 | 0.0157 s
005 | E = -117.101972 | dE = 1.0455e+01 | 0.0153 s
006 | E = -116.811360 | dE = 1.0189e+01 | 0.0157 s
007 | E = -107.735924 | dE = 2.9061e-01 | 0.0177 s
008 | E = -107.142887 | dE = 9.0754e+00 | 0.0206 s
009 | E = -110.184408 | dE = 5.9304e-01 | 0.0153 s
010 | E = -110.142428 | dE = 3.0415e+00 | 0.0180 s
011 | E = -109.287578 | dE = 4.1979e-02 | 0.0226 s
012 | E = -110.733835 | dE = 8.5485e-01 | 0.0187 s
013 | E = -110.843185 | dE = 1.4463e+00 | 0.0231 s
014 | E = -110.854814 | dE = 1.0935e-01 | 0.0183 s
015 | E = -110.854598 | dE = 1.1628e-02 | 0.0193 s
016 | E = -110.854614 | dE = 2.1610e-04 | 0.0159 s
017 | E = -110.854614 | dE = 1.6018e-05 | 0.0182 s
018 | E = -110.854614 | dE = 9.5061e-08 | 0.0175 s
Stopping SCF cycle, convergence reached.

Each line corresponds to one update of the density matrix. Internally, PyDFT
Expand All @@ -204,8 +204,8 @@ argument when constructing the :class:`pydft.DFT` object:
which yields the following total electronic energies for the :code:`SVWN5` and
:code:`PBE` :cite:p:`pbe:1996` exchange-correlation functions::

SVWN: -111.13047044798054 Ht
PBE: -111.64036457334683 Ht
SVWN: -110.85461362334834 Ht
PBE: -111.64036457334686 Ht

Tuning the numerical accuracy
-----------------------------
Expand Down
2 changes: 1 addition & 1 deletion pydft/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Package version exposed by :mod:`pydft`."""

__version__ = "1.0.0"
__version__ = "1.1.0"
12 changes: 6 additions & 6 deletions pydft/xcfunctionals.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ def __vwn5(self, dens):
# but is correct in the original paper of Vosko, Wilk and Nusair
# https://cdnsciencepub.com/doi/pdf/10.1139/p80-159
A = 0.0621814
x0 = -0.409286
b = 13.0720
c = 42.7198
x0 = -0.10498
b = 3.72744
c = 12.9352

rs = (3. / 4. / np.pi / dens)**(1./3.)

Expand All @@ -163,9 +163,9 @@ def __vwn5_deriv(self, dens):
Derivative of the VWN5 correlation functional towards the density
"""
A = 0.0621814
x0 = -0.409286
b = 13.0720
c = 42.7198
x0 = -0.10498
b = 3.72744
c = 12.9352
X0 = x0**2 + b * x0 + c
Q = (4 * c - b**2)**(1/2)

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ requires = ["setuptools>=61"]
build-backend = "setuptools.build_meta"

[project]
name = "pydft"
version = "1.0.0"
name = "pydft"
version = "1.1.0"
authors = [
{ name="Ivo Filot", email="ivo@ivofilot.nl" }
]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_custom_basisset.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_h2(self):
dft = DFT(mol, basis=cgfs)
res = dft.scf()

answer = -1.1562627795279132
answer = -1.1204764001484104
np.testing.assert_almost_equal(res['energy'], answer, 4)

if __name__ == '__main__':
Expand Down
20 changes: 10 additions & 10 deletions tests/test_dft.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_helium(self):
with self.assertLogs('pydft.dft', level='INFO') as logs:
res = dft.scf(verbose=True)

answer = -2.8081735181814724
answer = -2.7704595622068138
np.testing.assert_almost_equal(res['energy'], answer, 4)
self.assertTrue(any('| E =' in msg for msg in logs.output))

Expand Down Expand Up @@ -50,7 +50,7 @@ def test_h2o(self):
dft = DFT(mol, basis='sto3g')
res = dft.scf()

answer = -74.92583960745394
answer = -74.72985279614994
np.testing.assert_almost_equal(res['energy'], answer, 4)

def test_co(self):
Expand All @@ -64,7 +64,7 @@ def test_co(self):
dft = DFT(mol, basis='sto3g')
res = dft.scf()

answer = -111.1305117481223
answer = -110.85461362334834
np.testing.assert_almost_equal(res['energy'], answer, 4)

def test_bf3(self):
Expand All @@ -78,7 +78,7 @@ def test_bf3(self):
dft = DFT(mol, basis='sto3g')
res = dft.scf()

answer = -318.19442532820096
answer = -317.55352572879667
np.testing.assert_almost_equal(res['energy'], answer, 4)

def test_ch4(self):
Expand All @@ -92,7 +92,7 @@ def test_ch4(self):
dft = DFT(mol, basis='sto3g')
res = dft.scf()

answer = -39.790602071993334
answer = -39.60074741004088
np.testing.assert_almost_equal(res['energy'], answer, 4)

def test_co2(self):
Expand All @@ -106,7 +106,7 @@ def test_co2(self):
dft = DFT(mol, basis='sto3g')
res = dft.scf()

answer = -184.97691522055553
answer = -184.5409746994328
np.testing.assert_almost_equal(res['energy'], answer, 4)

def test_ethylene(self):
Expand All @@ -120,7 +120,7 @@ def test_ethylene(self):
dft = DFT(mol, basis='sto3g')
res = dft.scf()

answer = -77.13648424441982
answer = -76.82946120370394
np.testing.assert_almost_equal(res['energy'], answer, 4)

def test_h2(self):
Expand All @@ -134,7 +134,7 @@ def test_h2(self):
dft = DFT(mol, basis='sto3g')
res = dft.scf()

answer = -1.1562627795279132
answer = -1.1204764001484104
np.testing.assert_almost_equal(res['energy'], answer, 4)

def test_lih(self):
Expand All @@ -148,7 +148,7 @@ def test_lih(self):
dft = DFT(mol, basis='sto3g')
res = dft.scf()

answer = -7.862755794011036
answer = -7.789199497213202
np.testing.assert_almost_equal(res['energy'], answer, 4)

def test_benzene(self):
Expand All @@ -162,7 +162,7 @@ def test_benzene(self):
dft = DFT(mol, basis='sto3g')
res = dft.scf()

answer = -227.9563844056453
answer = -227.14299165089105
np.testing.assert_almost_equal(res['energy'], answer, 4)

def test_scalar_grid_settings(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_finite_difference_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_co(self):
mol_builder = MoleculeBuilder()
mol = mol_builder.from_name('CO')

answers = [-110.8427, -111.1378, -111.1305, -111.1437, -111.1475, -111.1348]
answers = [-110.5669, -110.8619, -110.8546, -110.8678, -110.8716, -110.8589]

res = []
for fdpts in [3,5,7,9,11,13]:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_xc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_svwn5(self):
dft = DFT(mol, basis='sto3g', functional='svwn5')
res = dft.scf()

answer = -2.8081735181814724
answer = -2.7704595622068138
np.testing.assert_almost_equal(res['energy'], answer, 4)

def test_pbe(self):
Expand Down
Loading