Exemple #1
0
def test_basic1():
    a1 = Atom("H", (0, 0, -1))
    a2 = Atom("H", (0, 0, 1))
    atoms = Atoms([a1, a2])
    abinit = Abinit(atoms)
    r = abinit.calculate()
    assert feq(r["header"]["etotal"], -1.0867972866345299, 1e-5)
    assert feq(r["header"]["fermie"], -0.3244132662537915, 1e-5)
    assert feq_array(r["wf"]["occ"], array([2., 0.]), 1e-10)
    assert not feq_array(r["wf"]["occ"], array([1., 1.]), 1e-10)
    assert feq_array(r["wf"]["eigen"], array([-0.32441327, -0.01348019]), 1e-5)
    assert not feq_array(r["wf"]["eigen"], array([-0.33441327, -0.01348019]),
            1e-5)
Exemple #2
0
def test_basic2():
    a1 = Atom("H", (0, 0, 0))
    a2 = Atom("H", (0, 0, 1))
    a3 = Atom("H", (1, 0, 1))
    atoms = Atoms([a1, a2, a3])
    abinit = Abinit(atoms)
    r = abinit.calculate()
    assert feq(r["header"]["etotal"], -1.26918021328, 1e-5)
    assert feq(r["header"]["fermie"], -0.091979753480, 1e-5)
    assert feq_array(r["wf"]["occ"], array([2., 1., 0.]), 1e-10)
    assert not feq_array(r["wf"]["occ"], array([1., 1., 1.]), 1e-10)
    assert feq_array(r["wf"]["eigen"], array([-0.8806383, -0.09197975,
        -0.08961579]), 1e-5)
    assert not feq_array(r["wf"]["eigen"], array([-0.8906383, -0.09197975,
        -0.08961579]), 1e-5)
Exemple #3
0
"""

from math import sqrt

from numpy import empty
from scipy.fftpack import fftn

from qsnake import Atom, Atoms
from qsnake.calculators import Abinit

atoms = Atoms([
    Atom("H", (0, 0, -1)),
    Atom("H", (0, 0, 1)),
    Atom("H", (0, 0.5, 0)),
    ])
abinit = Abinit(atoms)
result = abinit.calculate(verbose=True)
d = result["density"]

# convert the density to real space
d = abs(fftn(d))

# plot it:
max_value = d.max()
from pylab import imshow, grid, show, subplot, colorbar, title, clf
clf()
x_max = 30
i_max = int(sqrt(x_max))+1
j_max = int(sqrt(x_max))+1
for i in range(x_max):
    subplot(i_max, j_max, i+1)