Exemplo n.º 1
0
    def calc(self, **kwargs):
        from ase.calculators.abinit import Abinit
        legacy = kwargs.pop('v8_legacy_format', None)
        if legacy is None:
            legacy = self.is_legacy_version()

        kw = self._base_kw(legacy)
        kw.update(kwargs)
        return Abinit(**kw)
Exemplo n.º 2
0
def test_abinit_Si():
    from ase.build import bulk
    from ase.units import Ry
    from ase.calculators.abinit import Abinit

    atoms = bulk('Si')

    calc = Abinit(label='Si',
                  nbands=8,
                  ecut=10 * Ry,
                  kpts=[4, 4, 4],
                  chksymbreak=0,
                  )

    calc.set(toldfe=1.0e-2)
    atoms.set_calculator(calc)
    e = atoms.get_potential_energy()
    print(e)
Exemplo n.º 3
0
                x=x)
 if id is None:
     continue
 # perform EOS step
 atoms.set_cell(cell * x, scale_atoms=True)
 # set calculator
 atoms.calc = Abinit(
     pps='paw',  # uses highest valence
     label=name + '_' + code + '_' + str(n),
     xc='PBE',
     kpts=kpts,
     ecut=ecut * Rydberg,
     pawecutdg=pawecutdg * Rydberg,
     occopt=3,
     tsmear=width,
     ecutsm=ecutsm,
     toldfe=1.0e-6,
     nstep=900,
     pawovlp=-1,  # bypass overlap check
     fband=fband,
     # http://forum.abinit.org/viewtopic.php?f=8&t=35
     chksymbreak=0,
     tolsym=tolsym,
     prtwf=0,
     prtden=0,
 )
 atoms.calc.set(**kwargs)  # remaining calc keywords
 t = time.time()
 atoms.get_potential_energy()
 c.write(atoms,
         name=name,
         ecut=ecut,
Exemplo n.º 4
0
from ase import *
from ase.calculators.abinit import Abinit

a0 = 5.43
bulk = Atoms('Si2', [(0, 0, 0), (0.25, 0.25, 0.25)], pbc=True)
b = a0 / 2
bulk.set_cell([(0, b, b), (b, 0, b), (b, b, 0)], scale_atoms=True)

calc = Abinit(label='Si',
              nbands=8,
              xc='PBE',
              ecut=50 * Ry,
              mix=0.01,
              kpts=[10, 10, 10])

bulk.set_calculator(calc)
e = bulk.get_potential_energy()
Exemplo n.º 5
0
#
#  https://wiki.fysik.dtu.dk/ase/ase/calculators/abinit.html
#
from ase.build import bulk
from ase.units import Ry
from ase.calculators.abinit import Abinit

atoms = bulk('Si')

calc = Abinit(label='Si',
              nbands=8,
              ecut=10 * Ry,
              kpts=[4, 4, 4],
              chksymbreak=0,
              )

calc.set(toldfe=1.0e-2)
atoms.set_calculator(calc)
e = atoms.get_potential_energy()
print(e)

Exemplo n.º 6
0
 def calc(self, **kwargs):
     from ase.calculators.abinit import Abinit
     kw = self._base_kw()
     kw.update(kwargs)
     return Abinit(**kw)
     atomstmp = atoms.copy()
     if rmt:
         kwargstmp.update({'rmt': rmt})
     os.environ['ELK_SPECIES_PATH'] = ELK_SPECIES_PATH
     atomstmp.calc = ELK(tasks=0, label=xlabel)  # minimal calc
     atomstmp.calc.set(**kwargstmp)  # remaining calc keywords
     atomstmp.get_potential_energy()
     del atomstmp.calc
 # hack ELK_SPECIES_PATH to use custom species
 os.environ['ELK_SPECIES_PATH'] = os.path.abspath(xlabel) + '/'
 # perform EOS step
 atoms.set_cell(cell * x, scale_atoms=True)
 # set calculator
 if code == 'abinit':
     p.update({'label': xlabel})
     calc = Abinit(**p)
 if code == 'aims':
     p.update({'label': xlabel})
     calc = Aims(**p)
 if code == 'elk':
     p.update({'label': xlabel})
     calc = ELK(**p)
 if code == 'exciting':
     p.update({'dir': xlabel})
     p.update({'vkloff': get_vkloff(kpts)})  # k-points shift
     p.update({'speciespath': os.path.join(os.environ['EXCITING_SPECIES_PATH'])})
     p.update({'bin': 'mpiexec ' + os.path.join(os.environ['EXCITINGROOT'], 'bin/excitingmpi')})
     calc = Exciting(**p)
 if code == 'espresso':
     p.update({'outdir': xlabel})
     if not structure.startswith('molecule'):
Exemplo n.º 8
0
                kptdensity=kptdensity,
                width=width,
                x=x)
 if id is None:
     continue
 # perform EOS step
 atoms.set_cell(cell * x, scale_atoms=True)
 # set calculator
 atoms.calc = Abinit(
     label=name + '_' + code + '_' + str(n),
     xc='PBE',
     kpts=kpts,
     ecut=ecut * Rydberg,
     occopt=3,
     tsmear=width,
     toldfe=1.0e-6,
     nstep=900,
     diemix=0.1,
     fband=0.95,
     # http://forum.abinit.org/viewtopic.php?f=8&t=35
     chksymbreak=0,
     nsym=1,  # various symmetry problems with various abinits ...
 )
 atoms.calc.set(**kwargs)  # remaining calc keywords
 t = time.time()
 atoms.get_potential_energy()
 c.write(atoms,
         name=name,
         ecut=ecut,
         linspacestr=linspacestr,
         kptdensity=kptdensity,
Exemplo n.º 9
0
from ase import Atoms
from ase.units import Ry
from ase.calculators.abinit import Abinit

a0 = 5.43
bulk = Atoms('Si2', [(0, 0, 0),
                     (0.25, 0.25, 0.25)],
             pbc=True)
b = a0 / 2
bulk.set_cell([(0, b, b),
               (b, 0, b),
               (b, b, 0)], scale_atoms=True)

calc = Abinit(label='Si',
              nbands=8,  # one can specify any abinit keywords
              ecut=10 * Ry,  # warning - used to speedup the test
              kpts=[4, 4, 4],  # warning - used to speedup the test
              chksymbreak=0,
              )

# one can specify abinit keywords also using set
calc.set(toldfe=1.0e-2)  # warning - used to speedup the test
bulk.set_calculator(calc)
e = bulk.get_potential_energy()
Exemplo n.º 10
0
def abinit(**kwargs):
    kw = dict(ecut=150, chksymbreak=0, toldfe=1e-3)
    kw.update(kwargs)
    return Abinit(**kw)
Exemplo n.º 11
0
    def getCalculator(self):
        """Mangle the supplied settings and return an Abinit ASE Calculator object."""

        if "tolsym" in self.settings["settings"].keys():
            tolsym = self.settings["settings"]["tolsym"]
        else:
            tolsym = 1.0e-12

        if "fband" in self.settings["settings"].keys():
            fband = self.settings["settings"]["fband"]
        else:
            fband = 1.5

        if "xc" in self.settings["settings"].keys():
            xc = self.settings["settings"]["xc"]
        else:
            xc = 'PBE'

        if "ecut" in self.settings["settings"].keys():
            ecut = self.settings["settings"]["cutoff"]
        else:
            ecut = 100.

        if "ecutsm" in self.settings["settings"].keys():
            ecutsm = self.settings["settings"]["ecutsm"]
        else:
            ecutsm = 0.0

        if "tsmear" in self.settings["settings"].keys():
            tsmear = self.settings["settings"]["tsmear"]
        else:
            tsmear = 0.01

        if "kpoints" in self.settings.keys():
            kpts = list(self.settings["kpoints"])
        else:
            kpts = [12, 12, 12]

        pseudopotential = self.settings["pseudopotential"]

        if pseudopotential == "hgh.k.nlcc2015":
            os.environ[
                'ABINIT_PP_PATH'] = '/users/ralph/work/abinit/pseudos/HGH-NLCC2015'
            pseudopotential = "hgh.k"
        elif pseudopotential == "hgh.k.nlcc":
            os.environ[
                'ABINIT_PP_PATH'] = '/users/ralph/work/abinit/pseudos/HGH-NLCC'
            pseudopotential = "hgh.k"
        else:
            os.environ[
                'ABINIT_PP_PATH'] = '/users/ralph/work/abinit/pseudos/HGH'

        if 'ABINIT_ASE_ABINIT_COMMAND' not in os.environ.keys():
            os.environ[
                'ASE_ABINIT_COMMAND'] = 'module load gcc-suite >/dev/null; nice -n 2 mpirun -np 4 /users/ralph/work/abinit/abinit-7.10.5/tmp9/abinit < PREFIX.files > PREFIX.out'

        calc = Abinit(
            label='test',
            pps=pseudopotential,  # uses highest valence hgh.k pps
            xc='PBE',
            kpts=kpts,
            ecut=ecut,
            occopt=3,
            tsmear=tsmear,
            ecutsm=ecutsm,
            toldfe=1.0e-6,
            nstep=900,
            pawovlp=-1,  # bypass overlap check
            fband=fband,
            # http://forum.abinit.org/viewtopic.php?f=8&t=35
            chksymbreak=0,
            tolsym=tolsym,
            prtwf=0,
            prtden=0,
        )
        return calc