root / ase / test / jacapo.py @ 1
Historique | Voir | Annoter | Télécharger (1,33 ko)
1 |
# do some tests here before we import
|
---|---|
2 |
# Right version of Scientific?
|
3 |
from ase.test import NotAvailable |
4 |
import string, os |
5 |
try:
|
6 |
import Scientific |
7 |
version = string.split(Scientific.__version__,".")
|
8 |
print 'Found ScientifPython version: ',Scientific.__version__ |
9 |
if map(int,version) < [2,8]: |
10 |
print 'ScientificPython 2.8 or greater required for numpy support in NetCDF' |
11 |
raise NotAvailable('ScientificPython version 2.8 or greater is required') |
12 |
except:
|
13 |
print "No Scientific python found. Check your PYTHONPATH" |
14 |
raise NotAvailable('ScientificPython version 2.8 or greater is required') |
15 |
|
16 |
if not (os.system('which dacapo.run') == 0): |
17 |
print "No Dacapo Fortran executable (dacapo.run) found. Check your path settings." |
18 |
raise NotAvailable('dacapo.run is not installed on this machine or not in the path') |
19 |
|
20 |
# Now Scientific 2.8 and dacapo.run should both be available
|
21 |
|
22 |
from ase import Atoms, Atom |
23 |
from ase.calculators.jacapo import Jacapo |
24 |
|
25 |
atoms = Atoms([Atom('H',[0,0,0])], |
26 |
cell=(2,2,2)) |
27 |
|
28 |
calc = Jacapo('Jacapo-test.nc',
|
29 |
pw=200,
|
30 |
nbands=2,
|
31 |
kpts=(1,1,1), |
32 |
spinpol=False,
|
33 |
dipole=False,
|
34 |
symmetry=False,
|
35 |
ft=0.01)
|
36 |
|
37 |
atoms.set_calculator(calc) |
38 |
|
39 |
print atoms.get_potential_energy()
|
40 |
os.system('rm -f Jacapo-test.nc Jacapo-test.txt')
|