In [ ]:
requires = ['numpy']
In [ ]:
import pip
installed_packages = pip.get_installed_distributions()
installed_packages_list = sorted(["%s==%s" % (i.key, i.version) for i in installed_packages])
matching = [[libs for libs in installed_packages_list if x in libs] for x in requires]
print matching
In [ ]:
!make oc
In [ ]:
!make interface
In [ ]:
requires = ['libocpy','liboctq.mod','liboceqplus.mod','liboctq.mod']
In [ ]:
import os
files = os.listdir(".")
matching = filter(None, [[fs for fs in files if x in fs] for x in requires])
print matching
if len(matching) == len(requires):
print "requirement fullfilled"
else:
print "something is missing"
In [1]:
# http://matplotlib.org/
import matplotlib.pyplot as plt
from matplotlib import ticker
%matplotlib inline
In [2]:
import numpy as np
In [3]:
from libocpy import *
In [4]:
tqini()
In [5]:
tqrpfil('database/FENI.TDB',('FE','NI'))
In [ ]:
element_name = tqgcom()
print "element name: ",element_name
In [ ]:
number_phase = tqgnp()
print "# of phases: ",number_phase
In [ ]:
phase_name = tqgpn()
print "phase name: ",phase_name
In [ ]:
phase_index = tqgpi('liq')
print "phase index: ",phase_index
In [ ]:
tqphsts("*","SUS",0.)
tqphsts("FCC","ENT",1.)
In [6]:
tqsetc('N',0,1.)
tqsetc('P',0,1E5)
tqsetc('T',0,300.)
tqsetc('X','NI',0.1)
In [7]:
tqce()
In [8]:
GM = tqgetv('NP','FCC','NA')
print GM
In [9]:
tc_fcc = np.loadtxt('tc/fcc_all.dat') # all phases
tc_fcc2 = np.loadtxt('tc/fcc_sep.dat') # A1 only
tc_fcc3 = np.loadtxt('tc/fcc_2ph.dat') # A1 + A1#2
tc_bcc = np.loadtxt('tc/bcc.dat')
tc_liq = np.loadtxt('tc/liq.dat')
In [10]:
import numpy as np
T = np.linspace(300,1500,100)
In [11]:
tqphsts("*","SUS",0.)
tqphsts("FCC","ENT",1.)
GM_FCC = []
for i in range(len(T)):
tqsetc('T',0,T[i])
tqce()
GM_FCC.append(tqgetv('GM','*','NA'))
In [12]:
tqphsts("*","SUS",0.)
tqphsts("BCC","ENT",1.)
GM_BCC = []
for i in range(len(T)):
tqsetc('T',0,T[i])
tqce()
GM_BCC.append(tqgetv('GM','BCC','NA'))
In [13]:
tqphsts("*","SUS",0.)
tqphsts("LIQ","ENT",1.)
GM_LIQ = []
for i in range(len(T)):
tqsetc('T',0,T[i])
tqce()
GM_LIQ.append(tqgetv('GM','LIQ','NA'))
In [14]:
fig, ax = plt.subplots(figsize=(12, 9))
ax.plot(T,GM_FCC,c='k',lw=3,zorder=5)
#ax.plot(T,GM_FCC2,c='b')
#ax.plot(tc_fcc[:,0],tc_fcc[:,1],'o',c='k',markevery=5)
#ax.plot(tc_fcc2[:,0],tc_fcc2[:,1],'o',c='y',markevery=2) # A1 only
ax.plot(tc_fcc3[:,0],tc_fcc3[:,1],'o',markersize=10,c='y',markevery=5) # A1 + A1#2
ax.plot(T,GM_BCC,c='k',lw=3,zorder=5)
ax.plot(tc_bcc[:,0],tc_bcc[:,1],'o',markersize=10,c='b',markevery=5)
ax.plot(T,GM_LIQ,c='k',lw=3,zorder=5)
ax.plot(tc_liq[:,0],tc_liq[:,1],'o',markersize=10,c='r',markevery=5)
plt.show()
==============================================================
Mine PyCALPHAD does not work... will update it soon
In [ ]:
from pycalphad import calculate, equilibrium, Database, binplot
import pycalphad.variables as v
db_ = Database('FENI_pc.TDB')
my_phases_ = ['LIQUID','FCC_A1','BCC_A2']
In [ ]:
pyceq_fcc = equilibrium(db_, ['FE', 'NI', 'VA'], 'FCC_A1', {v.X('NI'): 0.1, v.T: (300, 1500, 30), v.P: 100000})
In [ ]:
fig, ax = plt.subplots(figsize=(12, 9))
ax.plot(T,GM_FCC,c='k',lw=3,zorder=5)
ax.plot(tc_fcc3[:,0],tc_fcc3[:,1],'o',markersize=10,c='y',markevery=5) # A1 + A1#2
ax.plot(pyceq_fcc['T'],pyceq_fcc['GM'][0],'o',markersize=10,c='b')
plt.show()
In [ ]:
pyceq_bcc = equilibrium(db_, ['FE', 'NI', 'VA'], 'BCC_A2', {v.X('NI'): 0.1, v.T: (300, 1500, 30), v.P: 100000})
fig, ax = plt.subplots(figsize=(12, 9))
ax.plot(T,GM_BCC,c='k',lw=3,zorder=5)
ax.plot(tc_bcc[:,0],tc_bcc[:,1],'o',markersize=10,c='y',markevery=5)
ax.plot(pyceq_bcc['T'],pyceq_bcc['GM'][0],'o',markersize=10,c='b')
plt.show()
In [ ]:
pyceq_liq = equilibrium(db_, ['FE', 'NI', 'VA'], 'LIQUID', {v.X('NI'): 0.1, v.T: (300, 1500, 30), v.P: 100000})
fig, ax = plt.subplots(figsize=(12, 9))
ax.plot(T,GM_LIQ,c='k',lw=3,zorder=5)
ax.plot(tc_liq[:,0],tc_liq[:,1],'o',markersize=10,c='y',markevery=5)
ax.plot(pyceq_liq['T'],pyceq_liq['GM'][0],'o',markersize=10,c='b')
plt.show()
In [ ]:
tqrseterr()
In [ ]: