Skip to content

Instantly share code, notes, and snippets.

@richardotis
richardotis / CMakeLists.txt
Last active November 20, 2017 19:08
MUMPS 5.0.2 build for m2w64-toolchain
###############################################################################
# Try to compile MUMPS.
#
# Record of revision:
# Date Programmer Description of change
# ========= ========== =====================
# Nov 2016 YUAN Xi Original
# Nov 2017 Richard Otis -DAdd_ for m2w64 support
###############################################################################
@richardotis
richardotis / custommodel.py
Last active March 4, 2016 00:56
Creating a custom model in pycalphad
from pycalphad import Database, Model, calculate
import pycalphad.variables as v
import numpy as np
import sympy
dbf = Database('NI_AL_DUPIN_2001.TDB')
class NewModel(Model):
def build_phase(self, dbe, phase_name, symbols, param_search):
self.models['test'] = -13000*v.T*v.R*v.Y(phase_name, 0, 'AL')*v.Y(phase_name, 0, 'NI')
@richardotis
richardotis / autograd_utils.py
Created November 5, 2015 16:30
Integrating SymPy with autograd for efficient automatic differentiation of lambdify'd functions
"""
This module manages interactions with the autograd library.
"""
import autograd.numpy as anp
import numpy as np
from autograd import elementwise_grad, jacobian
from sympy import lambdify
# NumPyPrinter requires unreleased sympy 0.7.7 (in sympy master)
# if you aren't using Piecewise or logical operators
# you can change NumPyPrinter to LambdaPrinter in this module