def read_cell_and_scale(system, cell_parameters):
    from numpy import identity, array

    if system.ibrav == 0:
        return _read_free(system, cell_parameters)
    elif system.ibrav == 1:
        return identity(3, dtype='float64'), _get_scale(system)
    elif system.ibrav == 2:
        return 0.5 * array([[-1, 0, 1], [0, 1, 1], [-1, 1, 0]], dtype='float64').transpose(),\
            _get_scale(system)
    elif system.ibrav == 3:
        return 0.5 * array([[1, 1, 1], [-1, 1, 1], [-1, -1, 1]], dtype='float64').transpose(),\
            _get_scale(system)
    elif system.ibrav == 4:
        return _read_hexa(system)
    elif system.ibrav == 5:
        logger.warning('ibrav=5 has not been tested')
        return _read_trig(system)
    elif system.ibrav == -5:
        logger.warning('ibrav=-5 has not been tested')
        return _read_mtrig(system)
    else:
        NotImplementedError("Reading from this kind of lattice has not been implemented")
示例#2
0
    def qstat(self, arg):
        """ SList of user's jobs. 

            The actual print-out and functionality will depend on the user-specified
            function :py:func:`pylada.ipython_qstat`. However, in general %qstat should
            work as follows:

            >>> %qstat
            [ 'id something something jobname' ]

            It returns an SList_ of all the users jobs, with the job-id as the first
            column and the job-name ass the last. The results can be filtered using
            SList_'s grep, or directly as in:

            >>> %qstat hello
            [ 'id something something hellorestofname' ]

            .. _SList: http://ipython.org/ipython-doc/stable/api/generated/IPython.utils.text.html#slist

        """
        import pylada
        if not hasattr(pylada, 'ipython_qstat'):
            logger.warning("Missing ipython_qstat function: cannot use %qstat")
            return []

        ipython_qstat = pylada.ipython_qstat
        arg = arg.rstrip().lstrip()
        if len(arg) != 0 and '--help' in arg.split() or '-h' in arg.split():
            print(self.qstat.__doc__ + '\n' + ipython_qstat.__doc__)
            return

        result = ipython_qstat(self, arg)
        if len(arg) == 0:
            return result

        return result.grep(arg, field=-1)
示例#3
0
    def qstat(self, arg):
        """ SList of user's jobs. 

            The actual print-out and functionality will depend on the user-specified
            function :py:func:`pylada.ipython_qstat`. However, in general %qstat should
            work as follows:

            >>> %qstat
            [ 'id something something jobname' ]

            It returns an SList_ of all the users jobs, with the job-id as the first
            column and the job-name ass the last. The results can be filtered using
            SList_'s grep, or directly as in:

            >>> %qstat hello
            [ 'id something something hellorestofname' ]

            .. _SList: http://ipython.org/ipython-doc/stable/api/generated/IPython.utils.text.html#slist

        """
        import pylada
        if not hasattr(pylada, 'ipython_qstat'):
            logger.warning("Missing ipython_qstat function: cannot use %qstat")
            return []

        ipython_qstat = pylada.ipython_qstat
        arg = arg.rstrip().lstrip()
        if len(arg) != 0 and '--help' in arg.split() or '-h' in arg.split():
            print(self.qstat.__doc__ + '\n' + ipython_qstat.__doc__)
            return

        result = ipython_qstat(self, arg)
        if len(arg) == 0:
            return result

        return result.grep(arg, field=-1)