Ejemplo n.º 1
0
from ase.tasks.main import run

# warning! parameters are not converged - only an illustration!

atoms, task = run('aims bulk Li -x bcc -a 3.6 --k-point-density 1.5 --srelax 0.05 --srelaxsteps 1 -t stress -p xc=pw-lda,sc_accuracy_eev=5.e-2,relativistic=none,compute_analytical_stress=True,sc_accuracy_forces=5.e-2')
atoms, task = run('aims bulk Li -x bcc -a 3.6 -t stress -s')
data = task.data['Li']
Ejemplo n.º 2
0
import os

from ase.test import NotAvailable

try:
    nwchem_command = os.getenv("NWCHEM_COMMAND")
    if nwchem_command == None:
        raise NotAvailable("NWCHEM_COMMAND not defined")
except NotAvailable:
    raise NotAvailable("Nwchem required")

import numpy as np

from ase.tasks.main import run

atoms, task = run("nwchem molecule O2 O -l -p task=gradient")
atoms, task = run("nwchem molecule O2 O -s")
ae = 2 * task.data["O"]["energy"] - task.data["O2"]["energy"]
assert abs(ae - 6.605) < 1e-3
Ejemplo n.º 3
0
import os

from ase.test import NotAvailable

try:
    elk_species_path = os.getenv('ELK_SPECIES_PATH')
    if elk_species_path == None:
        raise NotAvailable('ELK_SPECIES_PATH not defined')
except NotAvailable:
    raise NotAvailable('ELK required')

import numpy as np

from ase.tasks.main import run

atoms, task = run("elk bulk Al -x fcc -a 4.04 --k-point-density=3.0 -p xc='PBE',rgkmax=5.0,tforce=True")
atoms, task = run('elk bulk Al -s')
Ejemplo n.º 4
0
import numpy as np
from ase.tasks.main import run
atoms, task = run('H2 -R 0.01 -F 5,2 --atomize')
atoms, task = run('H2 H -s')
data = task.data['H2']
assert abs(data['relaxed energy'] - 1.0705) < 0.0001
assert abs(data['distance'] - 0.7790) < 0.0001
assert abs(data['frequency'] - 0.8628) < 0.0001
assert abs(data['atomic energy'] - data['relaxed energy'] - 5.3495) < 0.0001

atoms, task = run('bulk Cu -F 5,2')
atoms, task = run('bulk Cu -s')
data = task.data['Cu']
assert abs(data['fitted energy'] - -0.0070) < 0.0001
assert abs(data['volume'] - 11.5654) < 0.0001
assert abs(data['B'] - 0.83910) < 0.00001
Ejemplo n.º 5
0
import numpy as np
from ase.tasks.main import run

# molecule

# fit
atoms, task = run('molecule H2 -F 5,2 --atomize -t fitfail')
try:
    atoms, task = run('molecule H2 H -t fitfail -s')
except ValueError:
    pass
# fitting outside of range must fail!
assert task.data == {}

# fit in range
# when only fitting the number of points not must be odd
# in this case data['energy'] is the energy of the middle fit point
#
# test trailing space
atoms, task = run('molecule H2 -F 5,7 --atomize -t fit ')
atoms, task = run('molecule H2 H -t fit -s')
data = task.data['H2']
assert abs(data['energy'] - 1.1589) < 0.0001
assert abs(data['relaxed energy'] - 1.0705) < 0.0001
# note slightly different bondlenght from fitting
assert abs(data['distance'] - 0.77900) < 0.00001
assert abs(data['frequency'] - 0.8676) < 0.0001
assert abs(data['atomic energy'] - data['relaxed energy'] - 5.3495) < 0.0001

# opt then fit
# when fitting after optimization the number of points not need to be odd
Ejemplo n.º 6
0
import os

from ase.test import NotAvailable

try:
    nwchem_command = os.getenv('NWCHEM_COMMAND')
    if nwchem_command == None:
        raise NotAvailable('NWCHEM_COMMAND not defined')
except NotAvailable:
    raise NotAvailable('Nwchem required')

import numpy as np

from ase.tasks.main import run

atoms, task = run("nwchem molecule O2 O -l -p task=gradient")
atoms, task = run('nwchem molecule O2 O -s')
ae = 2 * task.data['O']['energy'] - task.data['O2']['energy']
assert abs(ae - 6.605) < 1e-3
Ejemplo n.º 7
0
import numpy as np
from ase.tasks.main import run

# molecule

# fit
atoms, task = run('molecule H2 -F 5,2 --atomize -t fitfail')
try:
    atoms, task = run('molecule H2 H -t fitfail -s')
except ValueError:
    pass
# fitting outside of range must fail!
assert task.data == {}

# fit in range
# when only fitting the number of points not must be odd
# in this case data['energy'] is the energy of the middle fit point
#
# test trailing space
atoms, task = run('molecule H2 -F 5,7 --atomize -t fit ')
atoms, task = run('molecule H2 H -t fit -s')
data = task.data['H2']
assert abs(data['energy'] - 1.1589) < 0.0001
assert abs(data['relaxed energy'] - 1.0705) < 0.0001
# note slightly different bondlenght from fitting
assert abs(data['distance'] - 0.77900) < 0.00001
assert abs(data['frequency'] - 0.8676) < 0.0001
assert abs(data['atomic energy'] - data['relaxed energy'] - 5.3495) < 0.0001

# opt then fit
# when fitting after optimization the number of points not need to be odd
Ejemplo n.º 8
0
import os

from ase import units
from ase.tasks.main import run

# warning! parameters are not converged - only an illustration!

# just fit EOS
atoms, task = run('jacapo bulk Li -x bcc -a 3.6 --k-point-density 1.5 -F 5,1.5 -t eos -p symmetry=True,deletenc=True')
atoms, task = run('jacapo bulk Li -x bcc -a 3.6 -t eos -s')
data = task.data['Li']
assert abs(data['B'] / units.kJ * 1.0e24 - 8.93) < 0.02
# minimize stress cell and fit EOS: deletenc=True needed!
# https://listserv.fysik.dtu.dk/pipermail/ase-developers/2012-August/001488.html
atoms, task = run('jacapo bulk Li -x bcc -a 3.6 --k-point-density 1.5 --srelax 0.05 -F 5,1.5 -t seos -p symmetry=True,calculate_stress=True,deletenc=True')
atoms, task = run('jacapo bulk Li -x bcc -a 3.6 -t seos -s')
data = task.data['Li']
assert abs(data['B'] / units.kJ * 1.0e24 - 14.73) < 0.02
Ejemplo n.º 9
0
                    e += atomdata[atom.symbol]['energy']
                e /= len(atoms)
                data['cohesive energy'] = e
                if self.collection.xc == 'PBE':
                    eref = self.collection.data[name][7]
                else:
                    eref = self.collection.data[name][9]
                data['cohesive energy error [%]'] = (e / eref - 1) * 100

            self.summary_keys += ['cohesive energy',
                                  'cohesive energy error [%]']


class HarlSchimkaKresseEXXBulkTask(BulkTask):
    def __init__(self, **kwargs):
        BulkTask.__init__(self,
                          collection=HarlSchimkaKresseBulkCollection('EXX'),
                          **kwargs)

    def calculate(self, name, atoms):
        data = BulkTask.calculate(self, name, atoms)
        dexx = atoms.calc.get_xc_difference(HybridXC('EXX', acdf=True))
        data['selfconsistent energy'] = data['energy']
        data['energy'] += dexx
        return data


if __name__ == '__main__':
    from ase.tasks.main import run
    run(calcname='gpaw', task=HarlSchimkaKressePBEBulkTask())
Ejemplo n.º 10
0
from ase.tasks.main import run

atoms, task = run('abinit bulk Al -x fcc -a 4.04 --k-point-density=3.0 ' +
                  '-p xc=PBE,ecut=340,toldfe=1e-5,chksymbreak=0')
atoms, task = run('abinit bulk Al -s')
Ejemplo n.º 11
0
import numpy as np
from ase.tasks.main import run
atoms, task = run('H2 --bond-length=0.78 -R 0.01 -F 5,2 --atomize')
atoms, task = run('H2 H -s')
results = np.array(task.results['H2'])
assert abs(results -
           [1.071, 0.000, 0.779, 862.780, 5.349, 5.349]).max() < 0.001

atoms, task = run('bulk Cu -F 5,2')
atoms, task = run('bulk Cu -s')
results = np.array(task.results['Cu'])
assert abs(results -
           [-0.0057, 0.0014, 11.5654, 134.4389]).max() < 0.001
Ejemplo n.º 12
0
import os

from ase.test import NotAvailable

try:
    abinit_pp_path = os.getenv('ABINIT_PP_PATH')
    if abinit_pp_path == None:
        raise NotAvailable('ABINIT_PP_PATH not defined')
except NotAvailable:
    raise NotAvailable('Abinit required')

import numpy as np

from ase.tasks.main import run

atoms, task = run("abinit bulk Al -x fcc -a 4.04 --k-point-density=3.0 -p xc='PBE',ecut=340")
atoms, task = run('abinit bulk Al -s')
Ejemplo n.º 13
0
import os

from ase.test import NotAvailable

try:
    elk_species_path = os.getenv('ELK_SPECIES_PATH')
    if elk_species_path == None:
        raise NotAvailable('ELK_SPECIES_PATH not defined')
except NotAvailable:
    raise NotAvailable('ELK required')

import numpy as np

from ase.tasks.main import run

atoms, task = run(
    "elk bulk Al -x fcc -a 4.04 --k-point-density=3.0 -p xc='PBE',rgkmax=5.0,tforce=True"
)
atoms, task = run('elk bulk Al -s')
Ejemplo n.º 14
0
from ase.test.fleur import installed

assert installed()

from ase.tasks.main import run

atoms, task = run("fleur bulk Al -x fcc -a 4.04 --k-point-density=3.0 -p xc=PBE")
atoms, task = run("fleur bulk Al -s")
Ejemplo n.º 15
0
import numpy as np
from ase.tasks.main import run
atoms, task = run('H2 --bond-length=0.78 -R 0.01 -F 5,2 --atomize')
atoms, task = run('H2 H -s')
results = np.array(task.results['H2'])
assert abs(results -
           [1.071, 0.000, 0.779, 862.780, 5.349, 5.349]).max() < 0.001

atoms, task = run('bulk Cu -F 5,2')
atoms, task = run('bulk Cu -s')
results = np.array(task.results['Cu'])
assert abs(results - [-0.0057, 0.0014, 11.5654, 134.4389]).max() < 0.001
Ejemplo n.º 16
0
Archivo: htb.py Proyecto: PHOTOX/fuase
                a0_ref = self.collection.data[name][i]
                if 'relaxed volume' not in data:
                    # no volume relaxation performed - volume equals the reference one
                    assert abs(a0 - a0_ref) < 1.e-4
                data['lattice constant'] = a
                data['lattice constant error [%]'] = (a - a0_ref) / a0_ref * 100

        if atomsfile:
            # MDTMP: TODO
            atomdata = read_json(atomsfile)
            for name, data in self.data.items():
                atoms = self.create_system(name)
                e = -data['energy']
                for atom in atoms:
                    e += atomdata[atom.symbol]['energy']
                e /= len(atoms)
                data['cohesive energy'] = e
                if self.collection.xc == 'PBE':
                    eref = self.collection.data[name][7]
                else:
                    eref = self.collection.data[name][9]
                data['cohesive energy error [%]'] = (e / eref - 1) * 100

            self.summary_keys += ['cohesive energy',
                                  'cohesive energy error [%]']

if __name__ == '__main__':
    # run with emt
    from ase.tasks.main import run
    run(calcname='emt', task=HaasTranBlahaBulkTask(fit=(5, 0.02)))
Ejemplo n.º 17
0
import os

from ase.test import NotAvailable

try:
    fleur = os.getenv('FLEUR')
    if fleur == None:
        raise NotAvailable('FLEUR not defined')
except NotAvailable:
    raise NotAvailable('Fleur required')

import numpy as np

from ase.tasks.main import run

atoms, task = run("fleur bulk Al -x fcc -a 4.04 --k-point-density=3.0 -p xc=PBE")
atoms, task = run('fleur bulk Al -s')
Ejemplo n.º 18
0
from ase.test import NotAvailable

from ase.calculators.mopac import Mopac

if Mopac().get_command() is None:
    raise NotAvailable('MOPAC required')

from ase.tasks.main import run

atoms, task = run("mopac molecule O2 O")
atoms, task = run('mopac molecule O2 O -s')
ae = 2 * task.data['O']['energy'] - task.data['O2']['energy']
print ae
assert abs(ae - 12.658) < 1e-3
Ejemplo n.º 19
0
                    assert abs(a0 - a0_ref) < 1.e-4
                data['lattice constant'] = a
                data['lattice constant error [%]'] = (a -
                                                      a0_ref) / a0_ref * 100

        if atomsfile:
            # MDTMP: TODO
            atomdata = read_json(atomsfile)
            for name, data in self.data.items():
                atoms = self.create_system(name)
                e = -data['energy']
                for atom in atoms:
                    e += atomdata[atom.symbol]['energy']
                e /= len(atoms)
                data['cohesive energy'] = e
                if self.collection.xc == 'PBE':
                    eref = self.collection.data[name][7]
                else:
                    eref = self.collection.data[name][9]
                data['cohesive energy error [%]'] = (e / eref - 1) * 100

            self.summary_keys += [
                'cohesive energy', 'cohesive energy error [%]'
            ]


if __name__ == '__main__':
    # run with emt
    from ase.tasks.main import run
    run(calcname='emt', task=HaasTranBlahaBulkTask(fit=(5, 0.02)))
Ejemplo n.º 20
0
from ase.test import NotAvailable

from ase.calculators.gaussian import Gaussian

if Gaussian().get_command() is None:
    raise NotAvailable('Gaussian required')

from ase.tasks.main import run

atoms, task = run('gaussian molecule O2 O')
atoms, task = run('gaussian molecule O2 O -s')
ae = 2 * task.data['O']['energy'] - task.data['O2']['energy']
print ae
assert abs(ae - 5.664) < 1e-3