In [1]:
from pycalphad import Database, Model
model = Model(Database('alfe_sei.TDB'), ['AL', 'FE', 'VA'], 'B2_BCC')
variables = model.variables

In [2]:
print(variables)


[T, B2_BCC0AL, B2_BCC0FE, B2_BCC1AL, B2_BCC1FE, B2_BCC2VA]

In [3]:
from pycalphad.core.autograd_utils import build_functions
from autograd import elementwise_grad, grad
import numpy as np

o, g, h = build_functions(model.ast, variables)
N = 100
M = 100
y1 = np.random.rand(M,1)
y2 = np.random.rand(M,N)
y3 = np.random.rand(M,N)
y4 = np.random.rand(M,N)
y5 = np.random.rand(M,N)
y6 = np.random.rand(M,N)
%timeit ans1 = g(y1, y2, y3, y4, y5, y6)


1 loops, best of 3: 2.14 s per loop