Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
gpaw
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
89
Issues
89
List
Boards
Labels
Service Desk
Milestones
Merge Requests
47
Merge Requests
47
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gpaw
gpaw
Commits
015a7dee
Commit
015a7dee
authored
Dec 02, 2019
by
Jens Jørgen Mortensen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up tests
parent
c495bf3b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
122 deletions
+15
-122
gpaw/test/__init__.py
gpaw/test/__init__.py
+3
-0
gpaw/test/exx/h.py
gpaw/test/exx/h.py
+0
-70
gpaw/test/exx/k.py
gpaw/test/exx/k.py
+0
-24
gpaw/test/exx/kpts.py
gpaw/test/exx/kpts.py
+12
-28
No files found.
gpaw/test/__init__.py
View file @
015a7dee
...
...
@@ -337,6 +337,9 @@ tests = [
'tpss.py'
,
# ~18s
'tddft/td_na2.py'
,
# ~18s
'exx/coarse.py'
,
# ~18s
'exx/kpts.py'
,
'exx/double_cell.py'
,
'exx/derivs.py'
,
'corehole/si.py'
,
# ~18s
'mgga/mgga_sc.py'
,
# ~19s
'Hubbard_U_Zn.py'
,
# ~20s
...
...
gpaw/test/exx/h.py
deleted
100644 → 0
View file @
c495bf3b
# flake8: noqa
import
numpy
as
np
from
ase
import
Atoms
from
gpaw
import
GPAW
,
PW
,
Davidson
from
gpaw.xc.hf
import
Hybrid
from
gpaw.xc.hybrid
import
HybridXC
as
H1
k
=
2
L
=
3.0
a
=
Atoms
(
'H'
,
#magmoms=[3],
cell
=
[
L
,
L
,
1
],
pbc
=
(
0
,
0
,
1
))
if
k
==
1
:
a
*=
(
1
,
1
,
2
)
# xc = Hybrid(xc='LDA', exx_fraction=0)
# xc.name = 'LDA'
# xc = Hybrid(None, 'LDA', 0.0, 0.0)
D
=
np
.
linspace
(
1.005
,
1.015
,
7
)
E
=
[]
for
d
in
D
:
#a.positions[1, 0] = d
#a.center()#######################
es
=
Davidson
(
1
)
es
.
keep_htpsit
=
True
#False
#xc = Hybrid('EXX')
xc
=
Hybrid
(
'PBE0'
)
# xc = H1('EXX')
a
.
calc
=
GPAW
(
mode
=
PW
(
400
,
force_complex_dtype
=
True
),
# h=0.12,
#setups='p1',
#setups='ae',
kpts
=
{
'size'
:
(
1
,
1
,
k
),
'gamma'
:
True
},
nbands
=
1
,
eigensolver
=
es
,
# eigensolver='rmm-diis',
# txt='h2.txt',
#xc='PBE',
xc
=
xc
)
e
=
a
.
get_potential_energy
()
raise
SystemExit
#a.calc.set(xc=xc)
#e = a.get_potential_energy()
E
.
append
(
e
)
print
(
d
,
e
)
a
=
a
[:
1
]
a
[
0
]
.
magmom
=
1
es
=
Davidson
(
1
)
es
.
keep_htpsit
=
False
# xc = Hybrid('EXX')
xc
=
H1
(
'EXX'
)
a
.
calc
=
GPAW
(
# mode=PW(500, force_complex_dtype=True),
h
=
0.12
,
setups
=
'ae'
,
nbands
=
1
,
# eigensolver=es,
eigensolver
=
'rmm-diis'
,
txt
=
'h.txt'
,
xc
=
xc
)
e
=
a
.
get_potential_energy
()
print
(
2
*
e
-
min
(
E
))
if
1
:
import
matplotlib.pyplot
as
plt
plt
.
plot
(
D
,
E
)
plt
.
show
()
gpaw/test/exx/k.py
deleted
100644 → 0
View file @
c495bf3b
import
sys
# import numpy as np
from
ase
import
Atoms
from
gpaw
import
GPAW
,
PW
,
Davidson
from
gpaw.hybrids
import
HybridXC
k
=
int
(
sys
.
argv
[
1
])
L
=
8.0
a
=
Atoms
(
'H2'
,
cell
=
[
L
,
L
,
L
],
pbc
=
1
)
a
.
positions
[
1
,
0
]
=
0.75
a
.
center
()
es
=
Davidson
(
1
)
es
.
keep_htpsit
=
True
xc
=
HybridXC
(
'HSE06'
)
a
.
calc
=
GPAW
(
mode
=
PW
(
400
,
force_complex_dtype
=
True
),
kpts
=
{
'size'
:
(
1
,
1
,
k
),
'gamma'
:
not
True
},
symmetry
=
'off'
,
nbands
=
1
,
eigensolver
=
es
,
xc
=
xc
)
e
=
a
.
get_potential_energy
()
gpaw/test/exx/kpts.py
View file @
015a7dee
...
...
@@ -12,7 +12,7 @@ def test(kpts, setup, spinpol, symmetry):
setups
=
setup
,
kpts
=
kpts
,
spinpol
=
spinpol
,
#nbands=1,
#
nbands=1,
symmetry
=
symmetry
,
txt
=
None
,
xc
=
'PBE'
)
...
...
@@ -26,51 +26,35 @@ def check(atoms, xc):
xc1
.
initialize
(
c
.
density
,
c
.
hamiltonian
,
c
.
wfs
,
c
.
occupations
)
xc1
.
set_positions
(
c
.
spos_ac
)
e
=
xc1
.
calculate_energy
()
# print(e)
xc1
.
calculate_eigenvalues
(
0
,
2
,
None
)
# print('A', xc1.e_skn * Ha)
xc2
=
EXX
(
c
,
xc
=
xc
,
bands
=
(
0
,
2
),
txt
=
None
)
xc2
.
calculate
()
e0
=
xc2
.
get_exx_energy
()
eps0
=
xc2
.
get_eigenvalue_contributions
()
# print('B', eps0)
assert
np
.
allclose
(
eps0
,
xc1
.
e_skn
*
Ha
)
# print(e0, e[0] + e[1])
assert
np
.
allclose
(
e0
,
e
[
0
]
+
e
[
1
])
# print(xc1.description)
ecv
,
evv
,
v_skn
=
xc1
.
test
()
# print('C', v_skn)
assert
np
.
allclose
(
e0
,
ecv
+
evv
)
#print(v_skn / eps0)
assert
np
.
allclose
(
v_skn
,
eps0
)
def
main
():
for
spinpol
in
[
False
,
True
]:
for
setup
in
[
'ae'
,
'paw'
]:
for
symmetry
in
[
'off'
,
{}]:
for
kpts
in
[
(
1
,
1
,
1
),
(
1
,
1
,
2
),
(
1
,
1
,
3
),
(
1
,
1
,
4
),
(
2
,
2
,
1
),
[(
0
,
0
,
0.5
)],
[(
0
,
0
,
0
),
(
0
,
0
,
0.5
)]]:
for
spinpol
in
[
False
,
True
]:
for
setup
in
[
'ae'
,
'paw'
]:
for
symmetry
in
[
'off'
,
{}]:
for
kpts
in
[(
1
,
1
,
1
),
(
1
,
1
,
2
),
(
1
,
1
,
3
),
(
1
,
1
,
4
),
(
2
,
2
,
1
),
[(
0
,
0
,
0.5
)],
[(
0
,
0
,
0
),
(
0
,
0
,
0.5
)]]:
atoms
=
test
(
kpts
,
setup
,
spinpol
,
symmetry
)
for
xc
in
[
'EXX'
,
'PBE0'
,
'HSE06'
]:
for
xc
in
[
'EXX'
,
'PBE0'
,
'HSE06'
]:
print
(
spinpol
,
setup
,
symmetry
,
kpts
,
xc
,
len
(
atoms
.
calc
.
wfs
.
mykpts
))
check
(
atoms
,
xc
)
#break
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment