3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-22 12:23:41 +01:00

Added a test suite for ProjectorGroup class

A preliminary test suite for class 'ProjectorGroup' was added.
Currently, only a simplest test is performed testing that
after the input is processed the resulting projectors selected
within a given energy window are corret.
This commit is contained in:
Oleg E. Peil 2015-02-19 17:29:50 +01:00 committed by Michel Ferrero
parent 9bbd71afb9
commit a0e9d1a18e
2 changed files with 170 additions and 0 deletions

View File

@ -0,0 +1,115 @@
pars: {'normalize': True, 'index': '1', 'emin': -15.0, 'emax': 5.0, 'normion': False, 'shells': [0]}
3 8
1 (2.5198055198e-08+0j)
2 (2.51956215891e-08+0j)
3 (-1.39707700703e-12+0j)
4 (2.51956464581e-08+0j)
5 (-9.58669992349e-14+0j)
1 (0.423249542713+0j)
2 (0.441459685564+0j)
3 (5.45383349593e-10+0j)
4 (0.441459536552+0j)
5 (-5.07696386694e-15+0j)
1 (-0.624317586422+0j)
2 (0.299283236265+0j)
3 (3.00651912255e-08+0j)
4 (0.299281418324+0j)
5 (-5.44629513472e-14+0j)
1 (-2.9753928743e-07+0j)
2 (-0.495364636183+0j)
3 (1.61749496311e-14+0j)
4 (0.495365083218+0j)
5 (2.86656725024e-08+0j)
1 (2.31630860326e-12+0j)
2 (-2.07712407274e-08+0j)
3 (6.79555596435e-05+0j)
4 (2.07689296872e-08+0j)
5 (-0.686951518059+0j)
1 (-2.55608547661e-08+0j)
2 (1.27339729872e-08+0j)
3 (-0.749936163425+0j)
4 (1.27377095538e-08+0j)
5 (-6.18639533059e-05+0j)
3 8
1 (-7.42354511196e-10+0j)
2 (-0.407458901405+0j)
3 (-0.132825627923+0j)
4 (-1.12258624618e-09+0j)
5 (0.230060741305+0j)
1 (-0.529840826988+0j)
2 (1.02242869726e-09+0j)
3 (1.47169805231e-08+0j)
4 (0.529840826988+0j)
5 (8.58095106082e-09+0j)
1 (-5.59593660299e-09+0j)
2 (-0.46026712656+0j)
3 (-0.189698129892+0j)
4 (-3.64733043767e-09+0j)
5 (0.328566819429+0j)
1 (-5.92653073284e-08+0j)
2 (-0.511403858662+0j)
3 (0.342116594315+0j)
4 (-5.81566510505e-08+0j)
5 (-0.592563331127+0j)
1 (9.17969966707e-09+0j)
2 (3.7528921637e-10+0j)
3 (0.743389487267+0j)
4 (-7.80711495452e-09+0j)
5 (0.429196119308+0j)
1 (-0.60352396965+0j)
2 (5.06060757743e-07+0j)
3 (1.02901012156e-07+0j)
4 (-0.60352396965+0j)
5 (-1.76288821763e-07+0j)
3 7
1 (-0.157831609249+0j)
2 (0.157831639051+0j)
3 (1.93573299612e-08+0j)
4 (0.157831639051+0j)
5 (5.40782289825e-14+0j)
1 (-1.07380124348e-07+0j)
2 (-0.227066069841+0j)
3 (-1.22580686934e-07+0j)
4 (0.227065965533+0j)
5 (0.299297988415+0j)
1 (0.115845791996+0j)
2 (0.057922616601+0j)
3 (0.13223952055+0j)
4 (0.0579231306911+0j)
5 (3.36705625159e-07+0j)
1 (0.159106343985+0j)
2 (0.0795532241464+0j)
3 (-0.240490317345+0j)
4 (0.0795530825853+0j)
5 (1.18692518924e-07+0j)
1 (3.98122104173e-08+0j)
2 (-0.241537705064+0j)
3 (-6.01558127755e-08+0j)
4 (0.241537734866+0j)
5 (-0.421558618546+0j)
3 7
1 (7.91286647317e-10+0j)
2 (3.03037844818e-10+0j)
3 (0.204362645745+0j)
4 (4.89190632447e-10+0j)
5 (-0.353966474533+0j)
1 (9.13699960137e-09+0j)
2 (1.0438577086e-10+0j)
3 (-0.42577791214+0j)
4 (-6.95880419954e-09+0j)
5 (-0.245822981+0j)
1 (0.368288576603+0j)
2 (1.67113629601e-08+0j)
3 (-1.44080747333e-10+0j)
4 (0.365979760885+0j)
5 (1.25375620996e-09+0j)
1 (0.365983724594+0j)
2 (-2.74820233237e-09+0j)
3 (1.77222470032e-09+0j)
4 (-0.368292748928+0j)
5 (7.90098320103e-10+0j)
1 (-3.99936368467e-08+0j)
2 (0.546248733997+0j)
3 (-2.91795543284e-09+0j)
4 (-2.16134438347e-07+0j)
5 (1.55786352707e-08+0j)

View File

@ -0,0 +1,55 @@
import numpy as np
import vaspio
from inpconf import ConfigParameters
from plotools import ProjectorShell, ProjectorGroup
import mytest
################################################################################
#
# TestProjectorGroup
#
################################################################################
class TestProjectorGroup(mytest.MyTestCase):
"""
Class:
ProjectorGroup(sh_pars, proj_raw)
Scenarios:
- compare output for a correct input
"""
# Scenario 1
def test_example(self):
conf_file = 'example.cfg'
pars = ConfigParameters(conf_file)
pars.parse_input()
print pars.groups
vasp_data = vaspio.VaspData('./')
efermi = vasp_data.doscar.efermi
eigvals = vasp_data.eigenval.eigs - efermi
shells = [ProjectorShell(pars.shells[0], vasp_data.plocar.plo)]
proj_gr = ProjectorGroup(pars.groups[0], shells, eigvals)
# proj_sh.select_projectors(ib_win, nb_min, nb_max)
#
testout = 'projgroups.out.test'
nion, ns, nk, nbtot, nlm = proj_gr.shells[0].proj_win.shape
with open(testout, 'wt') as f:
f.write("pars: %s\n"%(pars.groups[0]))
for ion in xrange(nion):
for isp in xrange(ns):
for ik in xrange(nk):
ib1 = proj_gr.ib_win[ik, 0, 0]
ib2 = proj_gr.ib_win[ik, 0, 1]
f.write("%i %i\n"%(ib1, ib2))
for ib in xrange(ib2 - proj_gr.nb_min + 1):
for ilm in xrange(nlm):
p = proj_gr.shells[0].proj_win[ion, isp, ik, ib, ilm]
f.write("%5i %s\n"%(ilm+1, p))
expected_file = 'projgroups.out'
self.assertFileEqual(testout, expected_file)