Exemple #1
0
#  submit large numbers of jobs on supercomputers. It provides a python interface to physical input,
#  such as crystal structures, as well as to a number of DFT (VASP, CRYSTAL) and atomic potential
#  programs. It is able to organise and launch computational jobs on PBS and SLURM.
#
#  PyLaDa is free software: you can redistribute it and/or modify it under the terms of the GNU
#  General Public License as published by the Free Software Foundation, either version 3 of the
#  License, or (at your option) any later version.
#
#  PyLaDa is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
#  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
#  Public License for more details.
#
#  You should have received a copy of the GNU General Public License along with PyLaDa.  If not, see
#  <http://www.gnu.org/licenses/>.
###############################

# -*- coding: utf-8 -*-
""" Sub-package containing the espresso functional. """
__docformat__ = "restructuredtext en"
__all__ = ["Namelist", "Card", "Pwscf", "read_structure"]

from pylada import logger

logger = logger.getChild("espresso")
""" Logger for espresso """

from .namelists import Namelist
from .card import Card
from .functional import Pwscf
from .structure_handling import read_structure
Exemple #2
0
#  PyLaDa is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
#  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
#  Public License for more details.
#
#  You should have received a copy of the GNU General Public License along with PyLaDa.  If not, see
#  <http://www.gnu.org/licenses/>.
###############################

# -*- coding: utf-8 -*-
""" Reads and writes structure to and from espresso input """
__docformat__ = "restructuredtext en"
__all__ = ['read_structure', 'add_structure']

from pylada import logger

logger = logger.getChild('espresso')
""" Logger for espresso """


def read_structure(filename):
    """ Reads crystal structure from Espresso input """
    from numpy import dot, array
    from quantities import bohr_radius as a0, angstrom, Ry
    from ..crystal import Structure
    from .. import error
    from . import Namelist
    from .card import read_cards
    namelists = Namelist()
    namelists.read(filename)
    cards = read_cards(filename)
    if 'atomic_positions' not in set([u.name for u in cards]):
Exemple #3
0
#
#  PyLaDa is distributed in the hope that it will be useful, but WITHOUT ANY
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
#  details.
#
#  You should have received a copy of the GNU General Public License along with
#  PyLaDa.  If not, see <http://www.gnu.org/licenses/>.
###############################
""" IPython extension module for Pylada. """
from pylada import logger

__docformat__ = "restructuredtext en"
__pylada_is_loaded__ = False
""" Whether the Pylada plugin has already been loaded or not. """
logger = logger.getChild("ipython")
""" Sub-logger for ipython """

def load_ipython_extension(ip):
    """Load the extension in IPython."""
    from IPython.core.magic import register_line_magic
    from .magics import Pylada
    global __pylada_is_loaded__
    if __pylada_is_loaded__:
        return
    from IPython import get_ipython
    from types import ModuleType
    from sys import modules
    from .explore import completer as explore_completer
    from .goto import completer as goto_completer
    from .showme import completer as showme_completer
Exemple #4
0
    within a tree of directories. Each folder can be executable, e.g.  there is
    something to compute there, or non-executable. And each folder can further hold
    any number of sub-folders. Furthermore, classes are provided which make it easy
    to manipulate the parameters for the calculations in an executable folder, as
    well as within all subfolders. Finally, a similar infrastructure is provided to
    collect the computational results across all executable sub-folders.

    .. seealso:: :ref:`jobfolder_ug`
"""
__docformat__ = "restructuredtext en"
__all__ = [
    'JobFolder', 'walk_through', 'save', 'load', 'MassExtract',
    'AbstractMassExtract', 'JobParams'
]
from pylada import logger
logger = logger.getChild("jobfolder")

from .jobfolder import JobFolder
from .manipulator import JobParams
from .extract import AbstractMassExtract
from .massextract import MassExtract


def save(jobfolder, path='jobfolder.dict', overwrite=False, timeout=None):
    """ Pickles a job-folder to file.

        :param jobfolder:
            A job-dictionary to pickle. 
        :type jobfolder: :py:class:`~jobfolder.JobFolder`
        :param str path: 
            filename of file to which to save pickle. overwritten. If None then
Exemple #5
0
    It is centered around an object - the job-folder - which organizes calculations
    within a tree of folders, much as one would manually organize calculations
    within a tree of directories. Each folder can be executable, e.g.  there is
    something to compute there, or non-executable. And each folder can further hold
    any number of sub-folders. Furthermore, classes are provided which make it easy
    to manipulate the parameters for the calculations in an executable folder, as
    well as within all subfolders. Finally, a similar infrastructure is provided to
    collect the computational results across all executable sub-folders.

    .. seealso:: :ref:`jobfolder_ug`
"""
__docformat__ = "restructuredtext en"
__all__ = ['JobFolder', 'walk_through', 'save', 'load', 'MassExtract',
           'AbstractMassExtract', 'JobParams']
from pylada import logger
logger = logger.getChild("jobfolder")

from .jobfolder import JobFolder
from .manipulator import JobParams
from .extract import AbstractMassExtract
from .massextract import MassExtract


def save(jobfolder, path='jobfolder.dict', overwrite=False, timeout=None):
    """ Pickles a job-folder to file.

        :param jobfolder:
            A job-dictionary to pickle. 
        :type jobfolder: :py:class:`~jobfolder.JobFolder`
        :param str path: 
            filename of file to which to save pickle. overwritten. If None then
#
#  PyLaDa is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
#  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
#  Public License for more details.
#
#  You should have received a copy of the GNU General Public License along with PyLaDa.  If not, see
#  <http://www.gnu.org/licenses/>.
###############################

# -*- coding: utf-8 -*-
""" Reads and writes structure to and from espresso input """
__docformat__ = "restructuredtext en"
__all__ = ['read_structure', 'add_structure']

from pylada import logger
logger = logger.getChild('espresso')
""" Logger for espresso """


def read_structure(filename):
    """ Reads crystal structure from Espresso input """
    from numpy import dot, array
    from quantities import bohr_radius as a0, angstrom, Ry
    from ..crystal import Structure
    from .. import error
    from . import Namelist
    from .card import read_cards
    namelists = Namelist()
    namelists.read(filename)
    cards = read_cards(filename)
    if 'atomic_positions' not in set([u.name for u in cards]):
Exemple #7
0
#  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
#  Public License for more details.
#
#  You should have received a copy of the GNU General Public License along with PyLaDa.  If not, see
#  <http://www.gnu.org/licenses/>.
###############################

""" Miscellaneous ressources to create functionals. """
__docformat__ = "restructuredtext en"
__all__ = ['stateless', 'assign_attributes', 'check_success',
           'check_success_generator', 'make_cached', 'uncache', 'SuperCall',
           'create_directory', 'prep_symlink', 'add_pyladarunning_marker',
           'remove_pyladarunning_marker', 'remove_workdir_link',
           'add_section_to_file', 'get_section_from_file', 'OnFinish']
from pylada import logger
logger.getChild("tools")


def stateless(function):
    """ Decorator to make a function stateless.

        Deepcopies structure and self parameters.
        Also sets outdir to getcwd if it is None.
    """
    from functools import wraps

    @wraps(function)
    def wrapper(self, structure, outdir=None, **kwargs):
        from ..misc import local_path
        from copy import deepcopy
        structure = deepcopy(structure)
Exemple #8
0
"""
__docformat__ = "restructuredtext en"
__all__ = [
    "Process",
    "ProgramProcess",
    "CallProcess",
    "IteratorProcess",
    "JobFolderProcess",
    "PoolProcess",
    "Fail",
    "which",
    "DummyProcess",
]
from pylada import logger

logger = logger.getChild("process")

from ..error import root
from .pool import PoolProcess
from .process import Process
from .call import CallProcess
from .program import ProgramProcess
from .iterator import IteratorProcess
from .jobfolder import JobFolderProcess
from .dummy import DummyProcess


class ProcessError(root):
    """ Root of special exceptions issued by process module. """

Exemple #9
0
      - Extracting data from vasp output: to be found in :py:mod:`extract <pylada.vasp.extract>` submodule
      - Methods: One can chain vasp runs together for more complex calculations

    The :py:class:`Vasp <pylada.vasp.functional.Vasp>` class  combines the first
    three concepts together.  It allows us to launch vasp and retrieve
    information from the output. It checks for errors and avoids running the
    same job twice. Hence data retrieval and vasp calculations can be performed
    using the same class and script. 

    `version` tells for which version of VASP these bindings have been
    compiled.
"""
__docformat__ = "restructuredtext en"
__all__ = ['Vasp', 'Extract', 'Specie', 'MassExtract', 'relax', 'emass', 'read_input', 'exec_input']
from pylada import logger
logger.getChild("vasp")
from .extract import Extract, MassExtract
from .specie import Specie
from .functional import Vasp
from . import relax, emass


def read_input(filepath="input.py", namespace=None):
    """ Specialized read_input function for vasp. 

        :Parameters: 
          filepath : str
            A path to the input file.
          namespace : dict
            Additional names to include in the local namespace when evaluating
            the input file.
Exemple #10
0
    It is expected that processes will be returned (or yielded) by
    functionals, and then further managed by the script of interest. As such,
    the initialization of a process will depend upon the actual functional,
    and what it purports to do. However, it should be possible from then on
    to manage the process in a standard way. This standard interface is
    described by the abstract base class :py:class:`~process.Process`.

    .. _openmpi: http://www.open-mpi.org/
"""
__docformat__ = "restructuredtext en"
__all__ = [
    'Process', 'ProgramProcess', 'CallProcess', 'IteratorProcess',
    'JobFolderProcess', 'PoolProcess', 'Fail', 'which', 'DummyProcess'
]
from pylada import logger
logger = logger.getChild("process")

from ..error import root
from .pool import PoolProcess
from .process import Process
from .call import CallProcess
from .program import ProgramProcess
from .iterator import IteratorProcess
from .jobfolder import JobFolderProcess
from .dummy import DummyProcess


class ProcessError(root):
    """ Root of special exceptions issued by process module. """