Exemple #1
0
def _write_first_field_of_each_frame(path, universe):
    """
    Writes the first field of every frame of the universe in a given directory.
    """
    raise NotImplementedError('Started but not completed')
    if not os.path.isdir(path):
        raise NotADirectoryError('Path {}, is not a directory or does not exist!'.format(path))
    framelist = universe.frame.index
    padding = len(str(len(framelist)))
    for frame in framelist:
        atom = universe.atom[(universe.atom['frame'] == frame), ['symbol', 'x', 'y', 'z']].copy()
        mapper = symbol_to_z()
        atom['Z'] = atom['symbol'].map(mapper)
        atom['electrons'] = 1.0
        del atom['symbol']
        field_data = universe.field[universe.field['frame'] == frame]
        idx = field_data.index[0]
        fdata = field_data.ix[idx, ['ox', 'oy', 'oz', 'nx', 'ny', 'nz',
                                    'xi', 'xj', 'xk', 'yi', 'yj', 'yk',
                                    'zi', 'zj', 'zk']]
        ox, oy, oz, nx, ny, nz, xi, xj, xk, yi, yj, yk, zi, zj, zk = fdata
        nat = universe.frame.ix[frame, 'atom_count']
        field = _reshape_to_cube(universe.field_values[idx], nx, ny, nz)
        name = mkp(path, str(frame).zfill(padding) + '.cube')
        with open(name, 'w') as f:
            f.write(str(universe) + '\n')
            f.write('frame: {}\n'.format(frame))
            f.write('{} {} {} {}\n'.format(nat, ox, oy, oz))
            f.write('{} {} {} {}\n'.format(nx, xi, xj, xk))
            f.write('{} {} {} {}\n'.format(ny, yi, yj, yk))
            f.write('{} {} {} {}\n'.format(nz, zi, zj, zk))
            atom.to_csv(f, sep=' ')
            fiel.to_csv(f, sep=' ')
Exemple #2
0
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
'''
exnbo Input Generator and Parser
===================================
'''

import numpy as np
import pandas as pd

from exa.relational.isotope import symbol_to_z

symbol_to_Z = symbol_to_z()

import exatomic
from exatomic.editor import Editor as ExatomicEditor
from exatomic.algorithms.basis import (spher_ml_count, cart_ml_count,
                                       spher_lml_count, cart_lml_count,
                                       lmap, lorder, _vec_normalize)
from exatomic.orbital import DensityMatrix
from exatomic.atom import Atom
from exatomic.container import Universe
#from exatomic.frame import minimal_frame

exaver = 'exatomic.v' + exatomic.__version__


_template = """\
$GENNBO NATOMS={nat}    NBAS={nbas}  UPPER  BODM BOHR $END
$NBO BNDIDX NLMO AONBO=W AONLMO=W $END