Ejemplo n.º 1
0
# Distributed under the terms of the Apache License 2.0
"""
NWChem Editor
##################
"""
import numpy as np
import pandas as pd
from io import StringIO
from exatomic.container import Universe
from exatomic.editor import Editor as AtomicEditor
from exatomic.basis import BasisSetSummary
try:
    from exatomic.algorithms.basis import spher_lml_count, cart_lml_count, rlmap
except ImportError:
    from exatomic.algorithms.basis import spher_ml_count, cart_ml_count, lmap, lorder
    rlmap = {value: key for key, value in lmap.items() if len(key) == 1}
    spher_lml_count = {lorder.index(key): value for key, value in spher_ml_count.items()}
    cart_lml_count = {lorder.index(key): value for key, value in cart_ml_count.items()}


class Editor(AtomicEditor):
    """
    Base NWChem editor
    """
    def _expand_summary(self):
        '''
        Adds basis set information to the basis set summary table.
        Requires a parsed basis set object.
        '''
        if any('bas_' in col for col in self.basis_set_summary):
            return
Ejemplo n.º 2
0
import numpy as np
from io import StringIO

from .editor import MolcasEditor

from exatomic.atom import Atom
from exatomic.basis import GaussianBasisSet, BasisSetOrder, Overlap
from exatomic.orbital import MOMatrix, DensityMatrix
from exatomic.algorithms.basis import (cart_ml_count, spher_ml_count, lmap, lorder,
                                       spher_lml_count)
from exatomic import Isotope
from exa.relational.isotope import symbol_to_z, z_to_symbol

symbol_to_Z = symbol_to_z()
Z_to_symbol = z_to_symbol()
rlmap = {value: key for key, value in lmap.items()}

class Base(MolcasEditor):

    def _parse_momatrix(self):
        dim = int(self[5])
        found = self.find(_orb_orb, _orb_occ, keys_only=True)
        ndim = dim * dim
        orbstarts = np.array(found[_orb_orb]) + 1
        occstart = found[_orb_occ][0] + 1
        nrcol = len(self[orbstarts[0]].split())
        nrcolocc = len(self[occstart].split())
        coefs = np.empty(ndim, dtype=np.float64)
        occvec = np.empty(dim, dtype=np.float64)
        if nrcol == 1:
            orbstops = np.ceil(orbstarts + dim / 4).astype(int)