Ejemplo n.º 1
0
def test_kinetic_h2o_nuclei():
    # test against multiwfn 3.6 dev src
    with path('chemtools.data', 'data_multiwfn36_fchk_h2o_q+0_ub3lyp_ccpvtz.npz') as fname:
        data = np.load(str(fname))
    tool = KED(data['nuc_dens'], data['nuc_grad'], data['nuc_lap'], data['nuc_ked_pd'])
    # check attributes
    assert_allclose(tool.density, data['nuc_dens'], rtol=1.e-6, atol=0.)
    assert_allclose(tool.gradient, data['nuc_grad'], rtol=1.e-6, atol=0.)
    assert_allclose(tool.laplacian, data['nuc_lap'], rtol=1.e-6, atol=0.)
    # check ked at the position of nuclei
    assert_allclose(tool.ked_positive_definite, data['nuc_ked_pd'], rtol=1.e-5, atol=0.)
    assert_allclose(tool.ked_hamiltonian, data['nuc_ked_ham'], rtol=1.e-5, atol=0.)
    assert_allclose(tool.ked_general(alpha=0.), data['nuc_ked_ham'], rtol=1.e-5, atol=0.)
Ejemplo n.º 2
0
def test_kinetic_from_molecule_ch4_uhf_ccpvdz():
    # load data computed with Fortran code
    with path("chemtools.data", "data_fortran_ch4_uhf_ccpvdz.npz") as fname:
        data = np.load(str(fname))
    # test from_molecule initialization with exp_beta & check against Fortran code
    with path("chemtools.data", "ch4_uhf_ccpvdz.fchk") as fname:
        molecule = Molecule.from_file(fname)
    tool = KED.from_molecule(molecule, data['points'])
    print('tool = ', tool)
    check_kinetic_energy_density(tool, data)
    # test from_molecule initialization without exp_beta & check against Fortran code
    del molecule._exp_beta
    with path("chemtools.data", "ch4_uhf_ccpvdz.fchk") as fname:
        molecule = Molecule.from_file(fname)
    tool = KED.from_molecule(molecule, data['points'])
    check_kinetic_energy_density(tool, data)
Ejemplo n.º 3
0
def test_kinetic_from_file_ch4_rhf_ccpvdz():
    # load data computed with Fortran code
    with path("chemtools.data", "data_fortran_ch4_uhf_ccpvdz.npz") as fname:
        data = np.load(str(fname))
    # test from_file initialization & check against Fortran code
    with path("chemtools.data", "ch4_uhf_ccpvdz.fchk") as fname:
        tool = KED.from_file(fname, data['points'])
    check_kinetic_energy_density(tool, data)
Ejemplo n.º 4
0
def test_kinetic_raises_ked_h2o_nuclei():
    # test against multiwfn 3.6 dev src
    with path('chemtools.data', 'data_multiwfn36_fchk_h2o_q+0_ub3lyp_ccpvtz.npz') as fname:
        data = np.load(str(fname))
    tool = KED(data['nuc_dens'], data['nuc_grad'], data['nuc_lap'], None)
    # check attributes
    assert_allclose(tool.density, data['nuc_dens'], rtol=1.e-6, atol=0.)
    assert_allclose(tool.gradient, data['nuc_grad'], rtol=1.e-6, atol=0.)
    assert_raises(ValueError, lambda: tool.ked_positive_definite)
    assert_raises(ValueError, lambda: tool.ked_hamiltonian)
    assert_raises(ValueError, tool.ked_general, 1.0)