Esempio n. 1
0
def parse(string):
    '''Parse the NWChem format basis or ECP text, return an internal basis (ECP)
    format which can be assigned to :attr:`Mole.basis` or :attr:`Mole.ecp`

    Args:
        string : Blank linke and the lines of "BASIS SET" and "END" will be ignored

    Examples:

    >>> mol = gto.Mole()
    >>> mol.basis = {'O': gto.basis.parse("""
    ... #BASIS SET: (6s,3p) -> [2s,1p]
    ... C    S
    ...      71.6168370              0.15432897
    ...      13.0450960              0.53532814
    ...       3.5305122              0.44463454
    ... C    SP
    ...       2.9412494             -0.09996723             0.15591627
    ...       0.6834831              0.39951283             0.60768372
    ...       0.2222899              0.70011547             0.39195739
    ... """)}
    '''
    if 'ECP' in string:
        return parse_nwchem.parse_ecp(string)
    else:
        return parse_nwchem.parse(string)
Esempio n. 2
0
def parse(string):
    '''Parse the NWChem format basis or ECP text, return an internal basis (ECP)
    format which can be assigned to :attr:`Mole.basis` or :attr:`Mole.ecp`

    Args:
        string : Blank linke and the lines of "BASIS SET" and "END" will be ignored

    Examples:

    >>> mol = gto.Mole()
    >>> mol.basis = {'O': gto.basis.parse("""
    ... #BASIS SET: (6s,3p) -> [2s,1p]
    ... C    S
    ...      71.6168370              0.15432897
    ...      13.0450960              0.53532814
    ...       3.5305122              0.44463454
    ... C    SP
    ...       2.9412494             -0.09996723             0.15591627
    ...       0.6834831              0.39951283             0.60768372
    ...       0.2222899              0.70011547             0.39195739
    ... """)}
    '''
    if 'ECP' in string:
        return parse_nwchem.parse_ecp(string)
    else:
        return parse_nwchem.parse(string)
Esempio n. 3
0
def load_ecp(filename_or_basisname, symb):
    '''Convert the basis of the given symbol to internal format
    '''

    if os.path.isfile(filename_or_basisname):
        # read basis from given file
        try:
            return parse_nwchem.load_ecp(filename_or_basisname, symb)
        except RuntimeError:
            with open(filename_or_basisname, 'r') as fin:
                return parse_nwchem.parse_ecp(fin.read())

    name = filename_or_basisname.lower().replace(' ', '').replace('-', '').replace('_', '')
    basmod = ALIAS[name]
    symb = ''.join([i for i in symb if i.isalpha()])
    return parse_nwchem.load_ecp(os.path.join(os.path.dirname(__file__), basmod), symb)
Esempio n. 4
0
def load_ecp(filename_or_basisname, symb):
    '''Convert the basis of the given symbol to internal format
    '''
    if os.path.isfile(filename_or_basisname):
        # read basis from given file
        try:
            return parse_nwchem.load_ecp(filename_or_basisname, symb)
        except RuntimeError:
            with open(filename_or_basisname, 'r') as fin:
                return parse_nwchem.parse_ecp(fin.read())

    name = _format_basis_name(filename_or_basisname)
    if name not in ALIAS:
        return parse_ecp(filename_or_basisname)
    basmod = ALIAS[name]
    symb = ''.join([i for i in symb if i.isalpha()])
    return parse_nwchem.load_ecp(
        os.path.join(os.path.dirname(__file__), basmod), symb)
Esempio n. 5
0
def parse_ecp(string, symb=None):
    # TODO: catch KeyError and provide suggestion for the possible keys
    return parse_nwchem.parse_ecp(string, symb)
Esempio n. 6
0
def parse(string, symb=None, optimize=OPTIMIZE_CONTRACTION):
    if 'ECP' in string:
        return parse_nwchem.parse_ecp(string, symb)
    else:
        return parse_nwchem.parse(string, symb, optimize)
Esempio n. 7
0
def parse_ecp(string):
    return parse_nwchem.parse_ecp(string)
Esempio n. 8
0
def parse_ecp(string):
    return parse_nwchem.parse_ecp(string)
Esempio n. 9
0
def parse_ecp(string, symb=None):
    # TODO: catch KeyError and provide suggestion for the possible keys
    return parse_nwchem.parse_ecp(string, symb)
Esempio n. 10
0
def parse(string, symb=None, optimize=OPTIMIZE_CONTRACTION):
    if 'ECP' in string:
        return parse_nwchem.parse_ecp(string, symb)
    else:
        return parse_nwchem.parse(string, symb, optimize)
Esempio n. 11
0
def parse_ecp(string, symb=None):
    return parse_nwchem.parse_ecp(string, symb)