Skip to content

Instantly share code, notes, and snippets.

View ehermes's full-sized avatar

Eric Hermes ehermes

View GitHub Profile
#!/usr/bin/env python
class Foo(object):
def __new__(cls, *args, **kwargs):
new_foo = super(Foo, cls).__new__(cls)
new_foo.x = None
new_foo.y = None
new_foo.z = None
return new_foo
#!/usr/bin/env python
class Foo(object):
def __new__(cls):
new_foo = super(Foo, cls).__new__(cls)
new_foo.x = None
new_foo.y = None
new_foo.z = None
return new_foo
# Frobulator takes an Atoms object as an argument and implements `frobulate` which does stuff to the diagonal of an orthorhombic unit cell.
class Frobulator(object):
def __init__(self, atoms):
self.atoms = atoms
# This would likely either be in the get_cell() routine or in ase.utils, depending on the direction we go
def is_orthorhombic(self, cell):
cr = cell.ravel()
if np.all(np.abs(cr[[0, 4, 8]]) > 0) and np.all(np.abs(cr[[1, 2, 3, 5, 6, 7]]) < 1e-8):
return True
#!/usr/bin/env python
import numpy as np
class Cell(np.ndarray):
def __new__(cls, *args):
# User passed a single value, e.g. a scalar or array
if len(args) == 1:
arg = args[0]
# User passed a scalar: make a cubic cell
elif elem.tag == 'parameters':
to_bool = lambda b: True if b == 'T' else False
to_type = {'int': int,
'logical': to_bool,
'string': str,
'float': float,
}
for par in elem.getiterator():
import xml.etree.ElementTree as ET
tree = ET.iterparse('vasprun.xml', events=['start', 'end'])
for event, elem in tree:
if event == 'end' and elem.tag == 'parameters':
str_to_type = {'int': int,
'logical': lambda b: True if b == 'T' else False,
'string': str,
}
Running from numpy source directory.
blas_opt_info:
system_info:
NOT AVAILABLE
/var/tmp/portage/dev-python/numpy-1.11.0/work/numpy-1.11.0/numpy/distutils/system_info.py:1621: UserWarning:
Atlas (http://math-atlas.sourceforge.net/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [atlas]) or by setting
the ATLAS environment variable.
[blas]
include_dirs = /opt/intel/composerxe-2013.3.174/mkl/include
library_dirs = /opt/intel/composerxe-2013.3.174/mkl/lib/intel64:/opt/intel/composerxe-2013.3.174/compiler/lib/intel64:/opt/intel/composerxe-2013.3.174/mkl/lib/intel64:/opt/intel/composerxe-2013.3.174/compiler/lib/intel64:/usr/lib64
blas_libs = mkl_rt
[lapack]
library_dirs = /opt/intel/composerxe-2013.3.174/mkl/lib/intel64:/opt/intel/composerxe-2013.3.174/compiler/lib/intel64:/usr/lib64
lapack_libs = mkl_rt
* Package: dev-python/numpy-1.11.0
* Repository: gentoo
* Maintainer: [email protected] [email protected]
* USE: abi_x86_64 amd64 elibc_glibc kernel_linux lapack python_targets_python2_7 python_targets_python3_5 userland_GNU
* FEATURES: preserve-libs sandbox userpriv usersandbox
* Using following Fortran compiler:
* F77: ifort
* FC: ifort
>>> Unpacking source...
>>> Unpacking numpy-1.11.0.tar.gz to /var/tmp/portage/dev-python/numpy-1.11.0/work
#/usr/bin/env python
import numpy as np
import matplotlib
#matplotlib.use('Qt4Agg')
import matplotlib.pyplot as plt
age_max = 14 * 24 # PriorityMaxAge in hours