Exemple #1
0
 def retrieve(self, formula, filename):
     system = read(filename)
     energy = system.get_potential_energy()
     return energy
Exemple #2
0
 def retrieve(self, formula, filename):
     system = read(filename)
     energy = system.get_potential_energy()
     return energy
Exemple #3
0
from sgt import ElaSticDistortion, loadObject
from ase.calculators import Exciting
from ase import read

exciting = Exciting(bin='/fshome/chm/git/exciting/bin/excitingser',
                    kpts=(4, 4, 4),
                    xctype='GGArevPBE')

atoms = read('AlBulk.xml', format='exi')
#print atoms.get_cell()
distortions = ElaSticDistortion(structure=atoms,
                                calculator=exciting,
                                order=2,
                                maxstrain=0.02,
                                distortions=11)
#distortions.print_distortions()

distortions.calculate()

distortions.save("distwenergy")
Exemple #4
0
            print "--- no SCC ---"
            
        calc = Hotbit(
            charge_density = 'Slater',
            SCC = SCC,
            verbose = True,
            verbose_SCC = True,
            mixer = {
                'name': 'anderson',
                'convergence': 1e-6,
                'mixing_constant': 0.01 },
            maxiter = 1000,
            txt = 'mio.out',
            **params)

        a = read('formamide.xyz')
        a.center(vacuum=10.0)
        a.set_pbc(False)
        a.set_calculator(calc)

        OPT(a, logfile='opt.log').run(fmax=FMAX)

        iO = 0 
        iC = 1
        iN = 2
        iHC = 3
        iHN = 4

        assert a[iO].get_symbol() == 'O'
        assert a[iC].get_symbol() == 'C'
        assert a[iN].get_symbol() == 'N'
Exemple #5
0
def transition_barrier(calc,quench,guess,cell=None,pbc=None,constraints=None,\
                       M=None,name=None,fmax=0.05,steps=1000000):
    import ase
    method=ase.NEB
    
    if type(guess)!=type([]) and type(guess)!=type(''):
        # all Atoms properties should be set for Atoms-type guess
        images=guess
        path=method(images)
    else:
        if type(guess)==type(''):
            assert guess.split('.')[-1]=='trj' and M==None 
            # for some reason copying has to be done...
            images=[]
            for image in ase.PickleTrajectory(guess):
                images.append(image.copy())
            path=method(images)
        else:
            assert type(guess)==type([]) and M!=None
            images=[]
            first=ase.read(guess[0])
            images.append(first)
            for i in range(M-2):
                images.append(first.copy())
            last=ase.read(guess[1])
            images.append(last)
            path=method(images)
            path.interpolate()  
              
        # now coordinates are set; set other properties
        assert cell!=None and pbc!=None 
        for image in images:
            image.set_pbc(pbc)
            image.set_cell(cell,fix=True)
            if constraints!=None:
                image.set_constraint(constraints)
                
    # attach calculators
    if type(calc)==type([]): 
        for image,clc in zip(images,calc):
            image.set_calculator(clc)   
    else:    
        for image in images:
            image.set_calculator(calc.copy())   
            
    for image in images:
        image.center()            
            
    if quench:
        e1=quench_atoms(images[0],'initial')
        print 'First image quenched. Energy=',e1
        eM=quench_atoms(images[-1],'final')
        print 'Last image quenched. Energy=',eM
            
    # solve the transition path
    writer=TrajectoryWriter(images)        
    minimizer=ase.QuasiNewton(path)
    minimizer.attach(writer)
    minimizer.run(fmax=fmax,steps=steps)
    
    # output of the final path
    traj = ase.PickleTrajectory('%s_converged.trj' %name, 'w')
    path.write(traj)
    return images
Exemple #6
0
def transition_barrier(calc,quench,guess,cell=None,pbc=None,constraints=None,\
                       M=None,name=None,fmax=0.05,steps=1000000):
    import ase
    method = ase.NEB

    if type(guess) != type([]) and type(guess) != type(''):
        # all Atoms properties should be set for Atoms-type guess
        images = guess
        path = method(images)
    else:
        if type(guess) == type(''):
            assert guess.split('.')[-1] == 'trj' and M == None
            # for some reason copying has to be done...
            images = []
            for image in ase.Trajectory(guess):
                images.append(image.copy())
            path = method(images)
        else:
            assert type(guess) == type([]) and M != None
            images = []
            first = ase.read(guess[0])
            images.append(first)
            for i in range(M - 2):
                images.append(first.copy())
            last = ase.read(guess[1])
            images.append(last)
            path = method(images)
            path.interpolate()

        # now coordinates are set; set other properties
        assert cell != None and pbc != None
        for image in images:
            image.set_pbc(pbc)
            image.set_cell(cell, fix=True)
            if constraints != None:
                image.set_constraint(constraints)

    # attach calculators
    if type(calc) == type([]):
        for image, clc in zip(images, calc):
            image.set_calculator(clc)
    else:
        for image in images:
            image.set_calculator(calc.copy())

    for image in images:
        image.center()

    if quench:
        e1 = quench_atoms(images[0], 'initial')
        print('First image quenched. Energy=', e1)
        eM = quench_atoms(images[-1], 'final')
        print('Last image quenched. Energy=', eM)

    # solve the transition path
    writer = TrajectoryWriter(images)
    minimizer = ase.QuasiNewton(path)
    minimizer.attach(writer)
    minimizer.run(fmax=fmax, steps=steps)

    # output of the final path
    traj = ase.Trajectory('%s_converged.trj' % name, 'w')
    path.write(traj)
    return images
import os
import ase
from dftd_interface import d3_pbc as dftd3
from dftd_interface import d2_pbc as dftd2
import numpy

print 'single cell'
system = ase.read('./test/POSCAR5', format='vasp')
c, d = dftd3(system ,'pbe')
print repr(c)
print d

print 'mupltiple cell'
system = ase.read('./test/POSCAR6', format='vasp')
c, d = dftd3(system ,'pbe')
print repr(c)
print d

print 'reference'
os.system('./test/dftd3 ./test/POSCAR5.xyz -func pbe -noprint -grad')
Exemple #8
0
from sgt import ElaSticDistortion,loadObject
from ase.calculators import Exciting
from ase import read

exciting=Exciting(bin='/fshome/chm/git/exciting/bin/excitingser', kpts=(4, 4, 4), xctype='GGArevPBE')

atoms=read('AlBulk.xml',format='exi')
#print atoms.get_cell()
distortions=ElaSticDistortion(structure=atoms, 
                              calculator=exciting, 
                              order=2, 
                              maxstrain=0.02, 
                              distortions=11)
#distortions.print_distortions()

distortions.calculate()

distortions.save("distwenergy")