import numpy as np
from pycalphad import Database, calculate, equilibrium
import pycalphad.variables as v
db = Database('al-matcalc.tdb')
comps = ['AL','SI']
phases = list(db.phases.keys())
eq = equilibrium(db, comps, phases, {v.X('AL'): 0.93, v.X('SI'): 0.07, v.P: 101325, v.T: 1053.15}, output=['enthalpy', 'entropy'])
Traceback (most recent call last):
File "./pycalphad_minimal.py", line 7, in <module>
eq = equilibrium(db, comps, phases, {v.X('AL'): 0.93, v.X('SI'): 0.07, v.P: 101325, v.T: 1053.15}, output=['enthalpy', 'entropy'])
File "/usr/local/lib/python3.4/dist-packages/pycalphad/core/equilibrium.py", line 243, in equilibrium
models[name] = mod = mod(dbf, comps, name, parameters=parameters)
File "/usr/local/lib/python3.4/dist-packages/pycalphad/core/calculate.py", line 32, in __new__
ret = CompiledModel(*args, **kwargs)
File "pycalphad/core/compiled_model.pyx", line 62, in pycalphad.core.compiled_model.CompiledModel.__init__
pycalphad.model.DofError: AL11MN4: Sublattice frozenset({'MN', 'FE', 'ZN'}) of (frozenset({'AL'}), frozenset({'MN', 'FE', 'ZN'})) has no components in {'AL'}
def filter_phases(dbf, comps):
"""Return phases that are valid for equilibrium calculations for the given database and components
Filters out phases that
* Have no active components in any sublattice of a phase
* Are disordered phases in an order-disorder model
Parameters
----------
dbf : Database
Thermodynamic database containing the relevant parameters.
comps : list
Names of components to consider in the calculation.
Returns
-------
list
Sorted list of phases that are valid for the Database and components
"""
def all_sublattices_active(comps, phase):
active_sublattices = [len(set(comps).intersection(subl)) > 0 for
subl in phase.constituents]
return all(active_sublattices)
candidate_phases = dbf.phases.keys()
disordered_phases = [dbf.phases[phase].model_hints.get('disordered_phase') for phase in candidate_phases]
phases = [phase for phase in candidate_phases if
all_sublattices_active(comps, dbf.phases[phase]) and
phase not in disordered_phases]
return sorted(phases)
comps = ['AL', 'SI', 'VA']
phases = filter_phases(dbf, comps)
--
You received this message because you are subscribed to the Google Groups "pycalphad" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pycalphad+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pycalphad/7b8897d0-538b-4639-a873-a54d82968b86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
comps = ['AL','SI','VA']
pycalphad.core.equilibrium.EquilibriumError: Components not found in database: VA
#!/usr/bin/python3
from pycalphad import Database, equilibrium
import pycalphad.variables as v
db = Database('al-matcalc.tdb')
comps = ['AL','SI']
phases = filter_phases(db,comps)
eq = equilibrium(db, comps, phases, {v.X('SI'): 0.07, v.P: 101325, v.T: 1053.15}, output=['enthalpy', 'entropy'])
/usr/local/lib/python3.5/dist-packages/dask/async.py:13: UserWarning: `dask.async.get_sync` has been moved to `dask.local.get_sync`, please update your imports
warnings.warn(_msg.format('get_sync'))
Traceback (most recent call last):
File "./pycalphad_minimal.py", line 40, in <module>
eq = equilibrium(db, comps, phases, {v.X('SI'): 0.07, v.P: 101325, v.T: 1053.15}, output=['enthalpy', 'entropy'])
File "/usr/local/lib/python3.5/dist-packages/pycalphad/core/equilibrium.py", line 358, in equilibrium
properties = dask.compute(properties, get=scheduler)[0]
File "/usr/local/lib/python3.5/dist-packages/dask/base.py", line 206, in compute
results = get(dsk, keys, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/dask/async.py", line 14, in get_sync
return local.get_sync(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/dask/local.py", line 562, in get_sync
return get_async(apply_sync, 1, dsk, keys, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/dask/local.py", line 529, in get_async
fire_task()
File "/usr/local/lib/python3.5/dist-packages/dask/local.py", line 504, in fire_task
callback=queue.put)
File "/usr/local/lib/python3.5/dist-packages/dask/local.py", line 551, in apply_sync
res = func(*args, **kwds)
File "/usr/local/lib/python3.5/dist-packages/dask/local.py", line 295, in execute_task
result = pack_exception(e, dumps)
File "/usr/local/lib/python3.5/dist-packages/dask/local.py", line 290, in execute_task
result = _execute_task(task, data)
File "/usr/local/lib/python3.5/dist-packages/dask/local.py", line 271, in _execute_task
return func(*args2)
File "/usr/local/lib/python3.5/dist-packages/dask/compatibility.py", line 47, in apply
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pycalphad/core/equilibrium.py", line 138, in _eqcalculate
points=points, broadcast=False, **statevars)
File "/usr/local/lib/python3.5/dist-packages/pycalphad/core/calculate.py", line 512, in calculate
largest_energy=float(largest_energy), fake_points=fp)
File "/usr/local/lib/python3.5/dist-packages/pycalphad/core/calculate.py", line 318, in _compute_phase_values
phase_compositions[..., :, col] = np.divide(np.dot(points[..., :, :], avector),
ValueError: shapes (1,7) and (2,) not aligned: 7 (dim 1) != 2 (dim 0)
To view this discussion on the web visit https://groups.google.com/d/msgid/pycalphad/a404b8a9-55ed-49ad-bf49-9cc0fdc8bdb4%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "pycalphad" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pycalphad+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pycalphad/6c8b4766-9711-4ec2-81a1-efa8c85277b8%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pycalphad/8a41807a-9f48-4147-bf05-a5d31c6053f0%40googlegroups.com.