Exemplo n.º 1
0
    def _read_supercell(self):
        """ Defered routine """

        f, l = self.step_to('unit_cell_cart', case=False)
        if not f:
            raise ValueError("The unit-cell vectors could not be found in the seed-file.")

        l = self.readline()
        lines = []
        while not l.startswith('end'):
            lines.append(l)
            l = self.readline()

        # Check whether the first element is a specification of the units
        pos_unit = lines[0].split()
        if len(pos_unit) > 2:
            unit = 1.
        else:
            unit = unit_convert(pos_unit[0], 'Ang')
            # Remove the line with the unit...
            lines.pop(0)

        # Create the cell
        cell = np.empty([3, 3], np.float64)
        for i in [0, 1, 2]:
            cell[i, :] = [float(x) for x in lines[i].split()]

        return SuperCell(cell * unit)
Exemplo n.º 2
0
"""

from __future__ import print_function

import numpy as np

# Import sile objects
from sisl.io.sile import *

# Import the geometry object
from sisl import Geometry, Atom, SuperCell, Grid
from sisl.units import unit_convert

__all__ = ['CUBESile']

Ang2Bohr = unit_convert('Ang', 'Bohr')


class CUBESile(Sile):
    """ CUBE file object """

    def _setup(self):
        """ Setup the `CUBESile` after initialization """
        self._comment = []

    @Sile_fh_open
    def write_geom(
            self,
            geom,
            size=None,
            fmt='15.10e',
Exemplo n.º 3
0
from __future__ import division, print_function

# Import sile objects
from .sile import SileBigDFT
from ..sile import *

# Import the geometry object
from sisl import Geometry, Atom, SuperCell
from sisl.units import unit_convert

import numpy as np

__all__ = ['ASCIISileBigDFT']

Bohr2Ang = unit_convert('Bohr', 'Ang')


class ASCIISileBigDFT(SileBigDFT):
    """ ASCII file object for BigDFT """
    def _setup(self):
        """ Initialize for `ASCIISileBigDFT` """
        self._comment = ['#', '!']

    @Sile_fh_open
    def read_geom(self):
        """ Reads a supercell from the Sile """

        # 1st line is arbitrary
        self.readline(True)
        # Read dxx, dyx, dyy
Exemplo n.º 4
0
Arquivo: cube.py Projeto: zerothi/sisl
"""

from __future__ import print_function

import numpy as np

# Import sile objects
from sisl.io.sile import *

# Import the geometry object
from sisl import Geometry, Atom, SuperCell, Grid
from sisl.units import unit_convert

__all__ = ['CUBESile']

Ang2Bohr = unit_convert('Ang', 'Bohr')


class CUBESile(Sile):
    """ CUBE file object """

    def _setup(self):
        """ Setup the `CUBESile` after initialization """
        self._comment = []

    @Sile_fh_open
    def write_geom(
            self,
            geom,
            size=None,
            fmt='15.10e',
Exemplo n.º 5
0
from __future__ import division, print_function

# Import sile objects
from .sile import SileBigDFT
from ..sile import *

# Import the geometry object
from sisl import Geometry, Atom, SuperCell
from sisl.units import unit_convert

import numpy as np

__all__ = ['ASCIISileBigDFT']

Bohr2Ang = unit_convert('Bohr', 'Ang')


class ASCIISileBigDFT(SileBigDFT):
    """ ASCII file object for BigDFT """

    def _setup(self):
        """ Initialize for `ASCIISileBigDFT` """
        self._comment = ['#', '!']


    @Sile_fh_open
    def read_geom(self):
        """ Reads a supercell from the Sile """

        # 1st line is arbitrary
Exemplo n.º 6
0
Arquivo: ref.py Projeto: cationly/sisl
# Import sile objects
from .sile import SileScaleUp
from .orbocc import orboccSileScaleUp
from ..sile import *

# Import the geometry object
from sisl import Geometry, Atom, SuperCell
from sisl._help import ensure_array
from sisl.units import unit_convert

import numpy as np

__all__ = ['REFSileScaleUp', 'restartSileScaleUp']

Bohr2Ang = unit_convert('Bohr', 'Ang')
Ang2Bohr = unit_convert('Ang', 'Bohr')


class REFSileScaleUp(SileScaleUp):
    """ REF file object for ScaleUp """

    @Sile_fh_open
    def read_supercell(self):
        """ Reads a supercell from the Sile """
        # 1st line is number of supercells
        nsc = ensure_array(map(int, self.readline().split()[:3]), np.int32)
        self.readline() # natoms, nspecies
        self.readline() # species
        cell = ensure_array(map(float, self.readline().split()[:9]), np.float64)
        # Typically ScaleUp uses very large unit-cells