Newer
Older
Kurt Lust
committed
### GPAW benchmark case S: Carbon Nanotube
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
###
from __future__ import print_function
from gpaw.mpi import size, rank
from gpaw import GPAW, Mixer, PoissonSolver, ConvergenceError
from gpaw.occupations import FermiDirac
try:
from ase.build import nanotube
except ImportError:
from ase.structure import nanotube
try:
from gpaw import use_mic
except ImportError:
use_mic = False
try:
from gpaw import use_cuda
use_cuda = True
except ImportError:
use_cuda = False
use_cpu = not (use_mic or use_cuda)
# dimensions of the nanotube
n = 6
m = 6
length = 10
# other parameters
txt = 'output.txt'
maxiter = 16
conv = {'eigenstates' : 1e-4, 'density' : 1e-2, 'energy' : 1e-3}
# uncomment to use ScaLAPACK
#parallel = {'sl_auto': True}
# output benchmark parameters
if rank == 0:
print("#"*60)
print("GPAW benchmark: Carbon Nanotube")
print(" nanotube dimensions: n=%d, m=%d, length=%d" % (n, m, length))
print(" MPI tasks: %d" % size)
print(" using CUDA (GPGPU): " + str(use_cuda))
print(" using pyMIC (KNC) : " + str(use_mic))
print(" using CPU (or KNL): " + str(use_cpu))
print("#"*60)
print("")
# setup parameters
args = {'h': 0.2,
'nbands': -60,
'occupations': FermiDirac(0.1),
'mixer': Mixer(0.1, 5, 50),
'poissonsolver': PoissonSolver(eps=1e-12),
'eigensolver': 'rmm-diis',
'maxiter': maxiter,
'convergence': conv,
'txt': txt}
if use_cuda:
args['cuda'] = True
try:
args['parallel'] = parallel
except: pass
# setup the system
atoms = nanotube(n, m, length)
atoms.center(vacuum=4.068, axis=0)
atoms.center(vacuum=4.068, axis=1)
calc = GPAW(**args)
atoms.set_calculator(calc)
# execute the run
try:
atoms.get_potential_energy()
except ConvergenceError:
pass