예제 #1
0
파일: oi.py 프로젝트: lqcata/ase
    pass
else:
    w += ['png', 'eps']

for format in w:
    print format, 'O',
    fname1 = 'io-test.1.' + format
    fname2 = 'io-test.2.' + format
    write(fname1, atoms, format=format)
    if format not in ['cube', 'png', 'eps', 'cfg', 'struct', 'etsf', 'gen']:
        write(fname2, images, format=format)

    if format in r:
        print 'I'
        a1 = read(fname1)
        assert np.all(np.abs(a1.get_positions() -
                             atoms.get_positions()) < 1e-6)
        if format in ['traj', 'cube', 'cfg', 'struct', 'gen']:
            assert np.all(np.abs(a1.get_cell() - atoms.get_cell()) < 1e-6)
        if format in ['cfg']:
            assert np.all(np.abs(a1.get_array('extra') -
                                 atoms.get_array('extra')) < 1e-6)
        if format not in ['cube', 'png', 'eps', 'cfg', 'struct', 'etsf',
                          'gen']:
            a2 = read(fname2)
            a3 = read(fname2, index=0)
            a4 = read(fname2, index=slice(None))
            assert len(a4) == 2
    else:
        print
예제 #2
0
from ase.io import read, write
from ase.calculators.exciting import Exciting
from ase.units import Bohr, Hartree
import numpy as np
try:
    import lxml
except ImportError:
    print "not there"
    #raise NotAvailable('This test need lxml module.')

a = Atoms('N3O',
          [(0, 0, 0), (1, 0, 0), (0, 0, 1), (0.5, 0.5, 0.5)],
          pbc=True)
a.new_array("rmt",np.array([-1.,-1.,2.3,2]))
print "rmt repeated cell",a.repeat((1,1,2)).get_array("rmt")
print "rmt ",a.get_array("rmt")
write('geo.exi', a)
b = read('geo.exi')

print "a atoms:",a
print "a pos:",a.get_positions()
print "b atoms:",b
print "b pos:",b.get_positions()

calculator1 = Exciting(dir='excitingtestfiles1',
                      kpts=(4, 4, 3),
                      maxscl=3,
                      title="N3O"
                      #bin='/fshome/chm/git/exciting/bin/excitingser'
                      )