Пример #1
0
# Save the results to a hdf5 file
main_output(mult, outputname=npz_fid, otype='native', ftype='numpy')


# Reset the `orbkit.multiple_files` module
try:
  from importlib import reload # >= Python3.4
except ImportError:
  try: 
    from imp import reload # <= Python3.3
  except ImportError:
    pass # Python2.X

# Read in the results
mult = main_read(npz_fid,gname='multi')

t.append(time())

# Perform a standard orbkit computation
mult.construct_qc() # Construct the qc_info class for every structure
r = 0                    # Index to be calculated
outputname = 'nacl_r%d' % r # Specifies the name of the output file

display('Running orbkit for the structure %d' % r)
import orbkit

# Initialize orbkit with default parameters and options
orbkit.init(reset_display=False)

# Set some options
Пример #2
0
from orbkit.read.high_level import main_read
from orbkit.output.high_level import main_output
from orbkit.grid import set_grid, get_shape
from orbkit.test.tools import equal
from orbkit.qcinfo import QCinfo
from orbkit import options
import os, inspect, tempfile, numpy

options.quiet = True

tests_home = os.path.dirname(inspect.getfile(inspect.currentframe()))
folder = os.path.join(tests_home, '../outputs_for_testing')
filepath = os.path.join(folder, 'NaCl_molden_files.tar.gz')

qc_old = main_read(filepath)

tests_home = tempfile.gettempdir()
filepath = os.path.join(tests_home, 'tmp.npz')

main_output(qc_old, outputname=filepath, otype='native', ftype='numpy')

qc_new = main_read(filepath)
equal(qc_old, qc_new)

os.remove(filepath)

# Test restart from standard npz data output
set_grid(0, 0, 0, is_vector=False)
main_output(numpy.zeros(get_shape()), qc=qc_old, outputname=filepath)

qc_new = main_read(filepath)
Пример #3
0
from orbkit.read.high_level import main_read
from orbkit.test.tools import equal
from orbkit.qcinfo import QCinfo
import numpy
from orbkit import options
import os, inspect

options.quiet = True

tests_home = os.path.dirname(inspect.getfile(inspect.currentframe()))
folder = os.path.join(tests_home, '../outputs_for_testing/gamess')
filepath = os.path.join(folder, 'formaldehyde.log')

qc = main_read(filepath, all_mo=True)

item = qc.mo_spec.get_coeffs()
for i in range(item.shape[0]):
    item[i] = numpy.zeros(item.shape[1]) + i
qc.mo_spec.set_coeffs(item)
equal(qc.mo_spec.get_coeffs(), item)

item = qc.mo_spec.get_occ()
qc.mo_spec.set_occ(item)
equal(qc.mo_spec.get_occ(), item)

item = qc.mo_spec.get_eig()
qc.mo_spec.set_eig(item)
equal(qc.mo_spec.get_eig(), item)

item = qc.mo_spec.get_sym()
qc.mo_spec.set_sym(item)
Пример #4
0
import os, shutil, inspect, tempfile, numpy

from orbkit.read.high_level import main_read
from orbkit.output.high_level import main_output
from orbkit.grid import set_grid, get_shape
from orbkit.test.tools import equal
from orbkit.qcinfo import QCinfo
from orbkit import options

options.quiet = True

tests_home = os.path.dirname(inspect.getfile(inspect.currentframe()))
folder = os.path.join(tests_home, '../outputs_for_testing')
filepath = os.path.join(folder, 'NaCl_molden_files.tar.gz')

qc_old = main_read(filepath)

test_dir = tempfile.mkdtemp()
testfile = os.path.join(test_dir, 'tmp.hdf5')

main_output(qc_old, outputname=testfile, otype='native', ftype='hdf5')

qc_new = main_read(testfile)

equal(qc_old, qc_new)

# Test restart from standard HDF5 data output
set_grid(0, 0, 0, is_vector=False)
main_output(numpy.zeros(get_shape()), qc=qc_old, outputname=testfile)

qc_new = main_read(filepath)