-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ifilot/develop
Patch 0.6.3
- Loading branch information
Showing
8 changed files
with
81 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package: | ||
name: "pydft" | ||
version: "0.6.2" | ||
version: "0.6.3" | ||
|
||
source: | ||
path: . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '0.6.2' | ||
__version__ = '0.6.3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import unittest | ||
import numpy as np | ||
from pydft import MoleculeBuilder, DFT | ||
|
||
class TestNormalization(unittest.TestCase): | ||
""" | ||
Test whether normalization yields **exactly** the number of electrons of | ||
the system | ||
""" | ||
|
||
def test_helium(self): | ||
""" | ||
Test DFT calculation of Helium atom | ||
""" | ||
mol_builder = MoleculeBuilder() | ||
mol = mol_builder.from_name('He') | ||
Nelec = 2.0 | ||
|
||
# construct dft object | ||
dft = DFT(mol, basis='sto3g', normalize=False) | ||
dft.scf() | ||
nelec = dft.get_molgrid_copy().count_electrons() | ||
|
||
err_no_norm = np.abs(Nelec - nelec) | ||
|
||
# construct dft object | ||
dft = DFT(mol, basis='sto3g', normalize=True) | ||
dft.scf() | ||
nelec = dft.get_molgrid_copy().count_electrons() | ||
|
||
err_norm = np.abs(Nelec - nelec) | ||
self.assertTrue(err_norm < err_no_norm) | ||
np.testing.assert_almost_equal(nelec, Nelec, 8) | ||
|
||
def test_methane(self): | ||
""" | ||
Test DFT calculation of methane molecule | ||
""" | ||
mol_builder = MoleculeBuilder() | ||
mol = mol_builder.from_name('CH4') | ||
Nelec = 10.0 | ||
|
||
# construct dft object | ||
dft = DFT(mol, basis='sto3g', normalize=False) | ||
dft.scf() | ||
nelec = dft.get_molgrid_copy().count_electrons() | ||
|
||
err_no_norm = np.abs(Nelec - nelec) | ||
|
||
# construct dft object | ||
dft = DFT(mol, basis='sto3g', normalize=True) | ||
dft.scf() | ||
nelec = dft.get_molgrid_copy().count_electrons() | ||
|
||
err_norm = np.abs(Nelec - nelec) | ||
self.assertTrue(err_norm < err_no_norm) | ||
np.testing.assert_almost_equal(nelec, Nelec, 8) |