Showing preview only (8,738K chars total). Download the full file or copy to clipboard to get everything.
Repository: sundmanbo/opencalphad
Branch: master
Commit: 8487a647a308
Files: 187
Total size: 8.3 MB
Directory structure:
gitextract_c_zt9wcv/
├── Makefile
├── Makefile.am
├── Makefile_Claude
├── Makefile_MacOS
├── OCisoCbinding/
│ ├── liboctq.F90
│ ├── liboctqisoc.F90
│ ├── octqc.h
│ └── pyOC/
│ ├── example.ipynb
│ ├── example.py
│ ├── pyOC.f90
│ ├── pyOC.py
│ └── pyOCUnitTest.py
├── README.md
├── build_configure
├── configure.ac.1
├── doc/
│ ├── makedok4.F90
│ └── manual/
│ ├── ochelp.html
│ └── ochelp.tex
├── examples/
│ ├── TQ4lib/
│ │ ├── Cpp/
│ │ │ ├── Makefile
│ │ │ ├── Matthias/
│ │ │ │ ├── FECRMNC.TDB
│ │ │ │ ├── FENI.TDB
│ │ │ │ ├── Makefile
│ │ │ │ ├── Makefile-parallel
│ │ │ │ ├── OC-isoC.h
│ │ │ │ ├── crfe/
│ │ │ │ │ ├── crfe.TDB
│ │ │ │ │ └── tqex1.cpp
│ │ │ │ ├── feni/
│ │ │ │ │ ├── FENI.TDB
│ │ │ │ │ └── tqex2.cpp
│ │ │ │ ├── liboctqcpp.cpp
│ │ │ │ ├── liboctqcpp.h
│ │ │ │ ├── liboctqisoc.F90
│ │ │ │ ├── linkmake
│ │ │ │ ├── steel1.TDB
│ │ │ │ ├── tqcpptest1.cpp
│ │ │ │ ├── tqex3.cpp
│ │ │ │ └── tqintf.h
│ │ │ ├── Scheil/
│ │ │ │ ├── Compile_OCASI_win32.bash
│ │ │ │ ├── Example_OCASI.cpp
│ │ │ │ ├── cost507r.TDB
│ │ │ │ ├── liboctqisoc.F90
│ │ │ │ ├── linkscheil
│ │ │ │ ├── ocasiintf.h
│ │ │ │ ├── octqc.h
│ │ │ │ ├── readme-scheil.tex
│ │ │ │ └── tqintf.h
│ │ │ ├── liboctq.F90
│ │ │ └── liboctqisoc.F90
│ │ ├── F90/
│ │ │ ├── crfe/
│ │ │ │ ├── TQ1-crfe.F90
│ │ │ │ ├── crfe.TDB
│ │ │ │ ├── link-tqtest1
│ │ │ │ └── readme-tq1.tex
│ │ │ ├── feni/
│ │ │ │ ├── FENI.TDB
│ │ │ │ ├── TQ2-feni.F90
│ │ │ │ ├── linkmake
│ │ │ │ └── readme.tex
│ │ │ ├── liboctq.F90
│ │ │ └── parallel-alnipt/
│ │ │ ├── AlNiPt-2005.TDB
│ │ │ ├── README.sim
│ │ │ ├── liboctq.F90
│ │ │ ├── linksim
│ │ │ ├── setup.input
│ │ │ └── sim-alnipt.F90
│ │ └── readme.tex
│ └── macros/
│ ├── AlC-OC.TDB
│ ├── AlC-diagrams.OCM
│ ├── AlFe-4SLBF.TDB
│ ├── BEF.TDB
│ ├── CHO-gas.TDB
│ ├── MgNaCl.TDB
│ ├── MgNaClX.TDB
│ ├── MoRe.TDB
│ ├── MoRe1.PDB
│ ├── OU.TDB
│ ├── SGTE-unary1991-2010.TDB
│ ├── agcu.TDB
│ ├── all-from-map19.OCM
│ ├── all-from-map4.OCM
│ ├── all-from-tzero.OCM
│ ├── all.OCM
│ ├── allcost.OCM
│ ├── alni-4slx.TDB
│ ├── cost507R.TDB
│ ├── cslaf-excess.TDB
│ ├── cslaf-map.OCM
│ ├── hogas.TDB
│ ├── iron4cd.TDB
│ ├── map1.OCM
│ ├── map10.OCM
│ ├── map11.OCM
│ ├── map12.OCM
│ ├── map13.OCM
│ ├── map14.OCM
│ ├── map15.OCM
│ ├── map16.OCM
│ ├── map17.OCM
│ ├── map18.OCM
│ ├── map19.OCM
│ ├── map2.OCM
│ ├── map3.OCM
│ ├── map4.OCM
│ ├── map5.OCM
│ ├── map6.OCM
│ ├── map7.OCM
│ ├── map8.OCM
│ ├── map9.OCM
│ ├── maplast.OCM
│ ├── melting.OCM
│ ├── mqtest-1C.OCM
│ ├── opttest1.OCM
│ ├── opttest2-map-diagram.OCM
│ ├── opttest2-plot-cpcumg2.OCM
│ ├── opttest2-plot-cplaves.OCM
│ ├── opttest2-plot-hliq.OCM
│ ├── opttest2.OCM
│ ├── opttest2A.OCM
│ ├── opttest2B.OCM
│ ├── opttest2C.OCM
│ ├── opttest2D.OCM
│ ├── opttest2E.OCM
│ ├── opttest2F.OCM
│ ├── opttest2G.OCM
│ ├── parallel1.OCM
│ ├── parallel2.OCM
│ ├── saf2507.TDB
│ ├── save.OCM
│ ├── sro-cef.OCM
│ ├── steel1.TDB
│ ├── steel7.TDB
│ ├── step-epz.OCM
│ ├── step-scheil.OCM
│ ├── step-tzero.OCM
│ ├── step1.OCM
│ ├── step2.OCM
│ ├── step3.OCM
│ ├── step4.OCM
│ ├── step5.OCM
│ ├── step6.OCM
│ ├── step7.OCM
│ ├── step8.OCM
│ ├── step9.OCM
│ ├── testcond1.OCM
│ ├── unary.OCM
│ └── uniquac.OCM
├── linkmake
├── linkoc
├── linkpara
├── oc6P
└── src/
├── linkocdate.F90
├── minimizer/
│ └── matsmin.F90
├── models/
│ ├── OC-isoC.h
│ ├── gtp3.F90
│ ├── gtp3A.F90
│ ├── gtp3B.F90
│ ├── gtp3C.F90
│ ├── gtp3D.F90
│ ├── gtp3E.F90
│ ├── gtp3EX.F90
│ ├── gtp3EY.F90
│ ├── gtp3F.F90
│ ├── gtp3G.F90
│ ├── gtp3H.F90
│ ├── gtp3X.F90
│ ├── gtp3XQ.F90
│ ├── gtp3Y.F90
│ ├── gtp3Z.F90
│ ├── gtp3_dd1.F90
│ ├── gtp3_dd2.F90
│ ├── gtp3_xml.F90
│ └── ocparam.F90
├── numlib/
│ ├── minpack1.F90
│ ├── oclablas.F90
│ └── ocnum.F90
├── pmain1.F90
├── stepmapplot/
│ ├── smp2.F90
│ ├── smp2A.F90
│ └── smp2B.F90
├── userif/
│ └── pmon6.F90
└── utilities/
├── GETKEY/
│ ├── M_getkey.F90
│ ├── Makefile
│ └── getkey.c
├── TINYFILEDIALOGS/
│ ├── Makefile
│ ├── compile_and_link
│ ├── ftinyopen.F90
│ ├── tinyfiledialogs.c
│ ├── tinyfiledialogs.h
│ └── tinyopen.c
└── metlib4.F90
================================================
FILE CONTENTS
================================================
================================================
FILE: Makefile
================================================
#
# Modified 2020.04.25 for the new direcory structure. Bo Sundman
#
OBJS=getkey.o M_getkey.o ftinyopen.o tinyopen.o tinyfiledialogs.o metlib4.o oclablas.o ocnum.o minpack1.o gtp3.o matsmin.o smp2.o pmon6.o
LIBS=liboctq.o liboctqisoc.o liboctqcpp.o
EXE=oc6P
#
# IMPORTANT 1. select getkey version
# 2. select GNUPLOT terminal
#
# echo "Do not forget to uncomment a line for your OS"
#
#=============================================================================#
# original provided by Matthias Strathmann including OC examples
# NOTE getkey.o : you have to select which getkey routine to compile
#=============================================================================#
FC=gfortran
C=gcc
CPP=g++
FCOPT= -O2 -fopenmp -fPIC
# for debugging
#FCOPT= -fbounds-check -finit-local-zero
# no parallel
#FCOPT= -O2
#FC=ifort
#FCOPT= -check bounds -zero
EX1PATH = ./examples/TQ4lib/F90/crfe
EX2PATH = ./examples/TQ4lib/F90/feni
EX3PATH = ./examples/TQ4lib/Cpp/Matthias/crfe
EX4PATH = ./examples/TQ4lib/Cpp/Matthias/feni
EX5PATH = ./examples/TQ4lib/Cpp/Matthias
#=============================================================================#
#Available compilation flags: all, OCASI, OCASIEXAMPLES, clean
.PHONY : all OCASI OCASIEXAMPLES clean
#Compiles OpenCalphad to use as standalone Thermodynamic Equilibrium Calculation
#software.
# ************************************
# OC now requires GNUPLOT 5.2 or later
# ************************************
# To have the command line editing and history feature on your OS
# you must uncomment the appropriate line after the header getkey.o:
all: $(OBJS) $(EXE)
#Compiles the OCASI interfaces of OpenCalphad, so third party software can
#interact with OpenCalphad. Interfaces are provided in C++ and Fortran, and
#additional interfaces are available in C and Python.
OCASI:
make $(OBJS) $(LIBS)
ar sq liboctq-f90.a liboctq.o $(OBJS)
ar sq liboctq-isoc.a liboctqisoc.o liboctq.o $(OBJS)
ar sq liboctqcpp.a liboctqcpp.o liboctqisoc.o liboctq.o $(OBJS)
$(CPP) -shared liboctqcpp.o liboctqisoc.o liboctq.o $(OBJS) -o $(EXE)_OCASI.so -lgfortran
#Compiles the OCASI interface and various examples.
OCASIEXAMPLES:
make OCASI
$(FC) -o $(EX1PATH)/tqex1 $(EX1PATH)/TQ1-crfe.F90 liboctq-f90.a -fopenmp
$(FC) -o $(EX2PATH)/tqex2 $(EX2PATH)/TQ2-feni.F90 liboctq-f90.a -fopenmp
$(CPP) -o $(EX3PATH)/tqex1 $(EX3PATH)/tqex1.cpp liboctqcpp.a -lgfortran -fopenmp
$(CPP) -o $(EX4PATH)/tqex2 $(EX4PATH)/tqex2.cpp liboctqcpp.a -lgfortran -fopenmp
$(CPP) -o $(EX5PATH)/tqex3 $(EX5PATH)/tqex3.cpp liboctqcpp.a -lgfortran -fopenmp
clean:
rm -r *.mod *.a $(LIBS) $(OBJS) linkoc $(EXE)_OCASI.so $(EXE) $(EX1PATH)/tqex1 $(EX2PATH)/tqex2 $(EX3PATH)/tqex1 $(EX4PATH)/tqex2 $(EX5PATH)/tqex3
#==============================================================================#
# IMPORTRANT 1:
# To have the command line editing and history feature on your OS
# you must uncomment the appropriate line after the header getkey.o:
# Default is Linux
getkey.o:
echo "Do not forget to uncomment the correct line below for your OS"
# compile utilities/GETKEY for command line editing
# uncomment the line for the kind of Linux system you have
# Mac >>
#$(C) -c $(FCOPT) -DBSD src/utilities/GETKEY/getkey.c
# Linux >>
$(C) -c -DLinux src/utilities/GETKEY/getkey.c
# other UNIX systems >>
#$(C) -c -DG77 src/utilities/GETKEY/getkey.c
# CYGWIN >>
#$(C) -c -DCYGWIN src/utilities/GETKEY/getkey.c
# If you have not uncommented any getkey.c line above COMMENT next line
# and also remove the -Dlixed option for the metlib4.F90
M_getkey.o:
$(FC) -c $(FCOPT) src/utilities/GETKEY/M_getkey.F90
tinyfiledialogs.o:
$(C) -c src/utilities/TINYFILEDIALOGS/tinyfiledialogs.c
tinyopen.o:
$(C) -c src/utilities/TINYFILEDIALOGS/tinyopen.c
ftinyopen.o:
$(FC) -c $(FCOPT) src/utilities/TINYFILEDIALOGS/ftinyopen.F90
metlib4.o: src/utilities/metlib4.F90
$(FC) -c $(FCOPT) src/models/ocparam.F90
# lixed for command line editing,
# tinyfd for open files
# lixhlp for browser help on Linux and MacOS
$(FC) -c $(FCOPT) -Dlixed -Dtinyfd -Dlixhlp src/utilities/metlib4.F90
oclablas.o: src/numlib/oclablas.F90
$(FC) -c $(FCOPT) src/numlib/oclablas.F90
ocnum.o: src/numlib/ocnum.F90
$(FC) -c $(FCOPT) -DNOLAPACK src/numlib/ocnum.F90
minpack1.o: src/numlib/minpack1.F90
$(FC) -c $(FCOPT) src/numlib/minpack1.F90
gtp3.o: src/models/gtp3.F90
$(FC) -c $(FCOPT) src/models/gtp3.F90
matsmin.o: src/minimizer/matsmin.F90
$(FC) -c $(FCOPT) src/minimizer/matsmin.F90
smp2.o: src/stepmapplot/smp2.F90
# Remove -Dnotwin if compiled on Windows (for spawning)
$(FC) -c $(FCOPT) -Dnotwin src/stepmapplot/smp2.F90
# IMPORTANT 2: select GNUPLOT terminal
pmon6.o: src/userif/pmon6.F90
# default wxt graphical driver
# use -Dqtplt for Qt or (also smaller window)
# use -Daqplt for aqua plot drivers (also smaller window)
# use -Dx11 for X11 plot drivers DEFAULT
# use -Dlixhlp for online help in Linux
# use -Dmachlp for online help in MacOS (browser)
$(FC) -c $(FCOPT) -Dx11 -Dlixhlp src/userif/pmon6.F90
liboctq.o: ./examples//TQ4lib/Cpp/liboctq.F90
$(FC) -c -g $(FCOPT) ./examples/TQ4lib/Cpp/liboctq.F90
liboctqisoc.o: ./examples/TQ4lib/Cpp/Matthias/liboctqisoc.F90
$(FC) -c -g $(FCOPT) ./examples/TQ4lib/Cpp/Matthias/liboctqisoc.F90
liboctqcpp.o: ./examples/TQ4lib/Cpp/Matthias/liboctqcpp.cpp
$(CPP) -c -g $(FCOPT) ./examples/TQ4lib/Cpp/Matthias/liboctqcpp.cpp
$(EXE):
# Add date of linking to main program
cp src/pmain1.F90 src/pmain1-save.F90
$(FC) -o linkoc src/linkocdate.F90
./linkoc
rm src/pmain1-save.F90
# create library liboceq.a
mkdir -p libs
ar sq libs/liboceq.a metlib4.o oclablas.o ocnum.o gtp3.o matsmin.o minpack1.o
# If getkey.o is undefined below
# you have forgotten to uncomment a line above at getkey.o !!
# static: $(FC) -o $(EXE) $(FCOPT) -static-libgfortran pmain1.F90 $(OBJS) liboceq.a
#$(FC) -o $(EXE) $(FCOPT) src/pmain1.F90 $(OBJS) libs/liboceq.a
$(FC) -o $(EXE) $(FCOPT) src/pmain1.F90 pmon6.o smp2.o ftinyopen.o tinyopen.o tinyfiledialogs.o getkey.o libs/liboceq.a
================================================
FILE: Makefile.am
================================================
AUTOMAKE_OPTIONS = subdir-objects
.NOTPARALLEL:
SUBDIRS=
DIST_SUBDIRS=
AM_FCFLAGS=-Dnotwin @OPENMP_FCFLAGS@
bin_PROGRAMS= OC
lib_LTLIBRARIES= libOC.la
lib_LTLIBRARIES+= libOPENCALPHAD.la
if WITH_PYTHON
# SUBDIRS+= OCisoCbinding/pyOC
PYTHONdir=$(prefix)/python
dist_PYTHON_DATA = OCisoCbinding/pyOC/pyOC.py \
OCisoCbinding/pyOC/pyOCUnitTest.py \
OCisoCbinding/pyOC/example.ipynb \
OCisoCbinding/pyOC/example.py
libpyOC_la_SOURCES = OCisoCbinding/pyOC/pyOC.f90
libpyOC_la_FCFLAGS = -I.
libpyOC_la_DEPENDENCIES = libOPENCALPHAD.la
lib_LTLIBRARIES += libpyOC.la
endif
EXTRA_DIST=src/models/gtp3A.F90 \
src/models/gtp3B.F90 \
src/models/gtp3C.F90 \
src/models/gtp3D.F90 \
src/models/gtp3E.F90 \
src/models/gtp3F.F90 \
src/models/gtp3G.F90 \
src/models/gtp3H.F90 \
src/models/gtp3X.F90 \
src/models/gtp3Y.F90 \
src/models/gtp3Z.F90 \
src/models/ocparam.F90 \
src/stepmapplot/smp2A.F90 \
src/stepmapplot/smp2B.F90 \
OCisoCbinding/octqc.h \
doc/manual/ochelp.html\
doc/manual/ochelp.pdf
manualdir=$(pkgdatadir)/doc/manual
dist_manual_SCRIPTS = \
doc/manual/ochelp.html\
doc/manual/ochelp.pdf
#############################################
# files used to build the libOC.la library
# It is then used to build the OC executable
# and the libOPENCALPHAD.la shared library
#############################################
libOC_la_SOURCES= \
src/models/ocparam.F90 \
src/utilities/metlib4.F90
OC_FCFLAGS=
if WITH_OCHELP
OC_FCFLAGS+= -Dlixed -Dtinyfd -Dlixhlp
endif
if WITH_OCPLOT
OC_FCFLAGS+= -Dx11
endif
if WITH_LAPACK
OC_FCFLAGS +=-Dnotwin
#LAPACKLIBS = -L$(LAPACKLIB) -llapack -L$(LAPACKLIB) -lrefblas
LAPACKLIBS = -llapack -lblas
else
OC_FCFLAGS +=-Dnotwin -DNOLAPACK
AM_FCFLAGS += -DNOLAPACK
libOC_la_SOURCES +=src/numlib/oclablas.F90
endif
libOC_la_SOURCES +=src/numlib/ocnum.F90 \
src/numlib/minpack1.F90 \
src/models/gtp3.F90 \
src/minimizer/matsmin.F90
########################################
# files used to build the OC executable
########################################
BUILT_SOURCES=libOC.la
OC_SOURCES= \
src/stepmapplot/smp2.F90 \
src/userif/pmon6.F90 \
src/pmain1.F90
OC_LDADD=libOC.la @OPENMPLIB@ $(LAPACKLIBS)
OC_DEPENDENCIES=libOC.la
###########################################################
# files used to build the libOPENCALPHAD.la shared library
###########################################################
libOPENCALPHAD_la_SOURCES= \
OCisoCbinding/liboctq.F90 \
OCisoCbinding/liboctqisoc.F90
libOPENCALPHAD_la_LIBADD=libOC.la @OPENMPLIB@
libOPENCALPHAD_la_DEPENDENCIES=libOC.la
############################################################
# Some targets for standalone execution
############################################################
if WITH_PYTHON
PYTHON_MODN = rawpyOC
F90WRAP = ${CURDIR}/f90wrap/bin/f90wrap
F2PY = ${CURDIR}/f90wrap/bin/f2py-f90wrap
all-local: _${PYTHON_MODN}.so
f90wrap:
git clone https://github.com/jameskermode/f90wrap.git f90wrap
# cd f90wrap && $(PYTHON) setup.py install*
touch f90wrap/installedFiles
cd f90wrap && $(PYTHON) setup.py install --single-version-externally-managed --prefix $(CURDIR)/f90wrap --record $(CURDIR)/f90wrap/installedFiles
_${PYTHON_MODN}.so: export LDFLAGS=-Wl,-rpath=$(libdir) -L./.libs
_${PYTHON_MODN}.so: export NPY_DISTUTILS_APPEND_FLAGS=1
_${PYTHON_MODN}.so: libpyOC.la f90wrap
$(F90WRAP) -m $(PYTHON_MODN) $(top_srcdir)/OCisoCbinding/pyOC/pyOC.f90 #-v
$(F2PY) --fcompiler=$(FC) --build-dir . -c -m _$(PYTHON_MODN) -lOPENCALPHAD -L. -lpyOC f90wrap*.f90
ln -s _${PYTHON_MODN}*.so _${PYTHON_MODN}.so
install-data-hook: export OCPUBLICDATA=$(abs_top_srcdir)/examples/macros
install-data-hook:
cp _${PYTHON_MODN}.so $(PYTHONdir)
cp ${PYTHON_MODN}.py $(PYTHONdir)
cd $(PYTHONdir) && ${PYTHON} pyOCUnitTest.py
endif
.PHONY: doc
clean-local:
find . -name "*.mod" |xargs rm -f
find . -name "*.info" |xargs rm -f
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(bindir)
@echo "# This script is generated by make install " >$(DESTDIR)$(bindir)/envOC.sh
@echo "# Use it to set environment for running from install dir" >> $(DESTDIR)$(bindir)/envOC.sh
@echo "" >> $(DESTDIR)$(bindir)/envOC.sh
@echo "## OCHOME " >>$(DESTDIR)$(bindir)/envOC.sh
@echo "export OCHOME=$(manualdir)/" >>$(DESTDIR)$(bindir)/envOC.sh
@echo 'LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(DESTDIR)/lib' >> $(DESTDIR)$(bindir)/envOC.sh
@echo 'PATH=$(DESTDIR)$(bindir):$$PATH' >> $(DESTDIR)$(bindir)/envOC.sh
@echo "export PATH" >> $(DESTDIR)$(bindir)/envOC.sh
@echo "" >> $(DESTDIR)$(bindir)/envOC.sh
uninstall-local:
$(RM) $(DESTDIR)$(bindir)/envOC.sh
distclean-local:
$(RM) configure.ac configure build_configure.log
find . -name "Makefile.in" |xargs $(RM) -f
$(RM) -r config
CLEANFILES=envOC.sh
DISTCLEANFILES=envOC.sh
================================================
FILE: Makefile_Claude
================================================
#
# Makefile for Open Calphad (OC) - Claude version
#
# Targets: all, debug, clean
#
# ************************************
# OC now requires GNUPLOT 5.2 or later
# ************************************
EXE = oc7C
LIBS_A = libs/liboceq.a
#==============================================================================
# Compiler selection
#==============================================================================
FC = gfortran
CPP = g++
# Auto-detect OS
# Override any variable on the command line, e.g.: make PLOTFLAG=-Daqplt
UNAME := $(shell uname)
ifeq ($(UNAME), Darwin)
C = cc
GETKEY_OS = -DBSD
HELPFLAG = -Dmachlp
PLOTFLAG = -Dqtplt # Qt driver; use -Daqplt for Aqua
WINFLAG = -Dnotwin
else ifneq (,$(findstring CYGWIN, $(UNAME)))
C = gcc
GETKEY_OS = -DCYGWIN
HELPFLAG = # no browser help on Cygwin
PLOTFLAG = # wxt is gnuplot default; no flag needed
WINFLAG = # Windows spawning: do NOT define notwin
else
# Linux and other Unix
C = gcc
GETKEY_OS = -DLinux
HELPFLAG = -Dlixhlp
PLOTFLAG = # wxt is gnuplot default; no flag needed
WINFLAG = -Dnotwin
# Other UNIX (AIX, HP-UX, etc.): override with make GETKEY_OS=-DG77
endif
#==============================================================================
# Compiler flags — gfortran (default) or ifort
#==============================================================================
ifneq (,$(findstring ifort, $(FC)))
# Intel Fortran
FCOMP = -O2 -qopenmp -fPIC -zero
FCDEBUG = -check bounds -zero
else
# GNU Fortran (gfortran)
FCOMP = -O2 -fopenmp -fPIC -finit-local-zero
FCDEBUG = -O1 -fopenmp -fbounds-check -finit-local-zero
endif
FCOPT = $(FCOMP)
#==============================================================================
# Object files (in link order)
#==============================================================================
OBJS = getkey.o M_getkey.o ftinyopen.o tinyopen.o tinyfiledialogs.o \
ocparam.o metlib4.o oclablas.o ocnum.o minpack1.o \
gtp3.o matsmin.o smp2.o pmon6.o
#==============================================================================
# gtp3.F90 pulls in these files via #include — list them so a change
# to any sub-file triggers recompilation of gtp3.o
#==============================================================================
GTP3_INCS = \
src/models/gtp3_dd1.F90 src/models/gtp3_dd2.F90 src/models/gtp3_xml.F90 \
src/models/gtp3A.F90 src/models/gtp3B.F90 src/models/gtp3C.F90 \
src/models/gtp3D.F90 src/models/gtp3E.F90 src/models/gtp3EX.F90 \
src/models/gtp3EY.F90 src/models/gtp3F.F90 src/models/gtp3G.F90 \
src/models/gtp3H.F90 src/models/gtp3X.F90 src/models/gtp3XQ.F90 \
src/models/gtp3Y.F90 src/models/gtp3Z.F90
# smp2.F90 pulls in these files via #include
SMP2_INCS = src/stepmapplot/smp2A.F90 src/stepmapplot/smp2B.F90
#==============================================================================
.PHONY: all debug clean
all: $(EXE)
# Debug build: make debug
debug: FCOPT = $(FCDEBUG)
debug: all
#==============================================================================
# C / utility objects
#==============================================================================
getkey.o: src/utilities/GETKEY/getkey.c
$(C) -c $(GETKEY_OS) src/utilities/GETKEY/getkey.c
M_getkey.o: src/utilities/GETKEY/M_getkey.F90
$(FC) -c $(FCOPT) src/utilities/GETKEY/M_getkey.F90
tinyfiledialogs.o: src/utilities/TINYFILEDIALOGS/tinyfiledialogs.c
$(C) -c src/utilities/TINYFILEDIALOGS/tinyfiledialogs.c
tinyopen.o: src/utilities/TINYFILEDIALOGS/tinyopen.c
$(C) -c src/utilities/TINYFILEDIALOGS/tinyopen.c
ftinyopen.o: src/utilities/TINYFILEDIALOGS/ftinyopen.F90
$(FC) -c $(FCOPT) src/utilities/TINYFILEDIALOGS/ftinyopen.F90
#==============================================================================
# Fortran modules (in dependency order)
#==============================================================================
ocparam.o: src/models/ocparam.F90
$(FC) -c $(FCOPT) src/models/ocparam.F90
# metlib4 needs ocparam.mod (from ocparam.o) and M_getkey.mod
metlib4.o: src/utilities/metlib4.F90 ocparam.o M_getkey.o ftinyopen.o
$(FC) -c $(FCOPT) -Dlixed -Dtinyfd $(HELPFLAG) src/utilities/metlib4.F90
oclablas.o: src/numlib/oclablas.F90
$(FC) -c $(FCOPT) src/numlib/oclablas.F90
ocnum.o: src/numlib/ocnum.F90
$(FC) -c $(FCOPT) -DNOLAPACK src/numlib/ocnum.F90
minpack1.o: src/numlib/minpack1.F90
$(FC) -c $(FCOPT) src/numlib/minpack1.F90
# gtp3 depends on all its #included sub-files plus the modules it USEs
gtp3.o: src/models/gtp3.F90 $(GTP3_INCS) ocparam.o ocnum.o metlib4.o
$(FC) -c $(FCOPT) src/models/gtp3.F90
matsmin.o: src/minimizer/matsmin.F90 gtp3.o minpack1.o
$(FC) -c $(FCOPT) src/minimizer/matsmin.F90
# WINFLAG=-Dnotwin on non-Windows; empty on Cygwin/Windows
smp2.o: src/stepmapplot/smp2.F90 $(SMP2_INCS) matsmin.o
$(FC) -c $(FCOPT) $(WINFLAG) src/stepmapplot/smp2.F90
# PLOTFLAG: -Dqtplt (Darwin/Qt), -Daqplt (Aqua), or empty (wxt default)
pmon6.o: src/userif/pmon6.F90 smp2.o
$(FC) -c $(FCOPT) $(PLOTFLAG) $(HELPFLAG) src/userif/pmon6.F90
#==============================================================================
# Link
#==============================================================================
$(EXE): $(OBJS)
# Stamp today's date into pmain1.F90
cp src/pmain1.F90 src/pmain1-save.F90
$(FC) -o linkoc src/linkocdate.F90
./linkoc
rm src/pmain1-save.F90
# Build static library
mkdir -p libs
ar sq $(LIBS_A) metlib4.o oclablas.o ocnum.o gtp3.o matsmin.o minpack1.o
# Link final executable
$(FC) -o $(EXE) $(FCOPT) src/pmain1.F90 $(OBJS) $(LIBS_A)
#==============================================================================
clean:
rm -f *.o *.mod linkoc $(EXE)
rm -f src/pmain1-save.F90
rm -rf libs
================================================
FILE: Makefile_MacOS
================================================
#
# Modified but not tested for the new directory structure
#
OBJS=getkey.o M_getkey.o ftinyopen.o tinyopen.o tinyfiledialogs.o metlib4.o oclablas.o ocnum.o minpack1.o gtp3.o matsmin.o smp2.o ocparam.o pmon6.o
LIBS=liboctq.o liboctqisoc.o liboctqcpp.o
EXE=oc6P
#
# IMPORTANT check at the getkey.o: label
#
# echo "Do not forget to uncomment a line for your OS"
#
#=============================================================================#
# original provided by Matthias Strathmann including OC examples
# NOTE getkey.o : you have to select which getkey routine to compile
#=============================================================================#
FC=gfortran
#=============================================================================#
# For MacOS
C=cc
#=============================================================================#
# For other Unix dialects
#C=gcc
#=============================================================================#
CPP=g++
FCOPT= -O2 -fopenmp -fPIC
# for debugging
#FCOPT= -fbounds-check -finit-local-zero
# no parallel
#FCOPT= -O2
#FC=ifort
# Compiler options for debug, -O1 reduces memory/register operations
#FCOPT= -O1 -fbounds-check -g -finit-local-zero
#=============================================================================#
#Available compilation flags: all, OCASI, OCASIEXAMPLES, clean
.PHONY : all OCASI OCASIEXAMPLES clean
#Compiles OpenCalphad to use as standalone Thermodynamic Equilibrium Calculation
#software.
# ************************************
# OC now requires GNUPLOT 5.2 or later
# ************************************
# To have the command line editing and history feature on your OS
# you must uncomment the appropriate line after the header getkey.o:
all: $(OBJS) $(EXE)
clean:
rm -r *.mod *.a $(LIBS) $(OBJS) linkoc $(EXE)_OCASI.so $(EXE)
#==============================================================================#
# To have the command line editing and history feature on your OS
# you must uncomment the appropriate line after the header getkey.o:
getkey.o:
echo "The line below for MacOS is used"
# compile utilities/GETKEY for command line editing
# This makefile use MacOS own cc compiler
# Mac >>
$(C) -c -DBSD src/utilities/GETKEY/getkey.c
# Linux >>
#$(C) -c -DLinux src/utilities/GETKEY/getkey.c
# other UNIX systems >>
#$(C) -c -DG77 src/utilities/GETKEY/getkey.c
# CYGWIN >>
#$(C) -c -DCYGWIN src/utilities/GETKEY/getkey.c
M_getkey.o:
$(FC) -c $(FCOPT) src/utilities/GETKEY/M_getkey.F90
tinyfiledialogs.o:
$(C) -c src/utilities/TINYFILEDIALOGS/tinyfiledialogs.c
tinyopen.o:
$(C) -c src/utilities/TINYFILEDIALOGS/tinyopen.c
ftinyopen.o:
$(FC) -c $(FCOPT) src/utilities/TINYFILEDIALOGS/ftinyopen.F90
metlib4.o: src/utilities/metlib4.F90
$(FC) -c $(FCOPT) src/models/ocparam.F90
# lixed for command line editing, tinyfd for open files
# lixhlp for browser help on Linux and MacOS
$(FC) -c $(FCOPT) -Dlixed -Dtinyfd -Dlixhlp src/utilities/metlib4.F90
oclablas.o: src/numlib/oclablas.F90
$(FC) -c $(FCOPT) src/numlib/oclablas.F90
ocnum.o: src/numlib/ocnum.F90
$(FC) -c $(FCOPT) -DNOLAPACK src/numlib/ocnum.F90
minpack1.o: src/numlib/minpack1.F90
$(FC) -c $(FCOPT) src/numlib/minpack1.F90
gtp3.o: src/models/gtp3.F90
$(FC) -c $(FCOPT) src/models/gtp3.F90
matsmin.o: src/minimizer/matsmin.F90
$(FC) -c $(FCOPT) src/minimizer/matsmin.F90
smp2.o: src/stepmapplot/smp2.F90
# Remove -Dnotwin if compiled on Windows (for spawning)
$(FC) -c $(FCOPT) -Dnotwin src/stepmapplot/smp2.F90
pmon6.o: src/userif/pmon6.F90
# default wxt graphical driver
# use -Dqtplt for Qt or (also smaller window)
# use -Daqplt for aqua plot drivers (also smaller window)
# use -Dlixhlp for online help in Linux
# use -Dmachlp for online help in MacOS (browser)
$(FC) -c $(FCOPT) -Dqtplt -Dmachlp src/userif/pmon6.F90
liboctq.o: ./examples/TQ4lib/Cpp/liboctq.F90
$(FC) -c -g $(FCOPT) ./examples/TQ4lib/Cpp/liboctq.F90
liboctqisoc.o: ./examples/TQ4lib/Cpp/Matthias/liboctqisoc.F90
$(FC) -c -g $(FCOPT) ./examples/TQ4lib/Cpp/Matthias/liboctqisoc.F90
liboctqcpp.o: ./examples/TQ4lib/Cpp/Matthias/liboctqcpp.cpp
$(CPP) -c -g $(FCOPT) ./examplesTQ4lib/Cpp/Matthias/liboctqcpp.cpp
$(EXE):
# Add date of linking to main program
cp src/pmain1.F90 src/pmain1-save.F90
$(FC) -o linkoc src/linkocdate.F90
./linkoc
rm src/pmain1-save.F90
# create library liboceq.a
mkdir -p libs
ar sq libs/liboceq.a metlib4.o oclablas.o ocnum.o gtp3.o matsmin.o minpack1.o
# If getkey.o is undefined below
# you have forgotten to uncomment a line above at getkey.o !!
$(FC) -o $(EXE) $(FCOPT) src/pmain1.F90 $(OBJS) libs/liboceq.a
# replace the version on Desktop
# rm ../../Desktop/$(EXE)
# cp $(EXE) ../../Desktop/
================================================
FILE: OCisoCbinding/liboctq.F90
================================================
!
!
! Update proposed by Romain Le Tellier and Clément Introïni
!
!
! Minimal TQ interface.
!
! To compile and link this with an application one must first compile
! and form a library with of the most OC subroutines (oclib.a)
! and to copy this and the corresponding "mov" files from this compilation
! to the folder with this library
!
! NOTE that for the identification of phase and composition sets this TQ
! interface use a Fortran TYPE called gtp_phasetuple containing five integers:
! lokph is the index of the phase in the phlista array
! compset is the composition index starting from 1
! ixphase is the index of the phase in the phases array
! lokvares is the index of the phase and compset in the phase_varres array
! nextcs if nonzero the index in the phasetuple array of next comp.set
!
! The number of phase tuples is initially equal to the number
! of phases and have the same index. This represent comp.set 1 of the
! phases as each phase has just one composition set. A phase may have
! several comp.sets created by calculations or by commands and these will
! have phase tuple index higher than the number of phases and their index
! is in the order of which they were created.
! This may cause some problems if composition sets are deleted because that
! will change the phase tuple index for those with higher index. So do not
! delete comp.sets or at least be very careful when deleting!
!
! 161103 BOS A few fixes for compatibility for version 4 release
! 150520 BOS added a few subroutines for single phase data and calculations
! 141210 BOS changed to use phase tuples
! 140128 BOS added D2G and phase specific V and G
! 140128 BOS added possibility to calculate without invoking grid minimizer
! 140125 BOS Changed name to liboctq
! 140123 BOS Added ouput of MQ G, V and normalized
!------------------------------------------------------------
! subroutines and functions
! tqini ok initiate
! tqrfil ok read a database file
! tqrpfil ok read specified elements from database file
! -------------------------
! tqgcom ok get number of system components and their names
! tqgnp ok get number of phase tuples (phases and comp. sets)
! tqgpn ok get name of phase tuple
! tqgpi ok get phase tuple index of phase using its name
! tqgpi2 ok get phase and composition indices of phase using its name
! tqgpcn2 ok get name of consitutent with index c in phase with index n
! tqgpci - get index of constituent of a phase using name
! tqgpcs ok get descrition of constituent c (stoichiometry, mass, charge)
! tqgccf - get stoichiometry of system component as elements
! tqgnpc - get number of constituents in phase
! -------------------------
! tqcref ok set reference state for component
! tqphsts ok set status of phase tuple
! tqphsts2 ok set status of many phases at the same time
! tqsetc ok set condition
! tqce ok calculate equilibrium
! tqgetv ok get equilibrium results as state variable values
! -------------------------
! tqgphc1 ok get phase constitution
! tqsphc1 ok set phase constitution
! tqcph1 ok calculate phase properties and return arrays
! tqcph2 ok calculate phase properties and return index
! tqcph3 ok calculate phase properties and return single array
! tqdceq ok delete equilibrium record
! tqcceq ok copy current equilibrium to a new one
! tqselceq ok select new current equilibrium
! tqgdmat ok calculate quantities related to diffusion matrix
! --------
! reset_conditions ok reset any condition on T
! Change_Status_Phase ok change status of a named phase
! tqlr ok listing of results on screen (for debugging)
! tqlc ok list current conditions (for debugging)
! tqtgsw ok toggle global status word of index i
! tqquiet ok set verbosity
!
!------------------------------------------------------------
!
! The name of this library
module liboctq
!
! access to main OC library for equilibrium calculations and models
use liboceqplus
!
implicit none
!
integer, parameter :: maxc=maxel,maxp=maxph
!
! This is for storage and use of components
integer nel
character, dimension(maxc) :: cnam*24
double precision, dimension(maxc) :: cmass
! Number of phase tuples
integer ntup
! use the array PHASETUPLE available from OC
! save phase constitution to speed up calculation by interpolation
double precision, allocatable, dimension(:,:) :: ysave
!
contains
!
!\begin{verbatim}
subroutine tqini(n,ceq)
! initiate workspace
implicit none
integer n ! Not nused, could be used for some initial allocation
type(gtp_equilibrium_data), pointer :: ceq ! EXIT: current equilibrium
!\end{verbatim}
! these should be provide linits and defaults
integer intv(10)
double precision dblv(10)
intv(1)=-1
! This call initiates the OC package
if (allocated(eqlista)) then
call new_gtp
endif
call init_gtp(intv,dblv)
ceq=>firsteq
write(*,*)'tqini created: ',ceq%eqname
1000 continue
return
end subroutine tqini
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqrfil(filename,ceq)
! read all elements from a TDB file
implicit none
character*(*) filename ! IN: database filename
character ellista(10)*2 ! dummy
type(gtp_equilibrium_data), pointer :: ceq !IN: current equilibrium
!\end{verbatim} %+
integer iz
character elname*2,name*24,refs*24
double precision a1,a2,a3
! second argument 0 means ellista is ignored, all element read
call readtdb(filename,0,ellista)
! ceq=>firsteq
nel=noel()
do iz=1,nel
! store the element name in the cname array
call get_element_data(iz,elname,name,refs,a1,a2,a3)
cnam(iz)=elname
enddo
! store phase tuples
ntup=nooftup()
1000 continue
return
end subroutine tqrfil
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim} %-
subroutine tqrpfil(filename,nsel,selel,ceq)
! read TDB file with selection of elements
implicit none
character*(*) filename ! IN: database filename
integer nsel
character selel(*)*2 ! IN: elements to be read from the database
type(gtp_equilibrium_data), pointer :: ceq !IN: current equilibrium
!\end{verbatim}
integer iz
character elname*2,name*24,refs*24
double precision a1,a2,a3
!
call readtdb(filename,nsel,selel)
if(gx%bmperr.ne.0) goto 1000
! is this really necessary??
! ceq=>firsteq
nel=noel()
do iz=1,nel
! store element name in module array components
call get_element_data(iz,elname,name,refs,a1,a2,a3)
cnam(iz)=elname
enddo
! store phase tuples and indices
ntup=nooftup()
1000 continue
return
end subroutine tqrpfil
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqgcom(n,compnames,ceq)
! get system component names. At present the elements
implicit none
integer n ! EXIT: number of components
character*24, dimension(*) :: compnames ! EXIT: names of components
type(gtp_equilibrium_data), pointer :: ceq !IN: current equilibrium
!\end{verbatim}
integer iz
character elname*24,refs*24
double precision a1,a2,a3
do iz=1,nel
compnames(iz)=' '
call get_element_data(iz,compnames(iz),elname,refs,a1,a2,a3)
! store name in module array components also (already done when reading TDB)
cnam(iz)=compnames(iz)
enddo
n=nel
1000 continue
return
end subroutine tqgcom
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqgnp(n,ceq)
! get total number of phase tuples (phases and composition sets)
! A second composition set of a phase is normally placed after all other
! phases with one composition set
implicit none
integer n !EXIT: n is number of phases
type(gtp_equilibrium_data), pointer :: ceq !IN: current equilibrium
!\end{verbatim}
! NOTE the number composition sets may change at a calculation or if new
! composition sets are added or deleted explicitly
! This changes the number of phase tuples!
ntup=nooftup()
n=ntup
1000 continue
return
end subroutine tqgnp
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqgpn(phtupx,phasename,ceq)
! get name of phase tuple with index phtupx (ceq redundant)
implicit none
integer phtupx ! IN: index in phase tuple array
character phasename*(*) !EXIT: phase name, max 24+8 for pre/suffix
type(gtp_equilibrium_data), pointer :: ceq !IN: current equilibrium
!\end{verbatim}
call get_phasetup_name(phtupx,phasename)
1000 continue
return
end subroutine tqgpn
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqgpi(phtupx,phasename,ceq)
! get phasetuple index of phase phasename (including comp.set (ceq redundant)
implicit none
integer phtupx !EXIT: phase tuple index
character phasename*(*) !IN: phase name
type(gtp_equilibrium_data), pointer :: ceq !IN: current equilibrium
!\end{verbatim}
call find_phasetuple_by_name(phasename,phtupx)
1000 continue
return
end subroutine tqgpi
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqgpi2(iph,ics,phasename,ceq)
! get indices of phase phasename (ceq redundant)
implicit none
integer iph, ics !EXIT: phase indices
character phasename*(*) !IN: phase name
type(gtp_equilibrium_data), pointer :: ceq !IN: current equilibrium
integer phtupx
!\end{verbatim}
call find_phasetuple_by_name(phasename,phtupx)
iph = phasetuple(phtupx)%ixphase
ics = phasetuple(phtupx)%compset
1000 continue
return
end subroutine tqgpi2
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqgpcn2(n,c,csname)
! get name of consitutent with index c in phase with index n
! NOTE An identical routine with different constituent index is tqgpcn
implicit none
integer n !IN: phase number (not phase tuple)
integer c !IN: constituent index sequentially over all sublattices
character csname*(*) !EXIT: costituent name
!\end{verbatim}
double precision mass
call get_constituent_name(n,c,csname,mass)
1000 continue
return
end subroutine tqgpcn2
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqgpci(n,c,constituentname,ceq)
! get index of constituent with name in phase n
implicit none
integer n !IN: phase index
!NO integer c !IN: extended constituent index: 10*species_number+sublattice
integer c !IN: sequantial constituent index over all sublattices
character constituentname*(*)
type(gtp_equilibrium_data), pointer :: ceq !IN: current equilibrium
!\end{verbatim}
write(*,*)'tqgpci not implemented yet'
gx%bmperr=8888
1000 continue
return
end subroutine tqgpci
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqgpcs(c,nspel,ielno,stoi,smass,qsp)
! get descrition of constituent c (stoichiometry, mass, charge)
implicit none
integer c !IN: sequential constituent index over all sublattices
integer nspel !EXIT: number of elements in species
integer ielno(*) !EXIT: element indices
double precision stoi(*) !EXIT: stoichiometry of elements
double precision smass !EXIT: mass
double precision qsp !EXIT: charge of the species
double precision extra(10)
integer nextra !number of additional values
!
call get_species_data(c,nspel,ielno,stoi,smass,qsp,nextra,extra)
1000 continue
return
end subroutine tqgpcs
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqgccf(n1,n2,elnames,stoi,mass,ceq)
! get stoichiometry of component n1
! n2 is number of elements (dimension of elnames and stoi)
implicit none
integer n1 !IN: component number
integer n2 !EXIT: number of elements in component
character elnames(*)*(2) ! EXIT: element symbols
double precision stoi(*) ! EXIT: element stoichiometry
double precision mass ! EXIT: component mass (sum of element mass)
type(gtp_equilibrium_data), pointer :: ceq !IN: current equilibrium
!\end{verbatim}
write(*,*)'tqgccf not implemented yet'
gx%bmperr=8888
1000 continue
return
end subroutine tqgccf
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqgnpc(n,c,ceq)
! get number of constituents of phase n
implicit none
integer n !IN: Phase number
integer c !EXIT: number of constituents
type(gtp_equilibrium_data), pointer :: ceq !IN: current equilibrium
!\end{verbatim}
write(*,*)'tqgnpc not implemented yet'
gx%bmperr=8888
1000 continue
return
end subroutine tqgnpc
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqphsts(phtupx,newstat,val,ceq)
! set status of phase tuple: SUSPEND, DORMANT, ENTERED, FIX
integer phtupx,newstat
double precision val
type(gtp_equilibrium_data), pointer :: ceq ! IN: current equilibrium
!\end{verbatim}
integer n
if(phtupx.le.0) then
! if tup<0 change status of all phases
do n=1,ntup
call change_phtup_status(n,newstat,val,ceq)
if(gx%bmperr.ne.0) goto 1000
enddo
elseif(phtupx.le.ntup) then
call change_phtup_status(phtupx,newstat,val,ceq)
else
write(*,*)'Illegal phase tuple index',phtupx
gx%bmperr=8888
endif
1000 continue
return
end subroutine tqphsts
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqphsts2(phnames,newstat,val,ceq)
! set status of many phases at the same time: SUSPEND, DORMANT, ENTERED, FIX
character phnames*(*)
integer newstat
double precision val
type(gtp_equilibrium_data), pointer :: ceq ! IN: current equilibrium
!\end{verbatim}
call change_many_phase_status(phnames,newstat,val,ceq)
1000 continue
return
end subroutine tqphsts2
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqsetc(stavar,n1,n2,value,cnum,ceq)
! set condition
! stavar is state variable as text
! n1 and n2 are auxilliary indices
! value is the value of the condition
! cnum is returned as an index of the condition.
! to remove a condition the value sould be equial to RNONE ????
! when a phase indesx is needed it should be 10*nph + ics
! see TQGETV for doucumentation of stavar etc.
implicit none
integer n1 ! IN: 0 or phase tuple index or component number
integer n2 ! IN: 0 or component number
integer cnum ! EXIT: sequential number of this condition
character stavar*(*) ! IN: character with state variable symbol
double precision value ! IN: value of condition
type(gtp_equilibrium_data), pointer :: ceq ! IN: current equilibrium
!\end{verbatim}
integer ip,ip2
character cline*60,selvar*4,cval*24
!
! write(*,11)'In tqsetc ',stavar(1:len_trim(stavar)),n1,n2,value
11 format(a,a,2i5,1pe14.6)
cline=' '
! extract a value after an =
ip=index(stavar,'=')
if(ip.gt.0) then
selvar=stavar(1:ip-1)
cval=stavar(ip:)
ip2=index(stavar,'(')
if(ip2.gt.0) then
ip = ip2
selvar=stavar(1:ip-1)
cval=stavar(ip:)
endif
! write(*,*)'Value after = :',cval
else
selvar=stavar
cval=' '
endif
call capson(selvar)
select case(selvar)
case default
write(*,*)'Condition wrong, not implemented or illegal: ',stavar
gx%bmperr=8888; goto 1000
! Potentials T and P
case('T ','P ')
if(ip.gt.0) then
cline=' '//stavar
else
! none condition
if( n2.lt.0) then
write(cline,109)selvar(1:1)
109 format(' ',a,'=none')
! numerical condition
else
write(cline,110)selvar(1:1),value
110 format(' ',a,'=',E15.8)
endif
endif
! Total amount or amount of a component in moles
case('N ')
if(ip.gt.0) then
cline=' '//stavar
else
if(n1.gt.0) then
! call get_component_name(n1,name,ceq)
! if(gx%bmperr.ne.0) goto 1000
! none condition
if( n2.lt.0) then
write(cline,108)selvar(1:1),cnam(n1)(1:len_trim(cnam(n1)))
108 format(' ',a,'(',a,')=none')
! numerical condition
else
write(cline,112)selvar(1:1),cnam(n1)(1:len_trim(cnam(n1))),value
112 format(' ',a,'(',a,')=',E15.8)
endif
! write(*,*)'Setting condition: ',cline(1:len_trim(cline))
else
! none condition
if( n2.lt.0) then
write(cline,109)selvar(1:1)
! numerical condition
else
write(cline,110)selvar(1:1),value
endif
endif
endif
! Overall fraction of a component
case('X ','W ')
! ?? fraction of phase component not implemented, n1 must be component number
! call get_component_name(n1,cnam,ceq)
! if(gx%bmperr.ne.0) goto 1000
if(ip.gt.0) then
cline=' '//stavar
else
write(cline,120)selvar(1:1),cnam(n1)(1:len_trim(cnam(n1))),value
120 format(1x,a,'(',a,')=',1pE15.8)
endif
case('H ','V ')
! enthalpy or volume of system
if(cval(1:1).eq.'=') then
cline=' '//stavar
else
write(cline,130)selvar(1:1),value
130 format(1x,a,'=',1pE15.8)
endif
case('MU ','AC ')
if(ip.gt.0) then
cline=' '//stavar
else
if(n1.gt.0) then
! none condition
if(n2.lt.0) then
write(cline,108)selvar(1:1),cnam(n1)(1:len_trim(cnam(n1)))
! numerical condition
else
write(cline,113)selvar(1:2),cnam(n1)(1:len_trim(cnam(n1))),value
113 format(' ',a2,'(',a,')=',E15.8)
endif
write(*,*)'Setting condition: ',cline(1:len_trim(cline))
else
! none condition
if(n2.lt.0) then
write(cline,109)selvar(1:1)
! numerical condition
else
write(cline,110)selvar(1:1),value
endif
endif
endif
! case ....
! ?? MORE CONDITIONS WILL BE ADDED ...
end select
! write(*,*)'tqsetc condition: ',trim(cline)
ip=1
call set_condition(cline,ip,ceq)
if(gx%bmperr.ne.0) then
write(*,*)'Error setting condition: ',cline(1:len_trim(cline)),ip
endif
1000 continue
return
end subroutine tqsetc
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqtgsw(i)
! toggle global status word of index i
implicit none
integer i
!\end{verbatim}
if(btest(globaldata%status,i)) then
globaldata%status=ibclr(globaldata%status,i)
write(*,10) i,'unset '
else
globaldata%status=ibset(globaldata%status,i)
write(*,10) i,'set '
endif
10 format('bit ',i2 ,a)
return
end subroutine tqtgsw
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqce(target,n1,n2,value,ceq)
! calculate quilibrium with possible target
! Target can be empty or a state variable with indices n1 and n2
! value is the calculated value of target
implicit none
integer n1,n2,mode
character target*(*)
double precision value
logical confirm
type(gtp_equilibrium_data), pointer :: ceq !IN: current equilibrium
!\end{verbatim}
integer nyfas,j1,j2
! mode=1 means start values using global gridminimization
if(n1.lt.0) then
! this means calculate without grid minimuzer
mode=0
confirm=.FALSE.
! calcqeq3 is silent, no listing of phase changes etc.
call calceq3(mode,confirm,ceq)
else
mode=1
call calceq2(mode,ceq)
endif
if(gx%bmperr.ne.0) goto 1000
! there may be new composition sets, update ntup
! write(*,*)'Number of phase tuples: ',ntup
nyfas=nooftup()
! write(*,*)'Number of phase tuples: ',ntup,nyfas
if(nyfas.ne.ntup) then
! write(*,*)'Number of phase tuples changed: ',nyfas,ntup
ntup=nyfas
endif
if(allocated(ysave)) deallocate(ysave)
allocate(ysave(nyfas,maxconst))
! copy the constitution to a local save array
! the intention of saving constitution is to make it possible to interpolate
! the calculation of G if the constitution is changed very little
do j1=1,nyfas
do j2=1,size(ceq%phase_varres(phasetuple(j1)%lokvares)%yfr)
ysave(j1,j2)=ceq%phase_varres(phasetuple(j1)%lokvares)%yfr(j2)
enddo
enddo
1000 continue
return
end subroutine tqce
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqgetv(stavar,n1,n2,n3,values,ceq)
! get equilibrium results using state variables
! stavar is the state variable IN CAPITAL LETTERS with indices n1 and n2
! n1 can be a phase tuple index, n2 a component index
! n3 at the call is the dimension of the array values,
! changed to number of values on exit
! value is an array with the calculated value(s), n3 set to number of values.
implicit none
integer n1,n2,n3
character stavar*(*)
double precision values(*)
type(gtp_equilibrium_data), pointer :: ceq !IN: current equilibrium
!========================================================
! stavar must be a symbol listed below
! IMPORTANT: some terms explained after the table
! Symbol index1,index2 Meaning (unit)
!.... potentials
! T 0,0 Temperature (K)
! P 0,0 Pressure (Pa)
! MU component,0 or ext.phase.index*1,constituent*2 Chemical potential (J)
! AC component,0 or ext.phase.index,constituent Activity = EXP(MU/RT)
! LNAC component,0 or ext.phase.index,constituent LN(activity) = MU/RT
!...... extensive variables
! U 0,0 or ext.phase.index,0 Internal energy (J) whole system or phase
! UM 0,0 or ext.phase.index,0 same per mole components
! UW 0,0 or ext.phase.index,0 same per kg
! UV 0,0 or ext.phase.index,0 same per m3
! UF ext.phase.index,0 same per formula unit of phase
! S*3 0,0 or ext.phase.index,0 Entropy (J/K)
! V 0,0 or ext.phase.index,0 Volume (m3)
! H 0,0 or ext.phase.index,0 Enthalpy (J)
! A 0,0 or ext.phase.index,0 Helmholtz energy (J)
! G 0,0 or ext.phase.index,0 Gibbs energy (J)
! ..... some extra state variables
! NP ext.phase.index,0 Moles of phase
! BP ext.phase.index,0 Mass of moles (kg)
! Q ext.phase.index,0 Internal stability/RT (dimensionless)
! DG ext.phase.index,0 Driving force/RT (dimensionless)
!....... amounts of components
! N 0,0 or component,0 or ext.phase.index,component Moles of component
! X component,0 or ext.phase.index,component Mole fraction of component
! B 0,0 or component,0 or ext.phase.index,component Mass of component
! W component,0 or ext.phase.index,component Mass fraction of component
! Y ext.phase.index,constituent*1 Constituent fraction
!........ some parameter identifiers
! TC ext.phase.index,0 Magnetic ordering temperature
! BMAG ext.phase.index,0 Aver. Bohr magneton number
! MQ& ext.phase.index,constituent Mobility
! THET ext.phase.index,0 Debye temperature
! LNX ext.phase.index,0 Lattice parameter
! EC11 ext.phase.index,0 Elastic constant C11
! EC12 ext.phase.index,0 Elastic constant C12
! EC44 ext.phase.index,0 Elastic constant C44
!........ NOTES:
! *1 The ext.phase.index is 10*phase_number+comp.set_number
! *2 The constituent index is 10*species_number + sublattice_number
! *3 S, V, H, A, G, NP, BP, N, B and DG can have suffixes M, W, V, F also
!--------------------------------------------------------------------
! special addition for TQ interface: d2G/dyidyj
! D2G + phase tuple
!--------------------------------------------------------------------
!\end{verbatim}
double precision tpfunvalue
integer ics,mjj,nph,ki,kj,lp,lokph,lokcs
character statevar*60,encoded*2048,name*24,selvar*4,norm*4
! mjj should be the dimension of the array values ...
mjj=n3
selvar=stavar
call capson(selvar)
! for state variables like MQ&FE remove the part from & before the select
! write(*,11)'In tqgetv: ',selvar,n1,n2,n3
11 format(a,a,3i5)
norm=' '
lp=index(selvar,'&')
if(lp.gt.0) then
selvar(lp:)=' '
else
! check if variable is normallized
ki=len_trim(selvar)
if(ki.ge.2) then
if(selvar(ki:ki).eq.'M') then
norm='M'
selvar(ki:)=' '
ki=ki-1
endif
endif
endif
!=======================================================================
kj=index(selvar,'(')
if(kj.gt.0) then
selvar=selvar(1:kj-1)
endif
! write(*,*)'tqgetv 0: ',kj,selvar,'>',stavar,'<'
select case(selvar)
case default
write(*,*)'Unknown state variable: ',stavar(1:20),'>:<',selvar
gx%bmperr=8888; goto 1000
!--------------------------------------------------------------------
! T or P
case('T ','P ')
call get_state_var_value(selvar,values(1),encoded,ceq)
n3=1
!--------------------------------------------------------------------
! chemical potential for a component
case('MU ','MUS ')
if(n1.lt.-1 .or. n1.eq.0) then
write(*,*)'tqgetv 17: component number must be positive'
gx%bmperr=8888; goto 1000
elseif(n1 .eq.-1) then
! this means all components
statevar=trim(selvar)//'(*)'
call get_many_svar(statevar,values,mjj,n3,encoded,ceq)
elseif(n1.le.noel()) then
statevar=trim(selvar)//'('//trim(cnam(n1))//') '
! write(*,*)'tqgetv 4: ',statevar(1:len_trim(statevar))
! we must use index value(1) as the subroutine expect a single variable
call get_state_var_value(statevar,values(1),encoded,ceq)
n3=1
else
write(*,*)'No such component'
endif
!--------------------------------------------------------------------
! Amount of moles /mass of components in a phase
case('NP ', 'BP ')
if(n1.lt.0) then
! all phases
statevar=stavar(1:2)//'(*)'
! this returns all composition sets for all phases
call get_many_svar(statevar,values,mjj,n3,encoded,ceq)
! this output gives the amounts for all compsets of a phase sequentially
! but here we want them in phase tuple order
! the second argument is the number of values for each phase, here is 1 but
! it can be for example compositions, then it should be number of components
call sortinphtup(n3,1,values)
else
! NP for just one phase
call get_phasetup_name(n1,name)
if(gx%bmperr.ne.0) goto 1000
statevar='NP('//trim(name)//') '
call get_state_var_value(statevar,values(1),encoded,ceq)
n3=1
endif
!--------------------------------------------------------------------
! Mole or mass fractions
case('N ','B ','X ','W ')
! write(*,*)'in tqgetv n,x,w: ',n1,n2,n3
if(n2.eq.0) then
if(n1.lt.0) then
! moles, mole or mass fraction of all components for all phases
statevar=stavar(1:1)//'(*) '
! write(*,*)'tqgetv 3: ',mjj,statevar(1:len_trim(statevar))
call get_many_svar(statevar,values,mjj,n3,encoded,ceq)
elseif(n1.eq.0) then
! mole fraction for the state variable written as X(FE)
! n1 and n2 not used, just check for wildcard
! write(*,*)'tqgetv 20: ',stavar(1:len_trim(stavar))
if(index(stavar,'*').gt.0) then
call get_many_svar(stavar,values,mjj,n3,encoded,ceq)
else
call get_state_var_value(stavar,values(1),encoded,ceq)
endif
else
! mole fraction of a single component, no phase specification
n3=1
ics=1
! call get_component_name(n1,name,ceq)
! if(gx%bmperr.ne.0) goto 1000
statevar=stavar(1:1)//'('//trim(cnam(n1))//')'
! write(*,*)'tqgetv 4: ',statevar(1:len_trim(statevar))
call get_state_var_value(statevar,values(1),encoded,ceq)
endif
elseif(n1.lt.0) then
!........................................................
! for all phases one or several components
if(n2.lt.0) then
! this means all components all phases, for example x(*,*)
statevar=stavar(1:1)//'(*,*) '
! write(*,*)'tqgetv 5: ',mjj,statevar(1:len_trim(statevar))
call get_many_svar(statevar,values,mjj,n3,encoded,ceq)
! this output gives the composition for all compsets of a phase sequentially
! but we want them in phase tuple order
! The second argument is the number of values for each phase, noel()
! in this case
ics=noel()
call sortinphtup(n3,ics,values)
else
! a single component in all phases. n2 must not be zero
! call get_component_name(n2,name,ceq)
! if(gx%bmperr.ne.0) goto 1000
if(n2.le.0 .or. n2.ge.noel()) then
write(*,*)'No such component'
goto 1000
endif
! state variable like w(*,cr), the Cr content in all (stable) phases
statevar=stavar(1:1)//'(*,'//cnam(n2)(1:len_trim(cnam(n2)))//')'
! write(*,*)'tqgetv 6: ',mjj,statevar(1:len_trim(statevar))
call get_many_svar(statevar,values,mjj,n3,encoded,ceq)
! this output gives the composition for all compsets of a phase sequentially
! but we want them in phase tuple order
! The second argument is the number of values for each phase, in this case 1
! ics=noel()
ics=1
call sortinphtup(n3,ics,values)
endif
elseif(n2.lt.0) then
! this means all components in one phase
call get_phasetup_name(n1,name)
if(gx%bmperr.ne.0) goto 1000
statevar=stavar(1:1)//'('//trim(name)//',*) '
call get_many_svar(statevar,values,mjj,n3,encoded,ceq)
else
! one component (n2) of one phase (n1)
call get_phasetup_name(n1,name)
if(gx%bmperr.ne.0) goto 1000
statevar=stavar(1:1)//'('//trim(name)//','
call get_component_name(n2,name,ceq)
if(gx%bmperr.ne.0) goto 1000
statevar(len_trim(statevar)+1:)=trim(name)//') '
! write(*,*)'tqgetv 8: ',statevar
call get_state_var_value(statevar,values(1),encoded,ceq)
endif
!--------------------------------------------------------------------
! volume
case('V ')
if(norm(1:1).ne.' ') then
statevar='V'//norm
ki=2
else
statevar='V '
ki=1
endif
if(n1.gt.0) then
! Volume for a specific phase
call get_phasetup_name(n1,name)
if(gx%bmperr.ne.0) goto 1000
statevar=statevar(1:ki)//'('//trim(name)//') '
call get_state_var_value(statevar,values(1),encoded,ceq)
n3=1
else
! Total volume
call get_state_var_value(statevar,values(1),encoded,ceq)
n3=1
endif
!--------------------------------------------------------------------
! Enthalpy
case('H ')
! phase specifier not allowed
if(norm(1:1).ne.' ') then
statevar='H'//norm
ki=2
else
statevar='H '
ki=1
endif
! write(*,*)'tqgetv 1: ',n1,ki
if(n1.gt.0) then
! Gibbs energy for a specific phase
call get_phasetup_name(n1,name)
if(gx%bmperr.ne.0) goto 1000
statevar=statevar(1:ki)//'('//trim(name)//') '
call get_state_var_value(statevar,values(1),encoded,ceq)
n3=1
else
! Total enthalpy
call get_state_var_value(statevar,values(1),encoded,ceq)
n3=1
endif
!--------------------------------------------------------------------
! Gibbs energy
case('G ')
! phase specifier not allowed
if(norm(1:1).ne.' ') then
statevar='G'//norm
ki=2
else
statevar='G '
ki=1
endif
! write(*,*)'tqgetv 1: ',n1,ki
if(n1.gt.0) then
! Gibbs energy for a specific phase
call get_phasetup_name(n1,name)
if(gx%bmperr.ne.0) goto 1000
statevar=statevar(1:ki)//'('//trim(name)//') '
! write(*,*)'tqgetv 3: ',statevar
call get_state_var_value(statevar,values(1),encoded,ceq)
n3=1
else
! Total Gibbs energy
call get_state_var_value(statevar,values(1),encoded,ceq)
n3=1
endif
!--------------------------------------------------------------------
! Mobilities
case('MQ ')
call get_phasetup_name(n1,name)
if(gx%bmperr.ne.0) goto 1000
statevar=stavar(1:len_trim(stavar))//'('//trim(name)//')'
! write(*,*)'statevar: ',statevar
call get_state_var_value(statevar,values(1),encoded,ceq)
!--------------------------------------------------------------------
! Second derivatives of the Gibbs energy of a phase
case('D2G ')
lokcs=phasetuple(n1)%lokvares
! this gives wrong value!! ??
n3=size(ceq%phase_varres(lokcs)%yfr)
! write(*,*)'D2G 3: ',n3
kj=(n3*(n3+1))/2
! write(*,*)'D2G 3: ',kj
do ki=1,kj
values(ki)=ceq%phase_varres(lokcs)%d2gval(ki,1)
enddo
end select
!===========================================================================
1000 continue
return
end subroutine tqgetv
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqgdmat(phtupx,tpval,xknown,cpot,tyst,nend,mugrad,mobval,consnames,n1,ceq)
! equilibrates the constituent fractions of a phase for mole fractions xknown
! and calculates the Darken matrix and unreduced diffusivities
! phtup is phase tuple
! tpval is T and P
! ceq is a datastructure with all relevant thermodynamic data
! cpot are the (calculated) chemical potentials
! tyst is TRUE means no outut
! nend is the number of values returned in mugrad
! mugrad are the derivatives of the chemical potentials wrt mole fractions??
! mobval are the mobilities
implicit none
integer phtupx ! IN: index in phase tuple array
integer nend
logical tyst
double precision tpval(*),xknown(*),cpot(*),mugrad(*),mobval(*)
character*24, dimension(*) :: consnames
integer n1
TYPE(gtp_phasetuple), pointer :: phtup
TYPE(gtp_equilibrium_data), pointer :: ceq
!\end{verbatim}
integer iph, ics, ll
double precision mass
character*24 spname
phtup=>phasetuple(phtupx)
call equilph1d(phtup,tpval,xknown,cpot,tyst,nend,mugrad,mobval,ceq)
iph=phasetuple(phtupx)%ixphase
ics=1
n1 = noconst(iph,ics,firsteq)
do ll=1,n1
call get_constituent_name(iph,ll,consnames(ll),mass)
enddo
end subroutine tqgdmat
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqgphc1(n1,nsub,cinsub,spix,yfrac,sites,extra,ceq)
! tq_get_phase_constitution
! This subroutine returns the sublattices and constitution of a phase
! n1 is phase tuple index
! nsub is the number of sublattices (1 if no sublattices)
! cinsub is an array with the number of constítuents in each sublattice
! spix is an array with the species index of the constituents in all sublattices
! sites is an array of the site ratios for all sublattices.
! yfrac is the constituent fractions in same order as in spix
! extra is an array with some extra values:
! extra(1) is the number of moles of components per formula unit
! extra(2) is the net charge of the phase
implicit none
integer n1,nsub,cinsub(*),spix(*)
double precision sites(*),yfrac(*),extra(*)
type(gtp_equilibrium_data), pointer :: ceq
!\end{verbatim}
call get_phase_data(phasetuple(n1)%ixphase,phasetuple(n1)%compset,&
nsub,cinsub,spix,yfrac,sites,extra,ceq)
1000 continue
return
end subroutine tqgphc1
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqsphc1(n1,yfra,extra,ceq)
! tq_set_phase_constitution
! To set the constitution of a phase
! n1 is phase tuple index
! yfra is an array with the constituent fractions in all sublattices
! in the same order as obtained by tqgphc1
! extra is an array with returned values with the same meaning as in tqgphc1
! NOTE The constituents fractions are normallized to sum to unity for each
! sublattice and extra is calculated by tqsphc1
! T and P must be set as conditions.
implicit none
integer n1
double precision yfra(*),extra(*)
type(gtp_equilibrium_data), pointer :: ceq
!\end{verbatim}
call set_constitution(phasetuple(n1)%ixphase,phasetuple(n1)%compset,&
yfra,extra,ceq)
1000 continue
return
end subroutine tqsphc1
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqcph1(n1,n2,n3,gtp,dgdy,d2gdydt,d2gdydp,d2gdy2,ceq)
! tq_calculate_phase_properties
!vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
! WARNIG: this is not a subroutine to calculate chemical potentials
! those can only be obtained by an equilibrium calculation.
! The values returned are partial derivatives of G for the phase at the
! current T, P and phase constitution. The phase constitution has been
! obtained by a previous equilibrium calculation or
! set by the subroutine tqsphc
! The subroutine is equivalent to the "calculate phase" command.
!
! NOTE that values are per formula unit divided by RT,
! divide also by extra(1) in subroutine tqsphc1 to get them per mole component
!
!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
! calculate G and some or all derivatives for a phase at current composition
! n1 is the phase tuple index
! n2 is 0 if only G and derivatves wrt T and P, 1 also first drivatives wrt
! compositions, 2 if also 2nd derivatives
! n3 is returned as number of constituents (dimension of returned arrays)
! gtp is an array with G, G.T, G:P, G.T.T, G.T.P and G.P.P
! dgdy is an array with G.Yi
! d2gdydt is an array with G.T.Yi
! d2gdydp is an array with G.P.Yi
! d2gdy2 is an array with the upper triangle of the symmetrix matrix G.Yi.Yj
! returned in the order: 1,1; 1,2; 1,3; ...
! 2,2; 2,3; ...
! 3,3; ...
! for indexing one can use the integer function ixsym(i1,i2)
implicit none
integer n1,n2,n3
double precision gtp(6),dgdy(*),d2gdydt(*),d2gdydp(*),d2gdy2(*)
type(gtp_equilibrium_data), pointer :: ceq
!\end{verbatim} %+
integer ij,lokres,nofc
! write(*,*)'tqcph1 1: ',ceq%eqname
! write(*,*)'tqcph1 2',phasetuple(n1)%ixphase,phasetuple(n1)%compset
!----------------------------------------------------------------------
! THIS IS NO EQUILIBRIUM, JUST G AND DERIVATIVES FOR CURRENT T, P AND Y
call calcg(phasetuple(n1)%ixphase,phasetuple(n1)%compset,n2,lokres,ceq)
!----------------------------------------------------------------------
! write(*,*)'tqcph1 3A',lokres,gx%bmperr
n3=size(ceq%phase_varres(lokres)%yfr)
! write(*,*)'tqcph1 3C',n3
! gval last index is the property, other properties can also be extracted
! t.ex. mobilites
! The application program can also access these data directly ...
if(gx%bmperr.eq.0) then
do ij=1,6
gtp(ij)=ceq%phase_varres(lokres)%gval(ij,1)
enddo
do ij=1,n3
dgdy(ij)=ceq%phase_varres(lokres)%dgval(1,ij,1)
d2gdydt(ij)=ceq%phase_varres(lokres)%dgval(2,ij,1)
d2gdydp(ij)=ceq%phase_varres(lokres)%dgval(3,ij,1)
enddo
! size of upper triangle of symetrix matrix
nofc=n3*(n3+1)/2
do ij=1,nofc
d2gdy2(ij)=ceq%phase_varres(lokres)%d2gval(ij,1)
enddo
else
gtp=zero
do ij=1,nofc
dgdy(ij)=zero
d2gdydt(ij)=zero
d2gdydp(ij)=zero
enddo
nofc=nofc*(nofc+1)/2
do ij=1,nofc
d2gdy2(ij)=zero
enddo
endif
1000 continue
return
end subroutine tqcph1
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim} %-
subroutine tqcph2(n1,n2,n3,n4,ceq)
! tq_calculate_phase_properties
!vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
! WARNIG: this is not a subroutine to calculate chemical potentials
! those can only be made by an equilibrium calculation.
! The values returned are partial derivatives of G for the phase at the
! current T, P and phase constitution. The phase constitution has been
! obtained by a previous equilibrium calculation or
! set by the subroutine tqsphc
! It corresponds to the "calculate phase" command.
!
! NOTE that values are per formula unit divided by RT,
! divide also by extra(1) in subroutine tqsphc1 to get them per mole component
!
!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
! calculate G and some or all derivatives for a phase at current composition
! n1 is the phase tuple index
! n2 is type of calculation (0, 1 or 2)
! n3 is returned as number of constituents
! n4 is index to ceq%phase_varres(lokres)% with all results
! for indexing one can use the integer function ixsym(i1,i2)
implicit none
integer n1,n2,n3,n4
type(gtp_equilibrium_data), pointer :: ceq
!\end{verbatim}
integer ij,lokres,nofc
! write(*,*)'tqcph1 1: ',ceq%eqname
! write(*,*)'tqcph1 2',phasetuple(n1)%ixphase,phasetuple(n1)%compset
!----------------------------------------------------------------------
! THIS IS NO EQUILIBRIUM, JUST G AND DERIVATIVES FOR CURRENT T, P AND Y
call calcg(phasetuple(n1)%ixphase,phasetuple(n1)%compset,n2,lokres,ceq)
!----------------------------------------------------------------------
! write(*,*)'tqcph1 3A',lokres,gx%bmperr
! this should work but gave segmentation fault, find this a more cumbersum way
n3=size(ceq%phase_varres(lokres)%yfr)
n4=lokres
! Uer can access results like
! ceq%phase_varres(n4)%gval(1..6,1..prop)
! prop=1 is G, other can be t.ex. Curie T, mobilites etc
! ceq%phase_varres(lokres)%dgval(1,ij,1) are dG/dy(ij)
! ceq%phase_varres(lokres)%dgval(2,ij,1) are d2G/dy(ij)dT
! ceq%phase_varres(lokres)%dgval(3,ij,1) are d2G/dy(ij)dP
! ceq%phase_varres(lokres)%d2gval(ij,1) are d2G/dy(i)dy(j)
! arranged as a single dimenion array indexed by ixsym(i,j)
!
! NEVER CHANGE THE CONSTITUTION DIRECTLY, using n4, ALWAYS CALL tqsph1(...)
!
1000 continue
return
end subroutine tqcph2
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqcph3(n1,n2,g,ceq)
! tq_calculate_phase_properties
!vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
! WARNIG: this is not a subroutine to calculate chemical potentials
! those can only be made by an equilibrium calculation.
! The values returned are partial derivatives of G for the phase at the
! current T, P and phase constitution. The phase constitution has been
! obtained by a previous equilibrium calculation or
! set by the subroutine tqsphc
! It corresponds to the "calculate phase" command.
!
! NOTE that values are per formula unit divided by RT,
! divide also by extra(1) in subroutine tqsphc1 to get them per mole component
!
!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
! calculate G and some or all derivatives for a phase at current composition
! n1 is the phase tuple index
! n2 is 0 if only G and derivatves wrt T and P, 1 also first drivatives wrt
! compositions, 2 if also 2nd derivatives
! g is an array with G derivatives under the form:
! G_m^\alpha = G_M^\alpha/N^\alpha, \frac{\partial G_m^\alpha}{\partial T}, \frac{\partial G_m^\alpha}{\partial P}, \frac{\partial^2 G_m^\alpha}{\partial T^2}
! 1/N^\alpha * \frac{\partial G_M^\alpha}{\partial y_i} (if n2>=1)
! 1/N^\alpha * \frac{\partial^2 G_M^\alpha}{\partial y_i\partial y_j} (if n2>=2)
implicit none
integer n1,n2
double precision g(*)
type(gtp_equilibrium_data), pointer :: ceq
!\end{verbatim} %+
integer lokres
integer ncons, ndcons, count
double precision napfu, rgast
TYPE(gtp_phase_varres), pointer :: parres
!----------------------------------------------------------------------
! THIS IS NO EQUILIBRIUM, JUST G AND DERIVATIVES FOR CURRENT T, P AND Y
call calcg(phasetuple(n1)%ixphase,phasetuple(n1)%compset,n2,lokres,ceq)
!----------------------------------------------------------------------
ncons=noconst(phasetuple(n1)%ixphase,phasetuple(n1)%compset,firsteq)
ndcons=ncons*(ncons+1)/2
count=1
napfu=ceq%phase_varres(lokres)%abnorm(1)
rgast=globaldata%rgas*ceq%tpval(1)
parres=>ceq%phase_varres(lokres)
! G_m^\alpha = G_M^\alpha/N^\alpha, \frac{\partial G_m^\alpha}{\partial T}, \frac{\partial G_m^\alpha}{\partial P}, \frac{\partial^2 G_m^\alpha}{\partial T^2}
g(count:count+3) = rgast*parres%gval(1:4,1)/napfu
count = count + 4
if (n2>0) then
! 1/N^\alpha * \frac{\partial G_M^\alpha}{\partial y_i}
g(count:count+ncons-1) = rgast*parres%dgval(1,1:ncons,1)/napfu
count = count + ncons
if (n2>1) then
! 1/N^\alpha * \frac{\partial^2 G_M^\alpha}{\partial y_i\partial y_j}
g(count:count+ndcons-1) = rgast*parres%d2gval(1:ndcons,1)/napfu
endif
endif
end subroutine tqcph3
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqdceq(name)
! delete equilibrium with name
implicit none
character name*24
! integer n1
!\end{verbatim}
integer n1
call findeq(name,n1)
! print *, name, n1
if(gx%bmperr.ne.0) goto 1000
! do not allow delete equilibrium 1
if(n1.eq.1) then
write(*,*)'No allowed to delete default equilibrium'
gx%bmperr=4333
goto 1000
endif
call delete_equilibria(name,firsteq)
1000 continue
return
end subroutine tqdceq
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqcceq(name,n1,newceq,ceq)
! copy_current_equilibrium to newceq
! creates a new equilibrium record with name with values same as ceq
! n1 is returned as index
implicit none
character name*24
integer n1
type(gtp_equilibrium_data), pointer :: newceq,ceq
!\end{verbatim}
!call enter_equilibrium(name,n1)
!if(gx%bmperr.ne.0) goto 1000
!newceq=>eqlista(n1)
call copy_equilibrium(newceq,name,ceq)
newceq%status=ibclr(newceq%status,EQNOACS)
1000 continue
return
end subroutine tqcceq
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqselceq(name,ceq)
! select current equilibrium to be that with name.
! Note that equilibria can be deleted and change number but not name
implicit none
character name*24
type(gtp_equilibrium_data), pointer :: ceq
!\end{verbatim}
integer n1
call findeq(name,n1)
! print *, name, n1
if(gx%bmperr.ne.0) goto 1000
call selecteq(n1,ceq)
! print *, name, n1, loc(ceq)
1000 continue
return
end subroutine tqselceq
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine reset_conditions(cline,ceq)
!reset any condition on temperature
implicit none
character cline*24
type(gtp_equilibrium_data), pointer :: ceq
!\end{verbatim}
integer ip
ip=0
! write(*,*) cline
call set_condition(cline,ip,ceq)
1000 continue
return
end subroutine reset_conditions
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine Change_Status_Phase(myname,nystat,myval,ceq)
implicit none
character myname*24
integer nystat
double precision myval
type(gtp_equilibrium_data), pointer :: ceq
!\end{verbatim}
integer iph,ics
call find_phase_by_name(myname,iph,ics)
call change_phase_status(iph,ics,nystat,myval,ceq)
1000 continue
return
end subroutine Change_Status_Phase
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqcref(ciel,phase,tpref,ceq)
! set component reference state
integer ciel
character phase*(*)
double precision tpref(*)
type(gtp_equilibrium_data), pointer :: ceq ! IN: current equilibrium
!\end{verbatim}
integer phtupx
call find_phasetuple_by_name(phase,phtupx)
if(gx%bmperr.ne.0) goto 1000
call set_reference_state(ciel,phtupx,tpref,ceq)
1000 continue
return
end subroutine tqcref
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqlr(lut,ceq)
! list the equilibrium results like in OC
implicit none
integer lut
type(gtp_equilibrium_data), pointer :: ceq
!\end{verbatim}
integer phtupx,iph,ics,lokvares,mode
logical once
write(lut,10)
10 format(/20('*')/'Start debug output from TQLR: ')
call list_conditions(lut,ceq)
call list_global_results(lut,ceq)
call list_components_result(lut,1,ceq)
once=.TRUE.
mode=0
do phtupx=1,nooftup()
lokvares=phasetuple(phtupx)%lokvares
if(ceq%phase_varres(lokvares)%phstate.ge.phentstab) then
iph=phasetuple(phtupx)%ixphase
ics=phasetuple(phtupx)%compset
call list_phase_results(iph,ics,mode,lut,once,ceq)
endif
enddo
write(lut,20)
20 format('End debug output from TQLR'/20('*')/)
1000 continue
return
end subroutine tqlr
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqlc(lut,ceq)
! list conditions like in OC
implicit none
integer lut
type(gtp_equilibrium_data), pointer :: ceq
!\end{verbatim}
write(lut,10)
10 format(/'Debug output from TQLC: ')
call list_conditions(lut,ceq)
1000 continue
return
end subroutine tqlc
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine tqquiet(yes)
! if argument TRUE spurious output should be suppressed
implicit none
logical yes
!\end{verbatim}
if(yes) then
globaldata%status=ibclr(globaldata%status,GSVERBOSE)
globaldata%status=ibset(globaldata%status,GSSILENT)
else
globaldata%status=ibset(globaldata%status,GSVERBOSE)
endif
return
end subroutine tqquiet
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
end MODULE LIBOCTQ
================================================
FILE: OCisoCbinding/liboctqisoc.F90
================================================
!
!
! Part of iso-C binding for OC TQlib from Teslos
! modified by Matthias Stratmann, Christophe Sigli,
! and Bo Sundman
!
! Update proposed by Romain Le Tellier and Clément Introïni
!
MODULE cstr
!
! convert characters from Fortran to C and vice versa
contains
function c_to_f_string(s) result(str)
use iso_c_binding
implicit none
character(kind=c_char,len=1), intent(in) :: s(*)
character(len=:), allocatable :: str
integer i, nchars
i = 1
do
if (s(i) == c_null_char) exit
i = i + 1
end do
nchars = i - 1 ! Exclude null character from Fortran string
allocate(character(len=nchars) :: str)
str = transfer(s(1:nchars), str)
end function c_to_f_string
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
subroutine c_to_f_str(s,sty)
use iso_c_binding
implicit none
character(kind=c_char,len=1), intent(in) :: s(*)
character(len=24), intent(out) :: sty
character(len=:), allocatable :: str
integer i, nchars
i = 1
do
if (s(i) == c_null_char) exit
i = i + 1
end do
nchars = i - 1 ! Exclude null character from Fortran string
allocate(character(len=nchars) :: str)
sty = transfer(s(1:nchars), str)
deallocate (str)
end subroutine c_to_f_str
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
subroutine f_to_c_string(fstring, cstr)
use iso_c_binding
implicit none
character(len=24) :: fstring
character(kind=c_char, len=1), intent(out) :: cstr(*)
integer i
do i = 1, len(fstring)
cstr(i) = fstring(i:i)
cstr(i+1) = c_null_char
end do
end subroutine f_to_c_string
END MODULE cstr
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!
! module liboctqisoc
!
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
MODULE liboctqisoc
!
! OCTQlib with iso-C binding
!
use iso_c_binding
use cstr
use liboctq
! use general_thermodynamic_package
implicit none
integer(c_int), bind(c) :: c_niter=-1
integer(c_int), bind(c) :: c_nel=-1
integer(c_int), bind(c) ::c_maxc=40, c_maxp=500
type(c_ptr), bind(c), dimension(maxc) :: c_cnam
character(len=25), dimension(maxc), target :: cnames
real(c_double), bind(c), dimension(maxc) :: c_mass
integer(c_int), bind(c) :: c_ntup
TYPE, bind(c) :: c_gtp_equilibrium_data
! this contains all data specific to an equilibrium like conditions,
! status, constitution and calculated values of all phases etc
! Several equilibria may be calculated simultaneously in parallell threads
! so each equilibrium must be independent
! NOTE: the error code must be local to each equilibria!!!!
! During step and map these records with results are saved
! values of T and P, conditions etc.
! Values here are normally set by external conditions or calculated from model
! local list of components, phase_varres with amounts and constitution
! lists of element, species, phases and thermodynamic parameters are global
! tpval(1) is T, tpval(2) is P, rgas is R, rtn is R*T
! status: not used yet?
! multiuse: used for various things like direction in start equilibria
! eqno: sequential number assigned when created
! next: index of next equilibrium in a sequence during step/map calculation.
! eqname: name of equilibrium
! tpval: value of T and P
! rtn: value of R*T
integer(c_int) :: status,multiuse,eqno,next
character(c_char) :: eqname(24)
real(c_double) :: tpval(2),rtn
! svfunres: the values of state variable functions valid for this equilibrium
type(c_ptr) :: svfunres
! the experiments are used in assessments and stored like conditions
! lastcondition: link to condition list
! lastexperiment: link to experiment list
TYPE(c_ptr) :: lastcondition,lastexperiment
! components and conversion matrix from components to elements
! complist: array with components
! compstoi: stoichiometric matrix of compoents relative to elements
! invcompstoi: inverted stoichiometric matrix
TYPE(c_ptr) :: complist
real(c_double) :: compstoi
real(c_double) :: invcompstoi
! one record for each phase+composition set that can be calculated
! phase_varres: here all calculated data for the phase is stored
TYPE(c_ptr) :: phase_varres
! index to the tpfun_parres array is the same as in the global array tpres
! eq_tpres: here local calculated values of TP functions are stored
TYPE(c_ptr) :: eq_tpres
! current values of chemical potentials stored in component record but
! duplicated here for easy acces by application software
real(c_double) :: cmuval
! xconc: convergence criteria for constituent fractions and other things
real(c_double) :: xconv
! delta-G value for merging gridpoints in grid minimizer
! smaller value creates problem for test step3.BMM, MC and austenite merged
real(c_double) :: gmindif
! maxiter: maximum number of iterations allowed
integer(c_int) :: maxiter
!CCI
! conv_iter: number of iterations reached after the equilibrium calculation
integer(c_int) :: conv_iter
!CCI
! this is to save a copy of the last calculated system matrix, needed
! to calculate dot derivatives, initiate to zero
integer(c_int) :: sysmatdim=0,nfixmu=0,nfixph=0
integer(c_int) :: fixmu
integer(c_int) :: fixph
real(c_double) :: savesysmat
END TYPE c_gtp_equilibrium_data
contains
! functions
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
integer function c_noofcs(iph) bind(c, name='c_noofcs')
integer(c_int), value :: iph
c_noofcs = noofcs(iph)
return
end function c_noofcs
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
integer function c_noconst(iph,ics,c_ceq) bind(c, name='c_noconst')
integer(c_int), intent(in), value :: iph
integer(c_int), intent(in), value :: ics
type(c_ptr), intent(inout) :: c_ceq
type(gtp_equilibrium_data), pointer :: ceq
call c_f_pointer(c_ceq, ceq)
c_noconst = noconst(iph,ics,ceq)
nullify(ceq)
return
end function c_noconst
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
subroutine examine_gtp_equilibrium_data(c_ceq) &
bind(c, name='examine_gtp_equilibrium_data')
type(c_ptr), intent(in), value :: c_ceq
type(gtp_equilibrium_data), pointer :: ceq
integer :: i,j
call c_f_pointer(c_ceq, ceq)
write(*,10) ceq%status, ceq%multiuse, ceq%eqno
10 format(/'gtp_equilibrium_data: status, multiuse, eqno, next'/, 3i4)
write(*,20) ceq%eqname
20 format(/'Name of equilibrium'/,a)
write(*,30) ceq%tpval, ceq%rtn
30 format(/'Value of T and P'/, 2f8.3, /'R*T'/, f8.4)
do i = 1, size(ceq%compstoi,1)
write(*,*) (ceq%compstoi(i,j), j=1,size(ceq%compstoi,2))
end do
write(*,*) ceq%cmuval
write(*,*) ceq%xconv
write(*,*) ceq%gmindif
write(*,*) ceq%maxiter
write(*,*) ceq%sysmatdim, ceq%nfixmu, ceq%nfixph
write(*,*) ceq%fixmu, ceq%fixph, ceq%savesysmat
end subroutine examine_gtp_equilibrium_data
!CCI
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
! Get the stoichiometric factor of an element in a species given by name
! species_name: name of the species (input character)
! iel: index of the element (input intger)
! el_name: name of the element (output character)
! stoi: value of the stoichiometric coefficient (output real)
!
subroutine get_stoichiometric_coef(species_name, iel, el_name, c_stoi) bind(c, name='c_get_stoichiometry')
character(kind=c_char), intent(in) :: species_name
integer(c_int), intent(in), value :: iel
character(kind=c_char), intent(inout) :: el_name(24)
real(c_double), intent(inout) :: c_stoi
!\end{verbatim}
integer :: loksp
character(len=:), allocatable :: eq_species_name
character :: fstring*24
! Get the index of the species by its name
eq_species_name = c_to_f_string(species_name)
call find_species_record_exact(eq_species_name,loksp)
if(gx%bmperr.ne.0) goto 1000
! Get the stoichiometric coefficient
call get_stoichiometry(loksp, iel, fstring, c_stoi)
call f_to_c_string(fstring, el_name)
1000 continue
deallocate(eq_species_name)
return
end subroutine get_stoichiometric_coef
!CCI
!CCI
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
! Change the stoichiometric factor of a species given by name
! species_name: name of the species (input character)
! new_stoi: new value of the stoichiometric coefficient (input real)
!
subroutine change_stoichiometric(species_name,new_stoi) bind(c, name='c_change_stoichiometric')
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
character(kind=c_char), intent(in) :: species_name
real(c_double), intent(in), value :: new_stoi
!\end{verbatim}
integer :: loksp
character(len=:), allocatable :: eq_species_name
eq_species_name = c_to_f_string(species_name)
! Get the index of the species by its name
call find_species_record(eq_species_name,loksp)
if(gx%bmperr.ne.0) goto 1000
! Change the stoichiometric factor (new_stoi) of the loksp-th species
call set_new_stoichiometry(loksp,new_stoi)
1000 continue
deallocate(eq_species_name)
return
end subroutine change_stoichiometric
!CCI
!\begin{verbatim}
subroutine getelem()
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!
! When an external unformatted file is read without reading any data base
! it is necessary to get the name of each component for setting new conditions
! The number of elements is then updated ut also the number of phase tuples
! for possible using before doing another equilibrium calculation
integer iz
character elname*2,name*24,refs*24
double precision a1,a2,a3
! by default, c_nel is initialized to -1
if(c_nel.lt.0) then
nel=noel()
c_nel=noel()
do iz=1,nel
call get_element_data(iz,elname,name,refs,a1,a2,a3)
cnam(iz)=elname
cnames(iz)=trim(elname) // c_null_char
c_cnam(iz) = c_loc(cnames(iz))
enddo
ntup=nooftup()
c_ntup=nooftup()
endif
!
end subroutine getelem
!\end{verbatim}
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqini(n, c_ceq) bind(c, name='c_tqini')
integer(c_int), intent(in) :: n
type(c_ptr), intent(out) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
integer :: i1,i2
call tqini(n, ceq)
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqini
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqvalpfu(phtupx, c_molepfu, c_masspfu, c_napfu, c_ncpfu, c_ceq) bind(c, name='c_tqvalpfu')
! get the number of moles, the mass of components and the number of components/atoms per Formula Units of phase n,
! NOTE: n is phase number, not extended phase index
integer(c_int), intent(in), value :: phtupx ! IN: index in phase tuple array
real(c_double), intent(inout) :: c_molepfu ! INOUT: moles per FU
real(c_double), intent(inout) :: c_masspfu ! INOUT: mass of components per FU
real(c_double), intent(inout) :: c_ncpfu ! INOUT: number of components per FU
real(c_double), intent(inout) :: c_napfu ! INOUT: number of atoms per FU
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
character(len=24) :: fstring
double precision :: napfu
character name*(24)
call c_f_pointer(c_ceq, ceq)
c_ncpfu=ceq%phase_varres(phasetuple(phtupx)%lokvares)%abnorm(1)
c_masspfu=ceq%phase_varres(phasetuple(phtupx)%lokvares)%abnorm(2)
c_napfu=ceq%phase_varres(phasetuple(phtupx)%lokvares)%abnorm(3)
c_molepfu=ceq%phase_varres(phasetuple(phtupx)%lokvares)%amfu
c_ceq = c_loc(ceq)
nullify(ceq)
end subroutine c_tqvalpfu
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqrfil(filename,c_ceq) bind(c, name='c_tqrfil')
character(kind=c_char,len=1), intent(in) :: filename(*)
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
character(len=:), allocatable :: fstring
integer :: i,j,l
character(kind=c_char, len=1),dimension(24), target :: f_pointers
! convert type(c_ptr) to fptr
call c_f_pointer(c_ceq, ceq)
fstring = c_to_f_string(filename)
!CCI : turn off warnings from reading the TDB file
!call readtdbsilent
!CCI
call tqrfil(fstring, ceq)
! after tqrfil ntup variable is defined
c_ntup = ntup
c_nel = nel
do i = 1, nel
cnames(i) = trim(cnam(i)) // c_null_char
c_cnam(i) = c_loc(cnames(i))
c_mass(i)=cmass(i)
write(*,*) cmass(i)
end do
c_ceq = c_loc(ceq)
deallocate(fstring)
nullify(ceq)
end subroutine c_tqrfil
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqrpfil(filename,nel,c_selel,c_ceq) bind(c, name='c_tqrpfil')
!change
character(kind=c_char), intent(in) :: filename
integer(c_int), intent(in), value :: nel
type(c_ptr), intent(in), dimension(nel), target :: c_selel
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
character(len=:), allocatable :: fstring
character, pointer :: selel(:)
integer :: i
character elem(nel)*2
fstring = c_to_f_string(filename)
call c_f_pointer(c_ceq, ceq)
! convert the c type selel strings to f-selel strings
! note: additional character is for C terminated '\0'
do i = 1, nel
call c_f_pointer(c_selel(i), selel, [3])
elem(i) = c_to_f_string(selel)
end do
!CCI : turn off warnings from reading the TDB file
call readtdbsilent
!CCI
call tqrpfil(fstring, nel, elem, ceq)
! after tqrpfil ntup variable is defined
c_ntup = ntup
c_nel = nel
do i = 1, nel
cnames(i) = trim(cnam(i)) // c_null_char
c_cnam(i) = c_loc(cnames(i))
c_mass(i)=cmass(i)
end do
c_ceq = c_loc(ceq)
deallocate (fstring)
nullify(ceq)
end subroutine c_tqrpfil
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqgcom(n,components,c_ceq) bind(c, name='c_tqgcom')
! get system components
integer(c_int), intent(inout) :: n
!character(kind=c_char, len=24), dimension(24), intent(out) :: c_components
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
integer, target :: nc
character(len=24) :: fcomponents(maxel)
character(kind=c_char, len=1), dimension(maxel*24) :: components
type(gtp_equilibrium_data), pointer :: ceq
integer :: i,j,l
call c_f_pointer(c_ceq, ceq)
call tqgcom(nc, fcomponents, ceq)
! convert the F components strings to C
l = len(fcomponents(1))
do i = 1, nc
do j = 1, l
components((i-1)*l+j)(1:1) = fcomponents(i)(j:j)
end do
! null termination
components(i*l) = c_null_char
end do
c_ceq = c_loc(ceq)
n = nc
nullify(ceq)
return
end subroutine c_tqgcom
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqgnp(n, c_ceq) bind(c, name='c_tqgnp')
integer(c_int), intent(inout) :: n
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
call c_f_pointer(c_ceq, ceq)
call tqgnp(n, ceq)
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqgnp
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqgpn(n,phasename, c_ceq) bind(c, name='c_tqgpn')
! get name of phase n,
! NOTE: n is phase number, not extended phase index
integer(c_int), intent(in), value :: n
character(kind=c_char, len=1), intent(inout) :: phasename(24)
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
character(len=24) :: fstring
integer :: i
call c_f_pointer(c_ceq, ceq)
! fstring = c_to_f_string(phasename)
call tqgpn(n, fstring, ceq)
! copy the f-string to c-string and end with '\0'
call f_to_c_string(fstring, phasename)
! do i=1,len(trim(fstring))
! phasename(i)(1:1) = fstring(i:i)
! phasename(i+1)(1:1) = c_null_char
! end do
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqgpn
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqgpi(n,phasename,c_ceq) bind(c, name='c_tqgpi')
! get index of phase phasename
integer(c_int), intent(out) :: n
character(c_char), intent(in) :: phasename(24)
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
character(len=24) :: fstring
call c_f_pointer(c_ceq, ceq)
fstring = c_to_f_string(phasename)
call tqgpi(n, fstring, ceq)
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqgpi
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqgpi2(iph,ics,phasename,c_ceq) bind(c, name='c_tqgpi2')
! get index of phase phasename
integer(c_int), intent(out) :: iph
integer(c_int), intent(out) :: ics
character(c_char), intent(in) :: phasename(24)
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
character(len=24) :: fstring
call c_f_pointer(c_ceq, ceq)
fstring = c_to_f_string(phasename)
call tqgpi2(iph, ics, fstring, ceq)
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqgpi2
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqgpcn2(n, c, csname) bind(c, name='c_tqgpcn2')
! get name of constituent c in phase n
integer(c_int), intent(in), value :: n ! phase number
integer(c_int), intent(in), value :: c ! extended constituent index:
! 10*species_number + sublattice
character(kind=c_char, len=1), intent(inout) :: csname(24)
!\end{verbatim}
character(len=24) :: fstring
integer :: i
call tqgpcn2(n,c,fstring)
call f_to_c_string(fstring, csname)
! copy the f-string to c-string and end with '\0'
! do i=1,len(trim(fstring))
! csname(i)(1:1) = fstring(i:i)
! csname(i+1)(1:1) = c_null_char
! end do
end subroutine c_tqgpcn2
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqgpci(n,c, constituentname, c_ceq) bind(c, name='c_tqgpci')
! get index of constituent with name in phase n
integer(c_int), intent(in) :: n
integer(c_int), intent(out) :: c ! exit: extended constituent index:
! 10*species_number+sublattice
character(c_char), intent(in) :: constituentname(24)
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
character(len=24) :: fstring
fstring = c_to_f_string(constituentname)
call c_f_pointer(c_ceq, ceq)
call tqgpci(n, c, fstring, ceq)
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqgpci
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqgpcs(c,nspel,ielno,stoi,smass,qsp) bind(c, name='c_tqgpcs')
!get stoichiometry of constituent c in phase n
integer(c_int), intent(in), value :: c ! in: extended constituent index:
! 10*species_number + sublattice
integer(c_int), intent(out) :: nspel
integer(c_int), intent(out) :: ielno(*)
real(c_double), intent(out) :: stoi(*) ! exit: stoichiometry of elements
real(c_double), intent(out) :: smass ! exit: total mass
real(c_double), intent(out) :: qsp
!\end{verbatim}
call tqgpcs(c,nspel,ielno,stoi,smass,qsp)
end subroutine c_tqgpcs
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqgccf(n1,n2,elnames,stoi,mass,c_ceq)
! get stoichiometry of component n1
! n2 is number of elements ( dimension of elements and stoi )
integer(c_int), intent(in) :: n1 ! in: component number
integer(c_int), intent(out) :: n2 ! exit: number of elements in component
character(c_char), intent(out) :: elnames(2) ! exit: element symbols
real(c_double), intent(out) :: stoi(*) ! exit: element stoichiometry
real(c_double), intent(out) :: mass ! exit: component mass
! (sum of element mass)
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
call c_f_pointer(c_ceq, ceq)
call tqgccf(n1,n2,elnames,stoi, mass, ceq)
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqgccf
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqgnpc(n,c,c_ceq) bind(c, name='c_tqgnpc')
! get number of constituents of phase n
integer(c_int), intent(in) :: n ! in: phase number
integer(c_int), intent(out) :: c ! exit: number of constituents
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
call c_f_pointer(c_ceq,ceq)
call tqgnpc(n,c,ceq)
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqgnpc
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqphsts(phtupx,newstat,val,c_ceq) bind(c, name='c_tqphsts')
! set status of phase tuple: SUSPEND, DORMANT, ENTERED, FIX
integer(c_int), intent(in), value :: phtupx
integer(c_int), intent(in), value :: newstat
real(c_double), intent(in) :: val
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
call c_f_pointer(c_ceq,ceq)
call tqphsts(phtupx,newstat,val,ceq)
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqphsts
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqphsts2(phnames,newstat,val,c_ceq) bind(c, name='c_tqphsts2')
! set status of phase tuple: SUSPEND, DORMANT, ENTERED, FIX
character(c_char), intent(in) :: phnames
integer(c_int), intent(in), value :: newstat
real(c_double), intent(in) :: val
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
character(len=:), allocatable :: fphnames
call c_f_pointer(c_ceq,ceq)
fphnames = c_to_f_string(phnames)
call tqphsts2(fphnames,newstat,val,ceq)
c_ceq = c_loc(ceq)
nullify(ceq)
deallocate(fphnames)
return
end subroutine c_tqphsts2
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqsetc(statvar, n1, n2, mvalue, cnum, c_ceq) &
bind(c, name='c_tqsetc')
! set condition
! stavar is state variable as text
! n1 and n2 are auxilliary indices
! value is the value of the condition
! cnum is returned as an index of the condition.
! to remove a condition the value sould be equial to RNONE ????
! when a phase indesx is needed it should be 10*nph + ics
! SEE TQGETV for doucumentation of stavar etc.
!>>>> to be modified to use phase tuplets
integer(c_int), intent(in),value :: n1 !in: 0 or extended phase index:
! 10*phase_number+comp.set
! or component set
integer(c_int), intent(in),value :: n2 !
integer(c_int), intent(out) :: cnum !exit:
! sequential number of this condition
character(c_char), intent(in) :: statvar !in: character
! with state variable symbol
real(c_double), intent(in),value :: mvalue !in: value of condition
type(c_ptr), intent(in) :: c_ceq ! in: current equilibrium
type(gtp_equilibrium_data), pointer :: ceq
character(len=:), allocatable :: fstatvar
!
call c_f_pointer(c_ceq, ceq)
fstatvar = c_to_f_string(statvar)
call tqsetc(fstatvar, n1, n2, mvalue, cnum, ceq)
nullify(ceq)
deallocate(fstatvar)
end subroutine c_tqsetc
!\end{verbatim}
!\begin{verbatim}
subroutine c_tqcalc(c_ceq,mode) bind(c,name='c_tqcalc')
! calculate equilibrium with different methods
! mode=0 means calculate without grid minimizer
! mode=1 means start values using global gridminimization
! mode=2 means calculate carefully (default)
integer(c_int), intent(in),value :: mode
integer n
logical confirm
double precision, allocatable, dimension(:) ::xknown,aphl,cmu
integer, allocatable, dimension(:) ::iphl,icsl,nyphl
integer nv
double precision totam
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
call c_f_pointer(c_ceq,ceq)
! mode=0 means calculate without global minimizer
if(mode.eq.0) then
call calceq2(mode,ceq)
! mode=1 means start values using global gridminimization
elseif(mode.eq.1) then
call calceq2(mode,ceq)
! mode=2 means calculate carefully (default)
else
! first parameter 0 means bosses_method, 1 means carefully
n=1
!
allocate(xknown(noel()))
xknown(:)=0.0
allocate(aphl(noel()))
aphl(:)=0.0
allocate(cmu(noel()))
cmu(:)=0.0
allocate(iphl(noel()))
iphl(:)=0
allocate(icsl(noel()))
icsl(:)=0
allocate(nyphl(noel()))
nyphl(:)=0
!
call extract_massbalcond(ceq%tpval,xknown,totam,ceq)
if(gx%bmperr.eq.0) then
call global_gridmin(1,ceq%tpval,xknown,nv,iphl,icsl,&
aphl,nyphl,cmu,ceq)
if(gx%bmperr.eq.0) then
call calculate_carefully(n,ceq)
endif
endif
!
deallocate(xknown)
deallocate(aphl)
deallocate(cmu)
deallocate(iphl)
deallocate(icsl)
deallocate(nyphl)
endif
if(gx%bmperr.ne.0) goto 1000
ntup=nooftup()
c_ntup=nooftup()
c_niter=ceq%conv_iter
1000 continue
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqcalc
!\begin{verbatim}
subroutine c_tqce(mtarget,n1,n2,mvalue,c_ceq) bind(c,name='c_tqce')
! calculate equilibrium with possible target
! Target can be empty or a state variable with indicies n1 and n2
! value is the calculated value of target
integer(c_int), intent(in),value :: n1
integer(c_int), intent(in),value :: n2
type(c_ptr), intent(inout) :: c_ceq
character(c_char), intent(inout) :: mtarget
real(c_double), intent(inout) :: mvalue
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
character(len=:), allocatable :: fstring
call c_f_pointer(c_ceq,ceq)
fstring = c_to_f_string(mtarget)
call tqce(fstring,n1,n2,mvalue,ceq)
if(gx%bmperr.ne.0) goto 1000
c_ntup=ntup
!CCI
c_niter=ceq%conv_iter
!CCI
1000 continue
c_ceq = c_loc(ceq)
deallocate(fstring)
nullify(ceq)
return
end subroutine c_tqce
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine c_tqdceq(ceqname) bind(c,name='c_tqdceq')
character(kind=c_char), intent(in) :: ceqname
! delete equilibrium with name
!\end{verbatim}
character(len=:), allocatable :: name
integer n1
name = c_to_f_string(ceqname)
call tqdceq(name)
deallocate(name)
end subroutine c_tqdceq
!\begin{verbatim}
subroutine c_tqfree() bind(c, name='c_tqfree')
!\end{verbatim}
integer intv(10)
double precision dblv(10)
call deallocate_gtp(intv,dblv)
end subroutine c_tqfree
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqgetv(statvar,n1,n2,n3,values,c_ceq) bind(c,name='c_tqgetv')
! get equilibrium results using state variables
! stavar is the state variable IN CAPITAL LETTERS with indices n1 and n2
! n3 at the call is the dimension of values, changed to number of values
! value is the calculated value, it can be an array with n3 values.
implicit none
integer(c_int), intent(in),value :: n1,n2
integer(c_int), intent(inout) :: n3
character(c_char), intent(in) :: statvar
real(c_double), intent(inout) :: values(*)
type(c_ptr), intent(inout) :: c_ceq !IN: current equilibrium
!========================================================
! >>>> implement use of phase tuples
! stavar must be a symbol listed below
! IMPORTANT: some terms explained after the table
! Symbol index1,index2 Meaning (unit)
!.... potentials
! T 0,0 Temperature (K)
! P 0,0 Pressure (Pa)
! MU component,0 or phase-tuple*1,constituent*2 Chemical potential (J)
! AC component,0 or phase-tuple,constituent Activity = EXP(MU/RT)
! LNAC component,0 or phase-tuple,constituent LN(activity) = MU/RT
!...... extensive variables
! U 0,0 or phase-tuple,0 Internal energy (J) whole system or phase
! UM 0,0 or phase-tuple,0 same per mole components
! UW 0,0 or phase-tuple,0 same per kg
! UV 0,0 or phase-tuple,0 same per m3
! UF phase-tuple,0 same per formula unit of phase
! S*3 0,0 or phase-tuple,0 Entropy (J/K)
! V 0,0 or phase-tuple,0 Volume (m3)
! H 0,0 or phase-tuple,0 Enthalpy (J)
! A 0,0 or phase-tuple,0 Helmholtz energy (J)
! G 0,0 or phase-tuple,0 Gibbs energy (J)
! ..... some extra state variables
! NP phase-tuple,0 Moles of phase
! BP phase-tuple,0 Mass of moles (kg)
! Q phase-tuple,0 Internal stability/RT (dimensionless)
! DG phase-tuple,0 Driving force/RT (dimensionless)
!....... amounts of components
! N 0,0 or component,0 or phase-tuple,component Moles of component
! X component,0 or phase-tuple,component Mole fraction of component
! B 0,0 or component,0 or phase-tuple,component Mass of component
! W component,0 or phase-tuple,component Mass fraction of component
! Y phase-tuple,constituent*1 Constituent fraction
!........ some parameter identifiers
! TC phase-tuple,0 Magnetic ordering temperature
! BMAG phase-tuple,0 Aver. Bohr magneton number
! MQ& phase-tuple,constituent Mobility
! THET phase-tuple,0 Debye temperature
! LNX phase-tuple,0 Lattice parameter
! EC11 phase-tuple,0 Elastic constant C11
! EC12 phase-tuple,0 Elastic constant C12
! EC44 phase-tuple,0 Elastic constant C44
!........ NOTES:
! *1 The phase-tuple is is structure with 2 integers: phase and comp.set
! *2 The constituent index is 10*species_number + sublattice_number
! *3 S, V, H, A, G, NP, BP, N, B and DG can have suffixes M, W, V, F also
!--------------------------------------------------------------------
! special addition for TQ interface: d2G/dyidyj
! D2G + extended phase index
!------------------------------------
type(gtp_equilibrium_data), pointer :: ceq
character(len=24) :: fstring
integer :: n
integer :: i
call c_f_pointer(c_ceq, ceq)
! call list_conditions(6,ceq)
! call list_phase_results(1,1,0,6,ceq)
! write(*,*)'Phase and error code: ',1,gx%bmperr
! call list_phase_results(2,1,0,6,ceq)
! write(*,*)'Phase and error code: ',2,gx%bmperr
! write(*,*)
call c_to_f_str(statvar,fstring)
call tqgetv(fstring, n1, n2, n3, values, ceq)
! debug ...
! write(*,55)fstring(1:len_trim(fstring)),n1,n2,n3,(values(i),i=1,n3)
!55 format(/'From c_tqgetv: ',a,': ',3i3,6(1pe12.4))
! write(*,*)
! end debug
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqgetv
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqgnsubl(n1,nsub,c_ceq) bind(c,name='c_tqgnsubl')
! This subroutine returns the number of sublattices (1 if no sublattices)
! of phase identified by its phase tuple index
implicit none
integer(c_int), intent(in), value :: n1
integer(c_int), intent(out) :: nsub
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
call c_f_pointer(c_ceq, ceq)
call get_sublattice_number(phasetuple(n1)%ixphase,nsub,ceq)
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqgnsubl
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqgsubstruc(n1,nsub,nkl,nsites,c_ceq) bind(c,name='c_tqgsubstruc')
! This subroutine returns structures of each sublattice
! of phase identified by its phase tuple and composition set indexes
! (number of constituents in each sublattice and number of sites)
implicit none
integer(c_int), intent(in), value :: n1,nsub
integer(c_int), intent(out), dimension(nsub) :: nkl
real(c_double), intent(out), dimension(nsub) :: nsites
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
call c_f_pointer(c_ceq, ceq)
call get_sublattice_structure(phasetuple(n1)%ixphase,phasetuple(n1)%compset,nsub,nkl,nsites,ceq)
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqgsubstruc
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqgconsdata(n1,icons,yarr,charge,csname,ncel,c_ceq) bind(c,name='c_tqgconsdata')
! This subroutine returns mole fraction, charge and name of constituent
! of phase identified by its phase tuple and composition set indexes
! (index of constituents and number of sites)
implicit none
integer(c_int), intent(in), value :: n1,icons
real(c_double), intent(inout) :: yarr
integer(c_int), intent(inout) :: charge, ncel
character(kind=c_char, len=1), intent(inout) :: csname(24)
type(c_ptr), intent(inout) :: c_ceq
character(len=24) :: fstring
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
call c_f_pointer(c_ceq, ceq)
call get_constituent_data(phasetuple(n1)%ixphase,phasetuple(n1)%compset,icons,yarr,charge,&
fstring,ncel,ceq)
call f_to_c_string(fstring, csname)
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqgconsdata
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqgphc1(n1,nsub,cinsub,spix,yfrac,sites,extra,c_ceq)&
bind(c,name='c_tqgphc1')
! tq_get_phase_constitution
! This subroutine returns the sublattices and constitution of a phase
! n1 is phase tuple index
! nsub is the number of sublattices (1 if no sublattices)
! cinsub is an array with the number of const\EDtuents in each sublattice
! spix is an array with the species index of the constituents in all sublattices
! sites is an array of the site ratios for all sublattices.
! yfrac is the constituent fractions in same order as in spix
! extra is an array with some extra values:
! extra(1) is the number of moles of components per formula unit
! extra(2) is the net charge of the phase
implicit none
!integer n1,nsub,cinsub(*),spix(*)
integer(c_int), intent(in), value :: n1
integer(c_int), intent(out) :: nsub
integer(c_int), intent(out) :: cinsub(*)
integer(c_int), intent(in) :: spix(*)
!double precision sites(*),yfrac(*),extra(*)
real(c_double), intent(in) :: sites(*)
real(c_double), intent(in) :: yfrac(*)
real(c_double), intent(in) :: extra(*)
!type(gtp_equilibrium_data), pointer :: ceq
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
call c_f_pointer(c_ceq, ceq)
!call tqgphc1(n1,nsub2,cinsub2,spix2,yfrac2,sites2,extra2,ceq)
call tqgphc1(n1,nsub,cinsub,spix,yfrac,sites,extra,ceq)
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqgphc1
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqsphc1(n1,yfra,extra,c_ceq) bind(c,name='c_tqsphc1')
! tq_set_phase_constitution
! To set the constitution of a phase
! n1 is phase tuple index
! yfra is an array with the constituent fractions in all sublattices
! in the same order as obtained by tqgphc1
! extra is an array with returned values with the same meaning as in tqgphc1
! NOTE The constituents fractions are normallized to sum to unity for each
! sublattice and extra is calculated by tqsphc1
! T and P must be set as conditions.
implicit none
integer(c_int), intent(in), value :: n1
real(c_double), intent(in) ::yfra(*)
real(c_double), intent(out) :: extra(*)
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
call c_f_pointer(c_ceq, ceq)
call set_constitution(phasetuple(n1)%ixphase,phasetuple(n1)%compset,&
yfra,extra,ceq)
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqsphc1
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqcph1(n1,n2,n3,gtp,dgdy,d2gdydt,d2gdydp,d2gdy2,c_ceq) &
bind(c,name='c_tqcph1')
! tq_calculate_phase_properties
!vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
! WARNIG: this is not a subroutine to calculate chemical potentials
! those can only be made by an equilibrium calculation.
! The values returned are partial derivatives of G for the phase at the
! current T, P and phase constitution. The phase constitution has been
! obtained by a previous equilibrium calculation or
! set by the subroutine tqsphc
! It corresponds to the "calculate phase" command.
!
! NOTE that values are per formula unit divided by RT,
! divide also by extra(1) in subroutine tqsphc1 to get them per mole component
!
!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
! calculate G and some or all derivatives for a phase at current composition
! n1 is the phase tuple index
! n2 is 0 if only G and derivatves wrt T and P, 1 also first drivatives wrt
! compositions, 2 if also 2nd derivatives
! n3 is returned as number of constituents (dimension of returned arrays)
! gtp is an array with G, G.T, G:P, G.T.T, G.T.P and G.P.P
! dgdy is an array with G.Yi
! d2gdydt is an array with G.T.Yi
! d2gdydp is an array with G.P.Yi
! d2gdy2 is an array with the upper triangle of the symmetrix matrix G.Yi.Yj
! reurned in the order: 1,1; 1,2; 1,3; ...
! 2,2; 2,3; ...
! 3,3; ...
! for indexing one can use the integer function ixsym(i1,i2)
implicit none
integer(c_int), intent(in), value :: n1
integer(c_int), intent(in), value :: n2
integer(c_int), intent(out) :: n3
real(c_double), intent(out) :: gtp(6)
real(c_double), intent(out) :: dgdy(*)
real(c_double), intent(out) :: d2gdydt(*)
real(c_double), intent(out) :: d2gdydp(*)
real(c_double), intent(out) :: d2gdy2(*)
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
call c_f_pointer(c_ceq, ceq)
call tqcph1(n1,n2,n3,gtp,dgdy,d2gdydt,d2gdydp,d2gdy2,ceq)
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqcph1
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_tqcph3(n1,n2,g,c_ceq) bind(c,name='c_tqcph3')
implicit none
integer(c_int), intent(in), value :: n1
integer(c_int), intent(in), value :: n2
real(c_double), intent(out) :: g(*)
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
call c_f_pointer(c_ceq, ceq)
call tqcph3(n1,n2,g,ceq)
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqcph3
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_reset_conditions(cline,c_ceq) bind(c, name='c_reset_conditions')
implicit none
character(c_char), intent(in) :: cline(24)
type(c_ptr), intent(inout) :: c_ceq ! in: current equilibrium
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
character(len=24) :: fstring
fstring = c_to_f_string(cline)
call c_f_pointer(c_ceq, ceq)
call reset_conditions(fstring,ceq)
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_reset_conditions
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_Change_Status_Phase(phasename,nystat,myval,c_ceq)&
bind(c, name='c_Change_Status_Phase')
!change the status Fixed or Entered of a phase
!PHFIXED=2
!PHENTERED=0
implicit none
character(c_char), intent(in) :: phasename(24)
integer(c_int), intent(in), value :: nystat
real(c_double), intent(in),value :: myval
type(c_ptr), intent(inout) :: c_ceq ! in: current equilibrium
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
character(len=24) :: fstring
call c_f_pointer(c_ceq, ceq)
call c_to_f_str(phasename,fstring)
call change_many_phase_status(fstring,nystat,myval,ceq)
! call Change_Status_Phase(fstring,nystat,myval,ceq)
c_ceq = c_loc(ceq)
1000 continue
nullify(ceq)
return
end subroutine c_Change_Status_Phase
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine c_Set_Reference_State(iel,c_phase,tpref,c_ceq)&
bind(c, name='c_Set_Reference_State')
! set component reference state
integer(c_int), intent(in), value :: iel
character(c_char), intent(in) :: c_phase(24)
real(c_double), intent(in) :: tpref(2)
type(c_ptr), intent(inout) :: c_ceq
character(len=24) :: phase
type(gtp_equilibrium_data), pointer :: ceq
integer phtupx
!\end{verbatim}
call c_f_pointer(c_ceq, ceq)
phase = c_to_f_string(c_phase)
call find_phasetuple_by_name(phase,phtupx)
if(gx%bmperr.ne.0) goto 1000
call set_reference_state(iel,phtupx,tpref,ceq)
1000 continue
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_Set_Reference_State
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_List_Conditions(c_ceq)&
bind(c, name='c_List_Conditions')
!change the status Fixed or Entered of a phase
!PHFIXED=2
!PHENTERED=0
implicit none
type(c_ptr), intent(inout) :: c_ceq ! in: current equilibrium
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
call c_f_pointer(c_ceq, ceq)
call list_conditions(6,ceq)
1000 continue
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_List_Conditions
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_checktdb(tdbfile)&
bind(c, name='c_checktdb')
character(kind=c_char), intent(in) :: tdbfile
!\end{verbatim}
integer:: nel,i
character selel(maxel)*2
character(len=:), allocatable :: fstring
character(len=:), allocatable :: ext
ext='.tdb'
fstring = c_to_f_string(tdbfile)
call checkdb(fstring,ext,nel,selel)
c_nel = nel
do i = 1, nel
cnames(i) = trim(selel(i)) // c_null_char
c_cnam(i) = c_loc(cnames(i))
end do
deallocate(fstring)
return
end subroutine c_checktdb
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_newEquilibrium(ceqname,ieq) bind(c, name='c_newEquilibrium')
character(kind=c_char), intent(in) :: ceqname
integer(c_int), intent(out):: ieq
!\end{verbatim}
character(len=:), allocatable :: fstring
fstring = c_to_f_string(ceqname)
call enter_equilibrium(fstring,ieq)
deallocate(fstring)
end subroutine c_newEquilibrium
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine c_tqcceq(ceqname,n1,c_newceq,c_ceq) &
bind(c, name='c_tqcceq')
character(kind=c_char), intent(in) :: ceqname
integer(c_int), intent(out) :: n1
type(c_ptr), intent(inout) :: c_newceq
type(c_ptr), intent(in) :: c_ceq
!\end{verbatim}
character(len=:), allocatable :: name
type(gtp_equilibrium_data), pointer :: newceq,ceq
call c_f_pointer(c_ceq, ceq)
call c_f_pointer(c_newceq, newceq)
name = c_to_f_string(ceqname)
call tqcceq(name,n1,newceq,ceq)
c_newceq=c_loc(newceq)
deallocate(name)
nullify(ceq)
end subroutine c_tqcceq
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine c_tqselceq(ceqname,c_ceq) &
bind(c, name='c_tqselceq')
character(kind=c_char), intent(in) :: ceqname
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
character(len=:), allocatable :: name
type(gtp_equilibrium_data), pointer :: ceq
call c_f_pointer(c_ceq, ceq)
name = c_to_f_string(ceqname)
call tqselceq(name,ceq)
c_ceq=c_loc(ceq)
deallocate(name)
nullify(ceq)
return
end subroutine c_tqselceq
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine c_tqgdmat(phtupx,tpval,xknown,cpot,tyst,nend,mugrad,mobval,consnames,n1,c_ceq) &
bind(c, name='c_tqgdmat')
integer(kind=c_int), intent(in), value :: phtupx
real(kind=c_double), intent(in) :: tpval(2)
real(kind=c_double), intent(in) :: xknown(*)
real(kind=c_double), intent(out) :: cpot(*)
integer(kind=c_int), intent(in), value :: tyst
integer(kind=c_int), intent(out) :: nend
real(kind=c_double), intent(out) :: mugrad(*)
real(kind=c_double), intent(out) :: mobval(*)
character(kind=c_char, len=1), intent(out), dimension(maxconst*24) :: consnames
integer(kind=c_int), intent(out) :: n1
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
logical btyst
type(gtp_equilibrium_data), pointer :: ceq
character(len=24) :: fconsnames(maxconst)
integer :: i,j,l
call c_f_pointer(c_ceq, ceq)
if (tyst.eq.1) then
btyst=.TRUE.
else
btyst=.FALSE.
endif
call tqgdmat(phtupx,tpval,xknown,cpot,btyst,nend,mugrad,mobval,fconsnames,n1,ceq)
! convert the F fconsnames strings to C
l = len(fconsnames(1))
do i = 1, n1
do j = 1, l
consnames((i-1)*l+j)(1:1) = fconsnames(i)(j:j)
end do
! null termination
consnames(i*l) = c_null_char
end do
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqgdmat
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_copy_equilibrium(c_neweq,ceqname,c_ceq) &
bind(c, name='c_copy_equilibrium')
type(c_ptr), intent(inout) :: c_neweq
character(kind=c_char), intent(in) :: ceqname
type(c_ptr), intent(in) :: c_ceq
!\end{verbatim}
character(len=:), allocatable :: fstring
type(gtp_equilibrium_data), pointer :: ceq
type(gtp_equilibrium_data), pointer :: neweq
call c_f_pointer(c_ceq, ceq)
fstring = c_to_f_string(ceqname)
call copy_equilibrium(neweq,fstring,ceq)
c_neweq=c_loc(neweq)
deallocate(fstring)
nullify(ceq)
return
end subroutine c_copy_equilibrium
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_selecteq(ieq,c_ceq) bind(c, name='c_selecteq')
integer(c_int), intent(in),value :: ieq
type(c_ptr), intent(out) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
!call c_f_pointer(c_ceq, ceq)
!call selecteq(ieq,ceq)
ceq=>eqlista(ieq)
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_selecteq
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_enter_svf(c_tpfun,c_ceq) bind(c, name='c_enter_svf')
! enter a state variable function like CP=H.T;
character(kind=c_char), intent(in) :: c_tpfun
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
character(len=:), allocatable :: tpfun
integer ip
tpfun = c_to_f_string(c_tpfun)
ip=1
call c_f_pointer(c_ceq, ceq)
call enter_svfun(tpfun,ip,ceq)
!call evaluate_all_svfun_old(-1,ceq) ! mandatory ?
c_ceq = c_loc(ceq)
deallocate(tpfun)
return
end subroutine c_enter_svf
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_get_value_svf(c_tpfun,c_svfvalue,c_ceq) bind(c, name='c_get_value_svf')
! evaluate all state variable funtions
! actual_arg are names of phases, components or species as @Pi, @Ci and @Si
! (NOT IMPLEMENTED YET see minimizer/matsmin.F90 for more details)
! if mode=1 always evaluate, if mode=0 several options
character(kind=c_char), intent(in) :: c_tpfun
real(c_double), intent(inout) :: c_svfvalue
type(c_ptr), intent(inout) :: c_ceq
!\end{verbatim}
type(gtp_equilibrium_data), pointer :: ceq
character(len=:), allocatable :: tpfun
character actual_arg(2)*16
double precision value
integer ip,mode
tpfun = c_to_f_string(c_tpfun)
call c_f_pointer(c_ceq, ceq)
call capson(tpfun)
call find_svfun(tpfun,ip)
mode=1 ! always is evaluated (see minimizer/matsmin.F90 for more details)
actual_arg = ' '
c_svfvalue=meq_evaluate_svfun(ip,actual_arg,mode,ceq)
c_ceq = c_loc(ceq)
deallocate(tpfun)
return
end subroutine c_get_value_svf
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_set_grid_density(ngrid) bind(c, name='c_set_grid_density')
!\end{verbatim}
integer(c_int), intent(in), value :: ngrid
if(ngrid.eq.0) then
! this set GSOGRID, small grid and clears GSXGRID
globaldata%status=ibset(globaldata%status,GSOGRID)
globaldata%status=ibclr(globaldata%status,GSXGRID)
globaldata%status=ibclr(globaldata%status,GSYGRID)
! write(*,*)'Sparse grid set'
elseif(ngrid.eq.1) then
! DEFAULT, all gridbits are cleared
globaldata%status=ibclr(globaldata%status,GSXGRID)
globaldata%status=ibclr(globaldata%status,GSOGRID)
globaldata%status=ibclr(globaldata%status,GSYGRID)
! write(*,*)'Normal grid set'
elseif(ngrid.eq.2) then
! set GSXGRID (and clear GSOGRID and GSYGRID)
globaldata%status=ibclr(globaldata%status,GSOGRID)
globaldata%status=ibset(globaldata%status,GSXGRID)
globaldata%status=ibclr(globaldata%status,GSYGRID)
! write(*,*)'Dense grid set'
elseif(ngrid.eq.3) then
! set GSYGRID (and clear GSXGRID and GSOGRID)
globaldata%status=ibclr(globaldata%status,GSOGRID)
globaldata%status=ibclr(globaldata%status,GSXGRID)
globaldata%status=ibset(globaldata%status,GSYGRID)
! write(*,*)'Very dense grid set'
else
write(*,*)'Only level 0, 1, 2 and implemented'
endif
return
end subroutine c_set_grid_density
!\begin{verbatim}
subroutine c_set_status_globaldata() bind(c, name='c_set_status_globaldata')
!\end{verbatim}
!globaldata%status=ibclr(globaldata%status,GSADV)
!globaldata%status=ibclr(globaldata%status,GSNOPAR)
!globaldata%status=ibclr(globaldata%status,GSXGRID)
globaldata%status=ibclr(globaldata%status,GSNOACS)
return
end subroutine c_set_status_globaldata
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
integer function c_errors_number() bind(c, name='c_errors_number')
!\end{verbatim}
c_errors_number=0
if(gx%bmperr.ne.0) then
c_errors_number=gx%bmperr
endif
return
end function c_errors_number
!\begin{verbatim}
subroutine c_reset_errors_number() bind(c, name='c_reset_errors_number')
!\end{verbatim}
gx%bmperr=0
return
end subroutine c_reset_errors_number
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
subroutine c_new_gtp() bind(c, name='c_new_gtp')
!\end{verbatim}
call new_gtp
end subroutine c_new_gtp
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
! Save OC environment in the c_filename at c_specification format
! c_specification : UNFORMATTED, DIRECT, TDB, MACRO or LaTeX
subroutine c_gtpsave(c_filename,c_specification) bind(c, name='c_gtpsave')
character(kind=c_char), intent(in) :: c_filename,c_specification
!\end{verbatim}
character(len=:), allocatable :: filename,specification
filename = c_to_f_string(c_filename)
specification = c_to_f_string(c_specification)
call gtpsaveu(filename,specification)
deallocate(filename,specification)
end subroutine c_gtpsave
!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!!/!\!
!\begin{verbatim}
! Read OC environment from the c_filename at c_specification format
! c_specification : UNFORMATTED, DIRECT, TDB, MACRO or LaTeX
subroutine c_gtpread(c_filename,c_specification) bind(c, name='c_gtpread')
character(kind=c_char), intent(in) :: c_filename,c_specification
!\end{verbatim}
character(len=:), allocatable :: filename,specification
filename = c_to_f_string(c_filename)
specification = c_to_f_string(c_specification)
call gtpread(filename,specification)
deallocate(filename,specification)
!CCI
call getelem()
!CCI
end subroutine c_gtpread
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine c_tqcheckphstab(is_stable,c_phtupx,c_ceq) bind(c, name='c_tqcheckphstab')
! check if a phase if stable
implicit none
logical(c_bool), intent(inout) :: is_stable
integer(c_int), intent(in), value :: c_phtupx
type(c_ptr), intent(inout) :: c_ceq
type(gtp_equilibrium_data), pointer :: ceq
!\end{verbatim}
integer lokvares
call c_f_pointer(c_ceq, ceq)
lokvares=phasetuple(c_phtupx)%lokvares
if(ceq%phase_varres(lokvares)%phstate.ge.phentstab) then
is_stable = .TRUE.
endif
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqcheckphstab
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine c_tqlr(c_mode,c_ceq) bind(c, name='c_tqlr')
! list the equilibrium results like in OC
implicit none
type(c_ptr), intent(inout) :: c_ceq
integer(c_int), intent(in), value :: c_mode
type(gtp_equilibrium_data), pointer :: ceq
!\end{verbatim}
integer phtupx,iph,ics,lokvares,mode
logical once
call c_f_pointer(c_ceq, ceq)
write(6,10)
10 format(/20('*')/'Start debug output from TQLR: ')
call list_conditions(6,ceq)
call list_global_results(6,ceq)
call list_components_result(6,1,ceq)
call list_all_elements(6)
call list_all_species(6)
call list_all_phases(6,ceq)
once=.TRUE.
mode=max(0,c_mode)
do phtupx=1,nooftup()
lokvares=phasetuple(phtupx)%lokvares
if(ceq%phase_varres(lokvares)%phstate.ge.phentstab) then
iph=phasetuple(phtupx)%ixphase
ics=phasetuple(phtupx)%compset
call list_phase_results(iph,ics,mode,lut,once,ceq)
endif
enddo
write(6,20)
20 format('End debug output from TQLR'/20('*')/)
1000 continue
c_ceq = c_loc(ceq)
nullify(ceq)
return
end subroutine c_tqlr
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
!\begin{verbatim}
subroutine c_tqtgsw(i) bind(c, name='c_tqtgsw')
integer(c_int), intent(in),value :: i
!\end{verbatim}
call tqtgsw(i)
end subroutine c_tqtgsw
!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\!/!!\
end module liboctqisoc
================================================
FILE: OCisoCbinding/octqc.h
================================================
/*
* Update proposed by Romain Le Tellier and Clément Introïni
*/
#if !defined __OCASI__
#define __OCASI__
/* Modification history
160829 Bo Sundman Update
2015-2016 Matthias Stratmann and Cristophe Sigli Modifications
2014 Teslos? First version
This contains the structure of TYPE variables in OC needed for the OC/TQ OCASI interface
NOTE there is also a c_gtp_equilibrium_data structure defined in liboctqisoc.F90 */
typedef struct {
int forcenewcalc;
double tpused[2];
double results[6];
} tpfun_parres;
typedef struct {
int splink, phlink, status;
char refstate[16];
int *endmember;
double tpref[2];
double chempot[2];
double mass, molat;
} gtp_components;
typedef struct {
int lokph, compset, ixphase, lokvares, nextcs;
} gtp_phasetuple;
typedef struct {
int statevarid, norm, unit, phref, argtyp;
int phase, compset, component, constituent;
double coeff;
int oldstv;
} gtp_state_variable;
typedef struct {
int latd, ndd, tnoofxfr, tnoofyfr, varreslink, totdis;
char id;
double *dsites;
int *nooffr;
int *splink;
int *y2x;
double *dxidyj;
double fsites;
} gtp_fraction_set;
//struct gtp_fraction_set;
typedef struct {
int nextfree, phlink, status2, phstate,phtupx;
double abnorm[3];
char prefix[4], suffix[4];
int *constat;
double *yfr;
double *mmyfr;
double *sites;
double *dpqdy;
double *d2pqdvay;
//struct gtp_fraction_set disfra;
double amfu, netcharge, dgm;
int nprop;
int *listprop;
double **gval;
double ***dgval;
double **d2gval;
double curlat[3][3];
double **cinvy;
double *cxmol;
double **cdxmol;
double *addg;
} gtp_phase_varres;
typedef struct gtp_condition {
int noofterms, statev, active, iunit, nid, iref, seqz, experimenttype;
int symlink1, symlink2;
int **indices;
double *condcoeff;
double *prescribed, current, uncertainity;
// should this be a struct ??
gtp_state_variable *statvar;
struct gtp_condition *next, *previous;
} gtp_condition;
typedef struct {
int status, multiuse, eqno, next;
char eqname[24], comment[72];
double tpval[2], rtn;
double weight;
double *svfunres;
gtp_condition *lastcondition, *lastexperiment;
gtp_components *complist;
double **compstoi, **invcompstoi;
gtp_phase_varres *phase_varres;
tpfun_parres *eq_tpres;
double *cmuval;
double xconv;
double gmindif;
int maxiter;
char eqextra[80];
int sysmatdim, nfixmu, nfixph;
int *fixmu;
int *fixph;
double **savesysmat;
} gtp_equilibrium_data;
#endif
================================================
FILE: OCisoCbinding/pyOC/example.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import os"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Imports for pyOC"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import pyOC\n",
"from pyOC import opencalphad as oc\n",
"from pyOC import PhaseStatus as phStat\n",
"from pyOC import GridMinimizerStatus as gmStat"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Setting verbosity (True or False - default), if set to yes, in particular, when getters are called the returned values are displayed in a comprehensive way"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"oc.setVerbosity(True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### reading database (.tdb file)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"(OpenCalphad being verbose): reading /home/rl211391/develop/OpenCalphad/examples/macros//steel7.TDB\n",
"(OpenCalphad being verbose): component (6) names: ['C' 'CR' 'FE' 'MO' 'SI' 'V']\n"
]
}
],
"source": [
"tdbFile=os.environ.get('OCPUBLICDATA')+'/steel7.TDB'\n",
"oc.readtdb(tdbFile)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Play with phase status"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"(OpenCalphad being verbose): modifying phases * to status PhaseStatus.Suspended\n",
"(OpenCalphad being verbose): modifying phases FCC_A1 M23C6 M6C to status PhaseStatus.Entered\n"
]
}
],
"source": [
"oc.setPhasesStatus(('* ',),phStat.Suspended)\n",
"phaseNames=('FCC_A1','M23C6','M6C')\n",
"oc.setPhasesStatus(phaseNames,phStat.Entered)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Set pressure and temperature"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"(OpenCalphad being verbose): setting pressure to 1.00e+05 Pa\n",
"(OpenCalphad being verbose): setting temperature to 1173.00 K\n"
]
}
],
"source": [
"oc.setPressure(1E5)\n",
"oc.setTemperature(1173)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Set element molar amounts"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"(OpenCalphad being verbose): setting molar amount 0.0400 for element C (0)\n",
"(OpenCalphad being verbose): setting molar amount 0.0600 for element CR (1)\n",
"(OpenCalphad being verbose): setting molar amount 0.0500 for element MO (3)\n",
"(OpenCalphad being verbose): setting molar amount 0.0030 for element SI (4)\n",
"(OpenCalphad being verbose): setting molar amount 0.0100 for element V (5)\n",
"(OpenCalphad being verbose): setting molar amount 0.8370 for element FE (2)\n"
]
}
],
"source": [
"elementMolarAmounts = {\n",
"\t'C' : 0.04,\n",
"\t'CR' : 0.06,\n",
"\t'MO': 0.05,\n",
"\t'SI': 0.003,\n",
"\t'V': 0.01,\n",
"\t'FE': 1.0-0.04-0.06-0.05-0.003-0.01\n",
"}\n",
"oc.setElementMolarAmounts(elementMolarAmounts)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Calculate equilibrium without the grid-minimizer (equilibrium record is 'eq2')"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"(OpenCalphad being verbose): creating and selecting new equilibrium record 'eq2' ('EQ2')\n",
"(OpenCalphad being verbose): calculating equilibrium with grid minimizer GridMinimizerStatus.Off\n"
]
}
],
"source": [
"oc.changeEquilibriumRecord('eq2')\n",
"oc.calculateEquilibrium(gmStat.Off)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Calculate equilibrium with the grid-minimizer (equilibrium record is 'default equilibrium')"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"(OpenCalphad being verbose): selecting equilibrium record 'default equilibrium' ('DEFAULT_EQUILIBRIUM')\n",
"(OpenCalphad being verbose): calculating equilibrium with grid minimizer GridMinimizerStatus.On\n"
]
}
],
"source": [
"oc.changeEquilibriumRecord()\n",
"oc.calculateEquilibrium()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Retrieving Gibbs energies and comparing them"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"(OpenCalphad being verbose): selecting equilibrium record 'default equilibrium' ('DEFAULT_EQUILIBRIUM')\n",
"(OpenCalphad being verbose): retrieving G: -5.767378e+04\n",
"(OpenCalphad being verbose): selecting equilibrium record 'eq2' ('EQ2')\n",
"(OpenCalphad being verbose): retrieving G: -5.760589e+04\n",
"(OpenCalphad being verbose): selecting equilibrium record 'default equilibrium' ('DEFAULT_EQUILIBRIUM')\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"G=-5.767378e+04 (vs. without grid-minimizer: -5.760589e+04)\n"
]
}
],
"source": [
"oc.changeEquilibriumRecord()\n",
"G=oc.getGibbsEnergy() # a scalar\n",
"oc.changeEquilibriumRecord('eq2')\n",
"G2=oc.getGibbsEnergy() # a scalar\n",
"print('G={0:e} (vs. without grid-minimizer: {1:e})'.format(G,G2))\n",
"oc.changeEquilibriumRecord()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Retrieving chemical potentials"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"(OpenCalphad being verbose): retrieving MU:\n",
"{\n",
" \"C\": -40277.342035801805,\n",
" \"CR\": -68893.39293504054,\n",
" \"FE\": -55314.718539072106,\n",
" \"MO\": -74567.11408055216,\n",
" \"SI\": -196024.33490496737,\n",
" \"V\": -131423.24634989392\n",
"}\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"mu_FE= -55314.718539072106\n"
]
}
],
"source": [
"mu=oc.getChemicalPotentials() # a dictionary (keys are element names, values are chemical potentials)\n",
"print('mu_FE= ',mu['FE'])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Retrieving equilibrium phases composition"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"(OpenCalphad being verbose): phases at equilibrium:\n",
"phase molar amounts:\n",
"{\n",
" \"FCC_A1#1\": 0.01920542894617253,\n",
" \"M23C6\": 0.02977621280681491,\n",
" \"M6C\": 0.09441638360236765,\n",
" \"FCC_A1_AUTO#2\": 0.856601974644645\n",
"}\n",
"phase element composition:\n",
"{\n",
" \"FCC_A1#1\": {\n",
" \"C\": 0.45665297099480046,\n",
" \"CR\": 0.03426417107693683,\n",
" \"FE\": 0.0020841630748334116,\n",
" \"MO\": 0.1443298386826512,\n",
" \"SI\": 6.681137603878831e-10,\n",
" \"V\": 0.3626688555026644\n",
" },\n",
" \"M23C6\": {\n",
" \"C\": 0.2068965517241379,\n",
" \"CR\": 0.3414624222993837,\n",
" \"FE\": 0.3838209757158874,\n",
" \"MO\": 0.06769132200309422,\n",
" \"SI\": 0.0,\n",
" \"V\": 0.00012872825749663693\n",
" },\n",
" \"M6C\": {\n",
" \"C\": 0.14285714285714285,\n",
" \"CR\": 0.06508399462251023,\n",
" \"FE\": 0.38133540345297173,\n",
" \"MO\": 0.39191933121811307,\n",
" \"SI\": 0.0,\n",
" \"V\": 0.018804127849262088\n",
" },\n",
" \"FCC_A1_AUTO#2\": {\n",
" \"C\": 0.013519853563065565,\n",
" \"CR\": 0.050232768562391776,\n",
" \"FE\": 0.9216963669684142,\n",
" \"MO\": 0.009583081354863507,\n",
" \"SI\": 0.003502209983129125,\n",
" \"V\": 0.001465719568135902\n",
" }\n",
"}\n",
"phase sites:\n",
"{\n",
" \"FCC_A1#1\": [\n",
" 1.0,\n",
" 1.0\n",
" ],\n",
" \"M23C6\": [\n",
" 20.0,\n",
" 3.0,\n",
" 6.0\n",
" ],\n",
" \"M6C\": [\n",
" 2.0,\n",
" 2.0,\n",
" 2.0,\n",
" 1.0\n",
" ],\n",
" \"FCC_A1_AUTO#2\": [\n",
" 1.0,\n",
" 1.0\n",
" ]\n",
"}\n",
"phase constituent composition:\n",
"{\n",
" \"FCC_A1#1\": {\n",
" \"sublattice 0\": {\n",
" \"CR\": 0.06306130198166399,\n",
" \"FE\": 0.0038357862720796564,\n",
" \"MO\": 0.26563104420926176,\n",
" \"SI\": 1.229626232816835e-09,\n",
" \"V\": 0.6674718663073684\n",
" },\n",
" \"sublattice 1\": {\n",
" \"C\": 0.8404444059091938,\n",
" \"VA\": 0.15955559409080622\n",
" }\n",
" },\n",
" \"M23C6\": {\n",
" \"sublattice 0\": {\n",
" \"CR\": 0.4730948138378144,\n",
" \"FE\": 0.5268934005119624,\n",
" \"V\": 1.1785650223144731e-05\n",
" },\n",
" \"sublattice 1\": {\n",
" \"CR\": 0.14683798997528025,\n",
" \"FE\": 0.19764676184049562,\n",
" \"MO\": 0.654349446029911,\n",
" \"V\": 0.0011658021543131923\n",
" },\n",
" \"sublattice 2\": {\n",
" \"C\": 1.0\n",
" }\n",
" },\n",
" \"M6C\": {\n",
" \"sublattice 0\": {\n",
" \"FE\": 1.0\n",
" },\n",
" \"sublattice 1\": {\n",
" \"MO\": 1.0\n",
" },\n",
" \"sublattice 2\": {\n",
" \"CR\": 0.2277939811787858,\n",
" \"FE\": 0.33467391208540104,\n",
" \"MO\": 0.37171765926339584,\n",
" \"V\": 0.06581444747241731\n",
" },\n",
" \"sublattice 3\": {\n",
" \"C\": 1.0\n",
" }\n",
" },\n",
" \"FCC_A1_AUTO#2\": {\n",
" \"sublattice 0\": {\n",
" \"CR\": 0.050921215945224446,\n",
" \"FE\": 0.9343283494325632,\n",
" \"MO\": 0.00971441887551069,\n",
" \"SI\": 0.0035502082791820494,\n",
" \"V\": 0.0014858074675196773\n",
" },\n",
" \"sublattice 1\": {\n",
" \"C\": 0.013705145118123152,\n",
" \"VA\": 0.9862948548818768\n",
" }\n",
" }\n",
"}\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"n_C in FCC_A1#1 = 0.45665297099480046\n",
"a_i in FCC_A1#1 = [1.0, 1.0]\n",
"y_V^0 in liquid = 0.6674718663073684\n"
]
}
],
"source": [
"phasesAtEquilibrium=oc.getPhasesAtEquilibrium() # a container class defined in pyOC.py\n",
"phaseElementComposition=phasesAtEquilibrium.getPhaseElementComposition() # a dictionary (keys are phase names) of dictionaries (keys are the element names, values are molar fractions)\n",
"print('n_C in FCC_A1#1 = ',phaseElementComposition['FCC_A1#1']['C'])\n",
"phaseSites=phasesAtEquilibrium.getPhaseSites() # a dictionary (keys are phase names, values are arrays of number of sites whose sizes depend on the number of sublattices)\n",
"print('a_i in FCC_A1#1 = ',phaseSites['FCC_A1#1'])\n",
"phaseConstituentComposition=phasesAtEquilibrium.getPhaseConstituentComposition() # a dictionary (keys are phase names) of dictionaries per sublattice (keys are the constituent names, values are molar fractions)\n",
"print('y_V^0 in liquid = ',phaseConstituentComposition['FCC_A1#1']['sublattice 0']['V'])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Retrieving constituent composition (this info is 'updated' each time the getPhasesAtEquilibrium method is called by adding constituents that were not present before)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"(OpenCalphad being verbose): constituents description:\n",
"{\n",
" \"CR\": {\n",
" \"mass\": 51.996,\n",
" \"charge\": 0.0,\n",
" \"elements\": {\n",
" \"CR\": 1.0\n",
" }\n",
" },\n",
" \"FE\": {\n",
" \"mass\": 55.846999999999994,\n",
" \"charge\": 0.0,\n",
" \"elements\": {\n",
" \"FE\": 1.0\n",
" }\n",
" },\n",
" \"MO\": {\n",
" \"mass\": 95.94,\n",
" \"charge\": 0.0,\n",
" \"elements\": {\n",
" \"MO\": 1.0\n",
" }\n",
" },\n",
" \"SI\": {\n",
" \"mass\": 28.085,\n",
" \"charge\": 0.0,\n",
" \"elements\": {\n",
" \"SI\": 1.0\n",
" }\n",
" },\n",
" \"V\": {\n",
" \"mass\": 50.941,\n",
" \"charge\": 0.0,\n",
" \"elements\": {\n",
" \"V\": 1.0\n",
" }\n",
" },\n",
" \"C\": {\n",
" \"mass\": 12.011000000000001,\n",
" \"charge\": 0.0,\n",
" \"elements\": {\n",
" \"C\": 1.0\n",
" }\n",
" },\n",
" \"VA\": {\n",
" \"mass\": 0.0,\n",
" \"charge\": 0.0,\n",
" \"elements\": {}\n",
" }\n",
"}\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"m_V = 50.941\n",
"q_V = 0.0\n",
"stoi^V_V = 1.0\n"
]
}
],
"source": [
"constituentsDescription = oc.getConstituentsDescription() # a dictionary (keys are the constituent names) of dictionaries (keys are 'mass', 'charge' and 'elements', values are respectively the constituent molar mass, the constituent eletrical charge and a dictionary - keys are element names, values are stoichiometric coefficients)\n",
"print('m_V = ',constituentsDescription['V']['mass'])\n",
"print('q_V = ',constituentsDescription['V']['charge'])\n",
"print('stoi^V_V = ',constituentsDescription['V']['elements']['V'])"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
================================================
FILE: OCisoCbinding/pyOC/example.py
================================================
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import os
# ### Imports for pyOC
# In[2]:
import pyOC
from pyOC import opencalphad as oc
from pyOC import PhaseStatus as phStat
from pyOC import GridMinimizerStatus as gmStat
# ### Setting verbosity (True or False - default), if set to yes, in particular, when getters are called the returned values are displayed in a comprehensive way
# In[3]:
oc.setVerbosity(True)
# ### reading database (.tdb file)
# In[4]:
tdbFile=os.environ.get('OCPUBLICDATA')+'/steel7.TDB'
oc.readtdb(tdbFile)
# ### Play with phase status
# In[5]:
oc.setPhasesStatus(('* ',),phStat.Suspended)
phaseNames=('FCC_A1','M23C6','M6C')
oc.setPhasesStatus(phaseNames,phStat.Entered)
# ### Set pressure and temperature
# In[6]:
oc.setPressure(1E5)
oc.setTemperature(1173)
# ### Set element molar amounts
# In[7]:
elementMolarAmounts = {
'C' : 0.04,
'CR' : 0.06,
'MO': 0.05,
'SI': 0.003,
'V': 0.01,
'FE': 1.0-0.04-0.06-0.05-0.003-0.01
}
oc.setElementMolarAmounts(elementMolarAmounts)
# ### Calculate equilibrium without the grid-minimizer (equilibrium record is 'eq2')
# In[8]:
oc.changeEquilibriumRecord('eq2')
oc.calculateEquilibrium(gmStat.Off)
# ### Calculate equilibrium with the grid-minimizer (equilibrium record is 'default equilibrium')
# In[9]:
oc.changeEquilibriumRecord()
oc.calculateEquilibrium()
# ### Retrieving Gibbs energies and comparing them
# In[10]:
oc.changeEquilibriumRecord()
G=oc.getGibbsEnergy() # a scalar
oc.changeEquilibriumRecord('eq2')
G2=oc.getGibbsEnergy() # a scalar
print('G={0:e} (vs. without grid-minimizer: {1:e})'.format(G,G2))
oc.changeEquilibriumRecord()
# ### Retrieving chemical potentials
# In[11]:
mu=oc.getChemicalPotentials() # a dictionary (keys are element names, values are chemical potentials)
print('mu_FE= ',mu['FE'])
# ### Retrieving equilibrium phases composition
# In[12]:
phasesAtEquilibrium=oc.getPhasesAtEquilibrium() # a container class defined in pyOC.py
phaseElementComposition=phasesAtEquilibrium.getPhaseElementComposition() # a dictionary (keys are phase names) of dictionaries (keys are the element names, values are molar fractions)
print('n_C in FCC_A1#1 = ',phaseElementComposition['FCC_A1#1']['C'])
phaseSites=phasesAtEquilibrium.getPhaseSites() # a dictionary (keys are phase names, values are arrays of number of sites whose sizes depend on the number of sublattices)
print('a_i in FCC_A1#1 = ',phaseSites['FCC_A1#1'])
phaseConstituentComposition=phasesAtEquilibrium.getPhaseConstituentComposition() # a dictionary (keys are phase names) of dictionaries per sublattice (keys are the constituent names, values are molar fractions)
print('y_V^0 in liquid = ',phaseConstituentComposition['FCC_A1#1']['sublattice 0']['V'])
# ### Retrieving constituent composition (this info is 'updated' each time the getPhasesAtEquilibrium method is called by adding constituents that were not present before)
# In[13]:
constituentsDescription = oc.getConstituentsDescription() # a dictionary (keys are the constituent names) of dictionaries (keys are 'mass', 'charge' and 'elements', values are respectively the constituent molar mass, the constituent eletrical charge and a dictionary - keys are element names, values are stoichiometric coefficients)
print('m_V = ',constituentsDescription['V']['mass'])
print('q_V = ',constituentsDescription['V']['charge'])
print('stoi^V_V = ',constituentsDescription['V']['elements']['V'])
================================================
FILE: OCisoCbinding/pyOC/pyOC.f90
================================================
! This module is simply a 'sanitized' and f90wrapp-compatible version of the different subroutines available in the OCASI interface (liboctq.F90)
! all subroutines of liboctq.F90 'wrapped' into a new subroutine defined here (the subroutine name is the same with a 'py' prefix)
!
module RawOpenCalphad
use liboctq
implicit none
type eq_wrapper
type(gtp_equilibrium_data), pointer :: ceq
end type eq_wrapper
type comp_wrapper
integer :: n
character(24) :: compnames(maxc)
end type comp_wrapper
! integer, parameter :: maxel=100,maxsp=1000,maxph=600,maxsubl=10,maxconst=1000
contains
function pygeterr() result(errorcode)
integer :: errorcode
errorcode = gx%bmperr
end function pygeterr
subroutine pyseterr(errorcode)
integer, intent(in) :: errorcode
gx%bmperr = errorcode
end subroutine pyseterr
subroutine pytqini(n,eq)
implicit none
integer :: n
type(eq_wrapper), intent(out) :: eq
call tqini(n,eq%ceq)
end subroutine pytqini
subroutine pytqrfil(filename,eq)
implicit none
character(*) :: filename
type(eq_wrapper) :: eq
call tqrfil(filename,eq%ceq)
end subroutine pytqrfil
subroutine pytqrpfil(filename,nsel,selel,eq)
implicit none
character(*) :: filename
integer :: nsel
character(2) :: selel(:)
type(eq_wrapper) :: eq
call tqrpfil(filename,nsel,selel,eq%ceq)
end subroutine pytqrpfil
subroutine pytqgcom(comp,eq)
implicit none
type(comp_wrapper), intent(out) :: comp
type(eq_wrapper) :: eq
call tqgcom(comp%n,comp%compnames,eq%ceq)
end subroutine pytqgcom
subroutine pytqgnp(n,eq)
implicit none
integer, intent(out) :: n
type(eq_wrapper) :: eq
call tqgnp(n,eq%ceq)
end subroutine pytqgnp
subroutine pytqgpn(phtupx,phasename,eq)
implicit none
integer :: phtupx
character(*), intent(out) :: phasename
type(eq_wrapper) :: eq
call tqgpn(phtupx,phasename,eq%ceq)
end subroutine pytqgpn
subroutine pytqgpi(phtupx,phasename,eq)
implicit none
integer, intent(out) :: phtupx
character(*) :: phasename
type(eq_wrapper) :: eq
call tqgpi(phtupx,phasename,eq%ceq)
end subroutine pytqgpi
subroutine pytqgpi2(iph,ics,phasename,eq)
implicit none
integer, intent(out) :: iph, ics
character(*) :: phasename
type(eq_wrapper) :: eq
call tqgpi2(iph,ics,phasename,eq%ceq)
end subroutine pytqgpi2
subroutine pytqgpcn2(n,c,csname)
implicit none
integer :: n
integer :: c
character(*), intent(out) :: csname
call tqgpcn2(n,c,csname)
end subroutine pytqgpcn2
subroutine pytqgpcs(c,nspel,ielno,stoi,smass,qsp)
implicit none
integer :: c
integer, intent(out) :: nspel
integer :: ielno(*)
double precision :: stoi(*)
double precision, intent(out) :: smass, qsp
call tqgpcs(c,nspel,ielno,stoi,smass,qsp)
end subroutine pytqgpcs
subroutine pytqphsts(phtupx,newstat,val,eq)
integer :: phtupx,newstat
double precision :: val
type(eq_wrapper) :: eq
call tqphsts(phtupx,newstat,val,eq%ceq)
end subroutine pytqphsts
subroutine pytqphsts2(phnames,newstat,val,eq)
character(*) :: phnames
integer :: newstat
double precision :: val
type(eq_wrapper) :: eq
call tqphsts2(phnames,newstat,val,eq%ceq)
end subroutine pytqphsts2
subroutine pytqsetc(stavar,nn1,nn2,value,cnum,eq)
implicit none
integer :: nn1
integer :: nn2
integer, intent(out) :: cnum
character(*) :: stavar
double precision :: value
type(eq_wrapper) :: eq
call tqsetc(stavar,nn1,nn2,value,cnum,eq%ceq)
end subroutine pytqsetc
subroutine pytqtgsw(i)
implicit none
integer :: i
call tqtgsw(i)
end subroutine pytqtgsw
subroutine pytqce(target,nn1,nn2,value,eq)
implicit none
integer :: nn1,nn2
character(*) :: target
double precision value
type(eq_wrapper) :: eq
call tqce(target,nn1,nn2,value,eq%ceq)
end subroutine pytqce
subroutine pytqgetv(stavar,nn1,nn2,nn3in,nn3out,values,eq)
implicit none
integer :: nn1,nn2,nn3in
integer, intent(out) :: nn3out
character(*) :: stavar
double precision :: values(*)
type(eq_wrapper) :: eq
nn3out=nn3in
call tqgetv(stavar,nn1,nn2,nn3out,values,eq%ceq)
end subroutine pytqgetv
subroutine pytqgphc1(iph,nsub,cinsub,spix,yfrac,sites,extra,eq)
implicit none
integer :: iph
integer, intent(out) :: nsub
integer :: cinsub(*),spix(*)
double precision :: sites(*),yfrac(*),extra(*)
type(eq_wrapper) :: eq
call tqgphc1(iph,nsub,cinsub,spix,yfrac,sites,extra,eq%ceq)
end subroutine pytqgphc1
subroutine pytqsphc1(nn1,yfra,extra,eq)
implicit none
integer :: nn1
double precision :: yfra(*),extra(*)
type(eq_wrapper) :: eq
call tqsphc1(nn1,yfra,extra,eq%ceq)
end subroutine pytqsphc1
subroutine pytqcph1(nn1,nn2,nn3,gtp,dgdy,d2gdydt,d2gdydp,d2gdy2,eq)
implicit none
integer :: nn1,nn2,nn3
double precision :: gtp(6),dgdy(*),d2gdydt(*),d2gdydp(*),d2gdy2(*)
type(eq_wrapper) :: eq
call tqcph1(nn1,nn2,nn3,gtp,dgdy,d2gdydt,d2gdydp,d2gdy2,eq%ceq)
end subroutine pytqcph1
subroutine pytqcph2(nn1,nn2,nn3,nn4,eq)
implicit none
integer :: nn1,nn2,nn3,nn4
type(eq_wrapper) :: eq
call tqcph2(nn1,nn2,nn3,nn4,eq%ceq)
endsubroutine pytqcph2
subroutine pytqcph3(nn1,nn2,g,eq)
implicit none
integer :: nn1,nn2
double precision :: g(*)
type(eq_wrapper) :: eq
call tqcph3(nn1,nn2,g,eq%ceq)
endsubroutine pytqcph3
subroutine pytqdceq(name)
implicit none
character(24) :: name
call tqdceq(name)
endsubroutine pytqdceq
subroutine pytqcceq(name,nn1,neweq,eq)
implicit none
character(24) :: name
integer, intent(out) :: nn1
type(eq_wrapper), intent(out) :: neweq
type(eq_wrapper) :: eq
call tqcceq(name,nn1,neweq%ceq,eq%ceq)
endsubroutine pytqcceq
subroutine pytqselceq(name,eq)
implicit none
character(24) :: name
type(eq_wrapper), intent(out) :: eq
call tqselceq(name,eq%ceq)
end subroutine pytqselceq
subroutine pytqcref(ciel,phase,tpref,eq)
implicit none
integer :: ciel
character(*) :: phase
double precision :: tpref(*)
type(eq_wrapper) :: eq
call tqcref(ciel,phase,tpref,eq%ceq)
end subroutine pytqcref
subroutine pytqlr(lut,eq)
implicit none
integer :: lut
type(eq_wrapper) :: eq
call tqlr(lut,eq%ceq)
end subroutine pytqlr
subroutine pytqlc(lut,eq)
implicit none
integer :: lut
type(eq_wrapper) :: eq
call tqlc(lut,eq%ceq)
end subroutine pytqlc
subroutine pytqquiet(yes)
implicit none
logical :: yes
call tqquiet(yes)
end subroutine pytqquiet
end module RawOpenCalphad
================================================
FILE: OCisoCbinding/pyOC/pyOC.py
================================================
import logging, sys
import json
import numpy as np
import rawpyOC
from rawpyOC import rawopencalphad as oc
from enum import IntEnum
class PhaseStatus(IntEnum):
Suspended = -3
Dormant = -2
Entered = 0
Fixed = 2
class GridMinimizerStatus(IntEnum):
On = 0
Off = -1
class PhasesAtEquilibrium(object):
def __init__(self, phaseMolarAmounts, phaseElementComposition, phaseSites, phaseConstituentComposition):
self.__phaseMolarAmounts=phaseMolarAmounts
self.__phaseElementComposition=phaseElementComposition
self.__phaseSites=phaseSites
self.__phaseConstituentComposition=phaseConstituentComposition
def getPhaseMolarAmounts(self):
return self.__phaseMolarAmounts
def getPhaseElementComposition(self):
return self.__phaseElementComposition
def getPhaseSites(self):
return self.__phaseSites
def getPhaseConstituentComposition(self):
return self.__phaseConstituentComposition
def __str__(self):
return 'phase molar amounts:\n'+json.dumps(self.__phaseMolarAmounts, indent=4)+'\nphase element composition:\n'+json.dumps(self.__phaseElementComposition, indent=4)+'\nphase sites:\n'+json.dumps(self.__phaseSites, indent=4)+'\nphase constituent composition:\n'+json.dumps(self.__phaseConstituentComposition, indent=4)
class OpenCalphad(object):
_defaultEquilibriumName='default equilibrium'
_maxNbPhases=400
_maxNbElements=100
_maxNbSublattices=10
_maxNbConstituents=100
def __init__(self):
self.__equilibriumNamesInOC = {}
self.__constituentsDescription = {}
self.__logger = logging.getLogger('OpenCalphad')
self.__logger .setLevel(logging.INFO)
ch = logging.StreamHandler()
ch.setStream(sys.stderr)
ch.setLevel(logging.INFO)
formatter = logging.Formatter('(%(name)s being verbose): %(message)s')
ch.setFormatter(formatter)
self.__logger.addHandler(ch)
def setVerbosity(self, isVerbose):
if (isVerbose):
level= logging.DEBUG
else:
level = logging.INFO
self.__logger.setLevel(level)
for handler in self.__logger.handlers:
handler.setLevel(level)
oc.pytqquiet(~isVerbose)
def raw(self):
return oc
def eq(self):
return self.__eq
def readtdb(self,tdbFilePath, elements=None):
self.__eq = oc.pytqini(1)
if self.__logger.getEffectiveLevel() is not logging.DEBUG:
oc.pytqquiet(True)
self.__eqName = OpenCalphad._defaultEquilibriumName
eqNameInOC='%s' % self.__eqName.upper().replace(' ','_')
self.__equilibriumNamesInOC[self.__eqName]=eqNameInOC
self.__logger.debug('reading %s', tdbFilePath)
if elements is None:
oc.pytqrfil(tdbFilePath,self.__eq)
else:
oc.pytqrpfil(tdbFilePath,len(elements),(''.join(['%-2s']*len(elements)))%elements,self.__eq)
comp = oc.pytqgcom(self.__eq)
self.__componentNames=np.array([comp.compnames[:,i].tostring().decode().strip() for i in range(comp.n)])
self.__nbComponents=comp.n
self.__logger.debug('component (%d) names: %s', self.__nbComponents, self.__componentNames)
def getComponentNames(self):
return self.__componentNames
def getConstituentsDescription(self):
self.__logger.debug('constituents description:\n'+json.dumps(self.__constituentsDescription, indent=4))
return self.__constituentsDescription
def setPhasesStatus(self, phaseNames, phaseStatus, phaseAmount=0.0):
phaseList=(' '.join(['%s']*len(phaseNames))) % phaseNames
self.__logger.debug('modifying phases %s to status %s', phaseList, phaseStatus)
oc.pytqphsts2(phaseList,phaseStatus,phaseAmount,self.__eq)
def setTemperature(self,temperature):
self.__logger.debug('setting temperature to %5.2f K', temperature)
oc.pytqsetc('T',0,0,temperature,self.__eq)
def setPressure(self,pressure):
self.__logger.debug('setting pressure to %3.2e Pa', pressure)
oc.pytqsetc('P',0,0,pressure,self.__eq)
def setElementMolarAmounts(self,elementMolarAmounts):
for el, n in elementMolarAmounts.items():
i=np.where(self.__componentNames==el)[0]
self.__logger.debug('setting molar amount %5.4f for element %s (%d)',n,el,i)
oc.pytqsetc('N',i+1,0,n,self.__eq)
def changeEquilibriumRecord(self,eqName=None,copiedEqName=None):
if eqName is None:
eqName=OpenCalphad._defaultEquilibriumName
if copiedEqName is None:
copiedEqName=OpenCalphad._defaultEquilibriumName
eqNameInOC=self.__equilibriumNamesInOC.get(eqName,'')
if (eqNameInOC==''):
eqNameInOC='%s' % eqName.upper().replace(' ','_')
self.__equilibriumNamesInOC[eqName]=eqNameInOC
eq=oc.pytqselceq(self.__equilibriumNamesInOC[copiedEqName])
self.__logger.debug('creating and selecting new equilibrium record \'%s\' (\'%s\')', eqName, eqNameInOC)
iCopiedEq,self.__eq=oc.pytqcceq(eqNameInOC,eq)
else:
self.__logger.debug('selecting equilibrium record \'%s\' (\'%s\')', eqName, eqNameInOC)
self.__eq=oc.pytqselceq(eqNameInOC)
self.__eqName = eqName
def calculateEquilibrium(self,gridMinimizerStatus=GridMinimizerStatus.On):
self.__logger.debug('calculating equilibrium with grid minimizer %s', gridMinimizerStatus)
if (self.__logger.isEnabledFor(level=logging.DEBUG)):
oc.pytqlc(6,self.__eq)
oc.pytqce('',gridMinimizerStatus,0,0.0,self.__eq)
if (self.__logger.isEnabledFor(level=logging.DEBUG)):
oc.pytqlr(6,self.__eq)
def getErrorCode(self):
return oc.pygeterr()
def resetErrorCode(self):
return oc.pyseterr(0)
def getScalarResult(self,symbol):
value=np.empty(1)
oc.pytqgetv(symbol,0,0,1,value,self.__eq)
self.__logger.debug('retrieving %s: %e',symbol,value[0])
return value[0]
def getGibbsEnergy(self):
return self.getScalarResult('G')
def getComponentAssociatedResult(self, symbol):
values={}
value=np.empty(1)
for i in range(self.__nbComponents):
oc.pytqgetv(symbol,i+1,0,1,value,self.__eq)
values[self.__componentNames[i]] = value[0]
self.__logger.debug('retrieving %s:\n%s',symbol,json.dumps(values, indent=4))
return values
def getChemicalPotentials(self):
return self.getComponentAssociatedResult('MU')
def getPhasesAtEquilibrium(self):
tmpNbPhases=np.empty(OpenCalphad._maxNbPhases)
tmpNbElements=np.empty(OpenCalphad._maxNbElements)
tmpiNbElements=np.empty(OpenCalphad._maxNbElements, dtype=np.int32)
tmpiNbSublattices=np.empty(OpenCalphad._maxNbSublattices, dtype=np.int32)
tmpNbSublattices=np.empty(OpenCalphad._maxNbSublattices)
tmpiNbConstituents=np.empty(OpenCalphad._maxNbSublattices*OpenCalphad._maxNbConstituents, dtype=np.int32)
tmpNbConstituents=np.empty(OpenCalphad._maxNbSublattices*OpenCalphad._maxNbConstituents)
tmp5=np.empty(5)
#
nbPhases=oc.pytqgetv('NP',-1,0,OpenCalphad._maxNbPhases,tmpNbPhases,self.__eq)
phaseMolarAmounts={}
phaseElementComposition={}
phaseSites={}
phaseConstituentComposition={}
for i in range(nbPhases):
if (tmpNbPhases[i]>0.0):
#
phaseName=oc.pytqgpn(i+1,self.__eq).decode().strip()
phaseMolarAmounts[phaseName] = tmpNbPhases[i]
#
iph, ics = oc.pytqgpi2(phaseName,self.__eq)
#
phaseElementComposition[phaseName] = {}
nbElements=oc.pytqgetv('X',i+1,-1,OpenCalphad._maxNbElements,tmpNbElements,self.__eq)
for j in range(nbElements):
phaseElementComposition[phaseName][self.__componentNames[j]]=tmpNbElements[j]
#
phaseConstituentComposition[phaseName]={}
phaseName=oc.pytqgpn(i+1,self.__eq).decode().strip()
nbSublattices = oc.pytqgphc1(i+1, tmpiNbSublattices, tmpiNbConstituents, tmpNbConstituents, tmpNbSublattices, tmp5, self.__eq)
phaseSites[phaseName] = tmpNbSublattices[0:nbSublattices].tolist()
count = 0
for j in range(nbSublattices):
sublatticeConstituentComposition = {}
offset = count
for k in np.nditer(tmpiNbConstituents[offset:offset+tmpiNbSublattices[j]]):
constituentName = oc.pytqgpcn2(iph,count+1).decode().strip()
sublatticeConstituentComposition[constituentName] = tmpNbConstituents[count]
if not constituentName in self.__constituentsDescription:
nspel, smass, qsp = oc.pytqgpcs(k, tmpiNbElements, tmpNbElements)
self.__constituentsDescription[constituentName] = {}
self.__constituentsDescription[constituentName]['mass'] = smass
self.__constituentsDescription[constituentName]['charge'] = qsp
self.__constituentsDescription[constituentName]['elements'] = { self.__componentNames[tmpiNbElements[l]-1] : tmpNbElements[l] for l in range(nspel) if (tmpiNbElements[l]>0)}
count += 1
if (nbSublattices==1):
phaseConstituentComposition[phaseName] = sublatticeConstituentComposition
else:
phaseConstituentComposition[phaseName]["sublattice {0:d}".format(j)] = sublatticeConstituentComposition
phasesAtEquilibrium=PhasesAtEquilibrium(phaseMolarAmounts,phaseElementComposition,phaseSites,phaseConstituentComposition)
self.__logger.debug('phases at equilibrium:\n%s',phasesAtEquilibrium)
return phasesAtEquilibrium
opencalphad = OpenCalphad()
================================================
FILE: OCisoCbinding/pyOC/pyOCUnitTest.py
================================================
import unittest
import numpy as np
import os
import pyOC
from pyOC import opencalphad as oc
from pyOC import PhaseStatus as phStat
from pyOC import GridMinimizerStatus as gmStat
@unittest.skipUnless(os.path.exists(os.environ.get('OCPRIVATEDATA','')+'/feouzr.tdb'), 'requires feouzr database')
class test_feouzr(unittest.TestCase):
def setUp(self):
oc.setVerbosity(False)
# tdb filepath
tdbFile=os.environ['OCPRIVATEDATA']+'/feouzr.tdb'
# reading tdb
elems=('O', 'U', 'ZR')
oc.readtdb(tdbFile,elems)
# set pressure
oc.setPressure(1E5)
#Some global data, reference state SER ......................:
#T= 3000.00 K ( 2726.85 C), P= 1.0000E+05 Pa, V= 0.0000E+00 m3
#N= 1.0000E+00 moles, B= 1.1041E+02 g, RT= 2.4944E+04 J/mol
#GS= -4.67120E+05 J, GS/N=-4.6712E+05 J/mol, HS=-1.0408E+05 J, SS= 1.210E+02 J/K
#Some data for components ...................................:
#Component name Moles Mole-fr Chem.pot/RT Activities Ref.state
#O 4.1492E-01 0.41492 -2.6690E+01 2.5636E-12 SER (default)
#U 3.4330E-01 0.34330 -1.4184E+01 6.9174E-07 SER (default)
#ZR 2.4178E-01 0.24178 -1.1513E+01 9.9991E-06 SER (default)
#Some data for phases .......................................:
#Name Status Moles Volume Form.Units Cmp/FU dGm/RT Comp:
#LIQUID.................. E 2.832E-01 0.00E+00 2.34E-01 1.21 0.00E+00 X:
# U 4.44834E-01 ZR 3.82781E-01 O 1.72385E-01
# Constitution: There are 5 constituents:
# U1 4.90503E-01 O2ZR1 5.71591E-02 O1 3.11648E-07
# ZR1 4.05352E-01 O2U1 4.69863E-02
#LIQUID_AUTO#2........... E 7.168E-01 0.00E+00 3.51E-01 2.04 0.00E+00 X:
# O 5.10761E-01 U 3.03177E-01 ZR 1.86062E-01
# Constitution: There are 5 constituents:
# O2U1 3.87533E-01 U1 2.32157E-01 O1 1.80264E-06
# ZR1 2.45847E-01 O2ZR1 1.34461E-01
def test_LiquidWithMiscibilityGap(self):
# set temperature
oc.setTemperature(3000)
# set element molar amounts
elementMolarAmounts = {
'U' : 0.343298,
'O' : 0.414924,
'ZR': 0.241778
}
oc.setElementMolarAmounts(elementMolarAmounts)
# calculate equilibrium
oc.calculateEquilibrium(gmStat.On)
# retrieving Gibbs energy
G=oc.getGibbsEnergy()
np.testing.assert_allclose(G, -4.67120E+05, rtol=1e-5, atol=0)
# retrieving mu data
mu=oc.getChemicalPotentials()
self.assertListEqual(list(mu.keys()), ['O', 'U', 'ZR'])
np.testing.assert_array_almost_equal(list(mu.values()), [-2.6690E+01*2.4944E+04, -1.4184E+01*2.4944E+04, -1.1513E+01*2.4944E+04], decimal=-2)
# retrieving equilibrium phases composition
phasesAtEquilibrium=oc.getPhasesAtEquilibrium()
phaseElementComposition=phasesAtEquilibrium.getPhaseElementComposition()
self.assertListEqual(list(phaseElementComposition.keys()), ['LIQUID#1', 'LIQUID_AUTO#2'])
self.assertListEqual(list(phaseElementComposition['LIQUID#1'].keys()), ['O', 'U', 'ZR'])
self.assertListEqual(list(phaseElementComposition['LIQUID_AUTO#2'].keys()), ['O', 'U', 'ZR'])
np.testing.assert_array_almost_equal(list(phaseElementComposition['LIQUID#1'].values()), [5.10761E-01,3.03177E-01,1.86062E-01], decimal=6)
np.testing.assert_array_almost_equal(list(phaseElementComposition['LIQUID_AUTO#2'].values()), [1.72385E-01,4.44834E-01,3.82781E-01], decimal=6)
phaseSites=phasesAtEquilibrium.getPhaseSites()
self.assertListEqual(list(phaseSites.keys()), ['LIQUID#1', 'LIQUID_AUTO#2'])
np.testing.assert_array_almost_equal(np.array(list(phaseSites.values())).ravel(), [1.0, 1.0], decimal=6)
phaseConstituentComposition=phasesAtEquilibrium.getPhaseConstituentComposition()
self.assertListEqual(list(phaseConstituentComposition.keys()), ['LIQUID#1', 'LIQUID_AUTO#2'])
self.assertListEqual(list(phaseConstituentComposition['LIQUID#1'].keys()), ['O1', 'O2U1', 'O2ZR1', 'U1', 'ZR1'])
self.assertListEqual(list(phaseConstituentComposition['LIQUID_AUTO#2'].keys()), ['O1', 'O2U1', 'O2ZR1', 'U1', 'ZR1'])
np.testing.assert_array_almost_equal(list(phaseConstituentComposition['LIQUID_AUTO#2'].values()), [3.11648E-07,4.69863E-02,5.71591E-02,4.90503E-01,4.05352E-01], decimal=6)
np.testing.assert_array_almost_equal(list(phaseConstituentComposition['LIQUID#1'].values()), [1.80264E-06,3.87533E-01,1.34461E-01,2.32157E-01,2.45847E-01], decimal=6)
# retrieving constituent composition
constituentsDescription = oc.getConstituentsDescription()
## to be tested
#Some global data, reference state SER ......................:
#T= 3000.00 K ( 2726.85 C), P= 1.0000E+05 Pa, V= 0.0000E+00 m3
#N= 1.0000E+00 moles, B= 1.1041E+02 g, RT= 2.4944E+04 J/mol
#GS= -4.66921E+05 J, GS/N=-4.6692E+05 J/mol, HS=-1.0182E+05 J, SS= 1.217E+02 J/K
#Some data for components ...................................:
#Component name Moles Mole-fr Chem.pot/RT Activities Ref.state
#O 4.1492E-01 0.41492 -2.6734E+01 2.4518E-12 SER (default)
#U 3.4330E-01 0.34330 -1.4119E+01 7.3804E-07 SER (default)
#ZR 2.4178E-01 0.24178 -1.1495E+01 1.0177E-05 SER (default)
#Some data for phases .......................................:
#Name Status Moles Volume Form.Units Cmp/FU dGm/RT Comp:
#LIQUID.................. E 1.000E+00 0.00E+00 5.85E-01 1.71 0.00E+00 X:
# O 4.14924E-01 U 3.43298E-01 ZR 2.41778E-01
# Constitution: There are 5 constituents:
# U1 3.35427E-01 O2U1 2.51330E-01 O1 1.03405E-06
# ZR1 3.09983E-01 O2ZR1 1.03259E-01
def test_LiquidWithoutMiscibilityGap(self):
# set temperature
oc.setTemperature(3000)
# set element molar amounts
elementMolarAmounts = {
'U' : 0.343298,
'O' : 0.414924,
'ZR': 0.241778
}
oc.setElementMolarAmounts(elementMolarAmounts)
# keep only liquid phase
oc.setPhasesStatus(('* ',),phStat.Suspended)
oc.setPhasesStatus(('LIQUID',),phStat.Entered, 1.0)
# calculate equilibrium
oc.calculateEquilibrium(gmStat.Off)
# retrieving Gibbs energy
G=oc.getGibbsEnergy()
np.testing.assert_allclose(G, -4.66921E+05, rtol=1e-5, atol=0)
# retrieving mu data
mu=oc.getChemicalPotentials()
self.assertListEqual(list(mu.keys()), ['O', 'U', 'ZR'])
np.testing.assert_array_almost_equal(list(mu.values()), [-2.6734E+01*2.4944E+04, -1.4119E+01*2.4944E+04, -1.1495E+01*2.4944E+04], decimal=-2)
# retrieving equilibrium phases composition
phasesAtEquilibrium=oc.getPhasesAtEquilibrium()
phaseElementComposition=phasesAtEquilibrium.getPhaseElementComposition()
self.assertListEqual(list(phaseElementComposition.keys()), ['LIQUID'])
self.assertListEqual(list(phaseElementComposition['LIQUID'].keys()), ['O', 'U', 'ZR'])
np.testing.assert_array_almost_equal(list(phaseElementComposition['LIQUID'].values()), [4.14924E-01,3.43298E-01,2.41778E-01], decimal=6)
phaseSites=phasesAtEquilibrium.getPhaseSites()
self.assertListEqual(list(phaseSites.keys()), ['LIQUID'])
np.testing.assert_array_almost_equal(np.array(list(phaseSites.values())).ravel(), [1.0], decimal=6)
phaseConstituentComposition=phasesAtEquilibrium.getPhaseConstituentComposition()
self.assertListEqual(list(phaseConstituentComposition.keys()), ['LIQUID'])
self.assertListEqual(list(phaseConstituentComposition['LIQUID'].keys()), ['O1', 'O2U1', 'O2ZR1', 'U1', 'ZR1'])
np.testing.assert_array_almost_equal(list(phaseConstituentComposition['LIQUID'].values()), [1.03405E-06,2.51330E-01,1.03259E-01,3.35427E-01,3.09983E-01], decimal=6)
#Some global data, reference state SER ......................:
#T= 3000.00 K ( 2726.85 C), P= 1.0000E+05 Pa, V= 0.0000E+00 m3
#N= 1.0000E+00 moles, B= 1.1041E+02 g, RT= 2.4944E+04 J/mol
#GS= -4.62227E+05 J, GS/N=-4.6223E+05 J/mol, HS=-8.1712E+04 J, SS= 1.268E+02 J/K
#Some data for components ...................................:
#Component name Moles Mole-fr Chem.pot/RT Activities Ref.state
#O 4.1492E-01 0.41492 -2.6954E+01 1.9681E-12 SER (default)
#U 3.4330E-01 0.34330 -1.3372E+01 1.5588E-06 SER (default)
#ZR 2.4178E-01 0.24178 -1.1402E+01 1.1178E-05 SER (default)
#Some data for phases .......................................:
#Name Status Moles Volume Form.Units Cmp/FU dGm/RT Comp:
#C1_FCC.................. E 3.461E-01 0.00E+00 1.42E-01 2.43 0.00E+00 X:
# O 5.88380E-01 U 3.35030E-01 ZR 7.65900E-02
# Constitution: There are 5 constituents:
# O2U1 6.34573E-01 ZR1 1.05930E-01 O1 5.93474E-07
# U1 1.79357E-01 O2ZR1 8.01390E-02
#HCP_A3.................. E 6.539E-01 0.00E+00 4.43E-01 1.48 0.00E+00 X:
# U 3.47675E-01 ZR 3.29218E-01 O 3.23107E-01
# Constitution: Sublattice 1 with 2 constituents and 0.500000 sites
# O1 9.54677E-01 VA 4.53225E-02
# Sublattice 2 with 2 constituents and 1.000000 sites
# U1 5.13633E-01 ZR1 4.86367E-01
def test_SuspendingLiquid(self):
# set temperature
oc.setTemperature(3000)
# set element molar amounts
elementMolarAmounts = {
'U' : 0.343298,
'O' : 0.414924,
'ZR': 0.241778
}
oc.setElementMolarAmounts(elementMolarAmounts)
# keep only liquid phase
oc.setPhasesStatus(('LIQUID',),phStat.Suspended)
# calculate equilibrium
oc.calculateEquilibrium(gmStat.On)
# retrieving Gibbs energy
G=oc.getGibbsEnergy()
np.testing.assert_allclose(G, -4.62227E+05, rtol=1e-5, atol=0)
# retrieving mu data
mu=oc.getChemicalPotentials()
self.assertListEqual(list(mu.keys()), ['O', 'U', 'ZR'])
np.testing.assert_array_almost_equal(list(mu.values()), [-2.6954E+01*2.4944E+04, -1.3372E+01*2.4944E+04, -1.1402E+01*2.4944E+04], decimal=-2)
# retrieving equilibrium phases composition
phasesAtEquilibrium=oc.getPhasesAtEquilibrium()
phaseElementComposition=phasesAtEquilibrium.getPhaseElementComposition()
self.assertListEqual(list(phaseElementComposition.keys()), ['C1_FCC', 'HCP_A3'])
self.assertListEqual(list(phaseElementComposition['C1_FCC'].keys()), ['O', 'U', 'ZR'])
np.testing.assert_array_almost_equal(list(phaseElementComposition['C1_FCC'].values()), [5.88380E-01,3.35030E-01,7.65900E-02], decimal=6)
self.assertListEqual(list(phaseElementComposition['HCP_A3'].keys()), ['O', 'U', 'ZR'])
np.testing.assert_array_almost_equal(list(phaseElementComposition['HCP_A3'].values()), [3.23107E-01,3.47675E-01,3.29218E-01], decimal=6)
@unittest.skipUnless(os.path.exists(os.environ.get('OCPUBLICDATA','')+'/steel7.TDB'), 'requires steel7 database')
class test_steel7(unittest.TestCase):
def setUp(self):
oc.setVerbosity(False)
# tdb filepath
tdbFile=os.environ['OCPUBLICDATA']+'/steel7.TDB'
# reading tdb
oc.readtdb(tdbFile)
# set pressure
oc.setPressure(1E5)
#Some global data, reference state SER ......................:
#T= 1173.00 K ( 899.85 C), P= 1.0000E+05 Pa, V= 6.2399E-06 m3
#N= 1.0000E+00 moles, B= 5.5735E+01 g, RT= 9.7529E+03 J/mol
#G= -5.76738E+04 J, G/N=-5.7674E+04 J/mol, H= 3.1856E+04 J, S= 7.633E+01 J/K
#Some data for components ...................................:
#Component name Moles Mole-fr Chem.pot/RT Activities Ref.state
#C 4.0000E-02 0.04000 -4.1298E+00 1.6087E-02 SER (default)
#CR 6.0000E-02 0.06000 -7.0639E+00 8.5546E-04 SER (default)
#FE 8.3700E-01 0.83700 -5.6716E+00 3.4423E-03 SER (default)
#MO 5.0000E-02 0.05000 -7.6456E+00 4.7813E-04 SER (default)
#SI 3.0000E-03 0.00300 -2.0099E+01 1.8668E-09 SER (default)
#V 1.0000E-02 0.01000 -1.3475E+01 1.4053E-06 SER (default)
#Some data for phases .......................................:
#Name Status Moles Volume Form.Units Cmp/FU dGm/RT Comp:
#FCC_A1#1................ E 1.921E-02 5.45E-09 1.04E-02 1.84 0.00E+00 X:
# C 4.56653E-01 MO 1.44330E-01 FE 2.08416E-03 SI 6.67740E-10
# V 3.62669E-01 CR 3.42642E-02
#Constitution: Sublattice 1 with 5 constituents and 1.000000 sites
# V 6.67472E-01 CR 6.30613E-02 FE 3.83579E-03 SI 1.22894E-09
# MO 2.65631E-01
# Sublattice 2 with 2 constituents and 1.000000 sites
# C 8.40444E-01 VA 1.59556E-01
#FCC_A1_AUTO#2........... E 8.566E-01 6.20E-06 8.45E-01 1.01 0.00E+00 X:
# FE 9.21696E-01 C 1.35199E-02 SI 3.50221E-03 V 1.46572E-03
# CR 5.02328E-02 MO 9.58308E-03
#Constitution: Sublattice 1 with 5 constituents and 1.000000 sites
# FE 9.34328E-01 MO 9.71442E-03 SI 3.55021E-03 V 1.48581E-03
# CR 5.09212E-02
# Sublattice 2 with 2 constituents and 1.000000 sites
# VA 9.86295E-01 C 1.37051E-02
#M23C6................... E 2.978E-02 3.53E-08 1.03E-03 29.00 0.00E+00 X:
# FE 3.83821E-01 C 2.06897E-01 V 1.28728E-04 SI 0.00000E+00
# CR 3.41462E-01 MO 6.76913E-02
#Constitution: Sublattice 1 with 3 constituents and 20.000000 sites
# FE 5.26893E-01 CR 4.73095E-01 V 1.17857E-05
# Sublattice 2 with 4 constituents and 3.000000 sites
# MO 6.54349E-01 FE 1.97647E-01 CR 1.46838E-01 V 1.16580E-03
# Sublattice 3 with 1 constituents and 6.000000 sites
# C 1.00000E+00
#M6C..................... E 9.442E-02 0.00E+00 1.35E-02 7.00 0.00E+00 X:
# MO 3.91919E-01 C 1.42857E-01 V 1.88041E-02 SI 0.00000E+00
# FE 3.81335E-01 CR 6.50840E-02
#Constitution: Sublattice 1 with 1 constituents and 2.000000 sites
# FE 1.00000E+00
# Sublattice 2 with 1 constituents and 2.000000 sites
# MO 1.00000E+00
# Sublattice 3 with 4 constituents and 2.000000 sites
# MO 3.71718E-01 FE 3.34674E-01 CR 2.27794E-01 V 6.58144E-02
# Sublattice 4 with 1 constituents and 1.000000 sites
#C 1.00000E+00
def test_melting(self):
# set temperature
oc.setTemperature(1173)
# set element molar amounts
elementMolarAmounts = {
'C' : 0.04,
'CR' : 0.06,
'MO': 0.05,
'SI': 0.003,
'V': 0.01,
'FE': 1.0-0.04-0.06-0.05-0.003-0.01
}
oc.setElementMolarAmounts(elementMolarAmounts)
# calculate equilibrium
oc.calculateEquilibrium(gmStat.On)
# retrieving Gibbs energy
G=oc.getGibbsEnergy()
np.testing.assert_allclose(G, -5.76738E+04, rtol=1e-5, atol=0)
# retrieving mu data
mu=oc.getChemicalPotentials()
self.assertListEqual(list(mu.keys()), ['C', 'CR', 'FE', 'MO', 'SI', 'V'])
np.testing.assert_array_almost_equal(list(mu.values()), [-4.1298E+00*9.7529E+03, -7.0639E+00*9.7529E+03, -5.6716E+00*9.7529E+03, -7.6456E+00*9.7529E+03, -2.0099E+01*9.7529E+03, -1.3475E+01*9.7529E+03], decimal=-2)
# retrieving equilibrium phases composition
phasesAtEquilibrium=oc.getPhasesAtEquilibrium()
phaseElementComposition=phasesAtEquilibrium.getPhaseElementComposition()
self.assertListEqual(list(phaseElementComposition.keys()), ['FCC_A1#1', 'M23C6', 'M6C', 'FCC_A1_AUTO#2'])
self.assertListEqual(list(phaseElementComposition['FCC_A1#1'].keys()), ['C', 'CR', 'FE', 'MO', 'SI', 'V'])
self.assertListEqual(list(phaseElementComposition['FCC_A1_AUTO#2'].keys()), ['C', 'CR', 'FE', 'MO', 'SI', 'V'])
self.assertListEqual(list(phaseElementComposition['M23C6'].keys()), ['C', 'CR', 'FE', 'MO', 'SI', 'V'])
self.assertListEqual(list(phaseElementComposition['M6C'].keys()), ['C', 'CR', 'FE', 'MO', 'SI', 'V'])
np.testing.assert_array_almost_equal(list(phaseElementComposition['FCC_A1#1'].values()), [4.56653E-01,3.42642E-02,2.08416E-03,1.44330E-01,6.67740E-10,3.62669E-01], decimal=6)
np.testing.assert_array_almost_equal(list(phaseElementComposition['FCC_A1_AUTO#2'].values()), [1.35199E-02,5.02328E-02,9.21696E-01,9.58308E-03,3.50221E-03,1.46572E-03], decimal=6)
np.testing.assert_array_almost_equal(list(phaseElementComposition['M23C6'].values()), [2.06897E-01,3.41462E-01,3.83821E-01,6.76913E-02,0.0,1.28728E-04], decimal=6)
np.testing.assert_array_almost_equal(list(phaseElementComposition['M6C'].values()), [1.42857E-01,6.50840E-02,3.81335E-01,3.91919E-01,0.0,1.88041E-02], decimal=6)
phaseSites=phasesAtEquilibrium.getPhaseSites()
self.assertListEqual(list(phaseSites.keys()), ['FCC_A1#1', 'M23C6', 'M6C', 'FCC_A1_AUTO#2'])
np.testing.assert_array_almost_equal(phaseSites['FCC_A1#1'], [1.0, 1.0])
np.testing.assert_array_almost_equal(phaseSites['FCC_A1_AUTO#2'], [1.0, 1.0])
np.testing.assert_array_almost_equal(phaseSites['M23C6'], [20.0, 3.0, 6.0])
np.testing.assert_array_almost_equal(phaseSites['M6C'], [2.0, 2.0, 2.0, 1.0])
phaseConstituentComposition=phasesAtEquilibrium.getPhaseConstituentComposition()
self.assertListEqual(list(phaseConstituentComposition.keys()), ['FCC_A1#1', 'M23C6', 'M6C', 'FCC_A1_AUTO#2'])
self.assertListEqual(list(phaseConstituentComposition['FCC_A1#1'].keys()), ['sublattice 0', 'sublattice 1'])
self.assertListEqual(list(phaseConstituentComposition['FCC_A1#1']['sublattice 0'].keys()), ['CR', 'FE', 'MO', 'SI', 'V'])
self.assertListEqual(list(phaseConstituentComposition['FCC_A1#1']['sublattice 1'].keys()), ['C', 'VA'])
np.testing.assert_array_almost_equal(list(phaseConstituentComposition['FCC_A1#1']['sublattice 0'].values()), [6.30613E-02,3.83579E-03,2.65631E-01,1.22894E-09,6.67472E-01], decimal=6)
np.testing.assert_array_almost_equal(list(phaseConstituentComposition['FCC_A1#1']['sublattice 1'].values()), [8.40444E-01,1.59556E-01], decimal=6)
self.assertListEqual(list(phaseConstituentComposition['FCC_A1_AUTO#2'].keys()), ['sublattice 0', 'sublattice 1'])
self.assertListEqual(list(phaseConstituentComposition['FCC_A1_AUTO#2']['sublattice 0'].keys()), ['CR', 'FE', 'MO', 'SI', 'V'])
self.assertListEqual(list(phaseConstituentComposition['FCC_A1_AUTO#2']['sublattice 1'].keys()), ['C', 'VA'])
np.testing.assert_array_almost_equal(list(phaseConstituentComposition['FCC_A1_AUTO#2']['sublattice 0'].values()), [5.09212E-02,9.34328E-01,9.71442E-03,3.55021E-03,1.48581E-03], decimal=6)
np.testing.assert_array_almost_equal(list(phaseConstituentComposition['FCC_A1_AUTO#2']['sublattice 1'].values()), [1.37051E-02,9.86295E-01], decimal=6)
self.assertListEqual(list(phaseConstituentComposition['M23C6'].keys()), ['sublattice 0', 'sublattice 1', 'sublattice 2'])
self.assertListEqual(list(phaseConstituentComposition['M23C6']['sublattice 0'].keys()), ['CR', 'FE', 'V'])
self.assertListEqual(list(phaseConstituentComposition['M23C6']['sublattice 1'].keys()), ['CR', 'FE', 'MO', 'V'])
self.assertListEqual(list(phaseConstituentComposition['M23C6']['sublattice 2'].keys()), ['C'])
np.testing.assert_array_almost_equal(list(phaseConstituentComposition['M23C6']['sublattice 0'].values()), [4.73095E-01,5.26893E-01,1.17857E-05], decimal=6)
np.testing.assert_array_almost_equal(list(phaseConstituentComposition['M23C6']['sublattice 1'].values()), [1.46838E-01,1.97647E-01,6.54349E-01,1.16580E-03], decimal=6)
np.testing.assert_array_almost_equal(list(phaseConstituentComposition['M23C6']['sublattice 2'].values()), [1.0], decimal=6)
self.assertListEqual(list(phaseConstituentComposition['M6C'].keys()), ['sublattice 0', 'sublattice 1', 'sublattice 2', 'sublattice 3'])
self.assertListEqual(list(phaseConstituentComposition['M6C']['sublattice 0'].keys()), ['FE'])
self.assertListEqual(list(phaseConstituentComposition['M6C']['sublattice 1'].keys()), ['MO'])
self.assertListEqual(list(phaseConstituentComposition['M6C']['sublattice 2'].keys()), ['CR', 'FE', 'MO', 'V'])
self.assertListEqual(list(phaseConstituentComposition['M6C']['sublattice 3'].keys()), ['C'])
np.testing.assert_array_almost_equal(list(phaseConstituentComposition['M6C']['sublattice 0'].values()), [1.0], decimal=6)
np.testing.assert_array_almost_equal(list(phaseConstituentComposition['M6C']['sublattice 1'].values()), [1.0], decimal=6)
np.testing.assert_array_almost_equal(list(phaseConstituentComposition['M6C']['sublattice 2'].values()), [2.27794E-01,3.34674E-01,3.71718E-01,6.58144E-02], decimal=6)
np.testing.assert_array_almost_equal(list(phaseConstituentComposition['M6C']['sublattice 3'].values()), [1.0], decimal=6)
# retrieving constituent composition
constituentsDescription = oc.getConstituentsDescription()
## to be tested
# unset temperature
oc.raw().pytqsetc('T=NONE',0,0,0.0,oc.eq())
# set liquid phase as fixed at 0.0
oc.setPhasesStatus(('LIQUID',),phStat.Fixed,0.0)
# calculate equilibrium associated with melting temperature
oc.calculateEquilibrium(gmStat.Off)
meltingTemperature=oc.getScalarResult('T')
np.testing.assert_allclose(meltingTemperature, 1501.45395, rtol=1e-5, atol=0)
if __name__ == '__main__':
unittest.main()
================================================
FILE: README.md
================================================
This is the development version of OpenCalphad, normally updated a few times each month.
The stable version can be downloaded from http://opencalphad.org either as a zip file or as a precompiled installation for Windows.
OpenCalphad is a free thermodynamic software for calculation of multicomponent equilibria, property and phase diagrams and for database development. It has a simple command line interface and an Application Software Interface (OCASI) for integration in simulation software. For simulations it can calculate equilibria in parallel using OpenMP.
There is a community room for questions and discussions at https://gitter.im/opencalphad/opencalphad#
A third party Graphical User Interface (GUI) of OpenCalphad (named as
OpenCalphad CAE) for Windows can be downloaded from this
[link](https://www.dropbox.com/sh/48dqcsk861dmulg/AAC7tcrUVLxYOFVF7GIkJ4UVa?dl=0).
================================================
FILE: build_configure
================================================
#!/bin/bash
function header {
echo "============== Log Start ================="
date
echo "============ Tools & Path ================"
which aclocal
echo "...version : "`aclocal --version | head -1`
echo " "
which libtoolize
echo "...version : "`libtoolize --version | head -1`
echo " "
which automake
echo "...version : "`automake --version | head -1`
echo " "
which autoconf
echo "...version : "`autoconf --version | head -1`
echo " "
}
function tools {
echo "=========== Now Running Tools =========="
set -x
libtoolize --automake --force
aclocal -I m4
automake --add-missing --force-missing --foreign
autoconf
}
function sequence {
header
tools
}
########################################
cat configure.ac.1 > configure.ac
echo "AC_OUTPUT" >> configure.ac
##############
sequence 2>&1 | tee -a build_configure.log
================================================
FILE: configure.ac.1
================================================
AC_INIT([opencalphad], [master], [clement.introini@cea.fr], [opencalphad])
### minimum version of autoconf :
AC_PREREQ(2.50)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([config])
dnl Initialize automake. automake < 1.12 didn't have serial-tests and
dnl gives an error if it sees this, but for automake >= 1.13
dnl serial-tests is required so we have to include it. Solution is to
dnl test for the version of automake (by running an external command)
dnl and provide it if necessary. Note we have to do this entirely using
dnl m4 macros since automake queries this macro by running
dnl 'autoconf --trace ...'.
m4_define([serial_tests], [
m4_esyscmd([automake --version |
head -1 |
awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}'])])
# Automake specific stuff
AM_INIT_AUTOMAKE(
foreign
dist-bzip2
tar-ustar
serial_tests)
### initializes canonical host variables: host, host_cpu, host_vendor and host_os
AC_CANONICAL_HOST
AC_PROG_MAKE_SET
AC_PROG_INSTALL
# Checks for programs.
# store current user given compiler flags to avoid default setup via AC_PROG_FC
#OLD_FFLAGS=$FFLAGS
#OLD_FCFLAGS=$FCFLAGS
# store current user given compiler flags to avoid default setup via AC_PROG_CXX
OLD_CXXFLAGS=$CXXFLAGS
AC_PROG_CXXCPP
AC_PROG_CXX
AC_PROG_FC([gfortran])
AC_LANG(Fortran)
AC_PROG_LIBTOOL
# reset compiler flags to initial flags
CXXFLAGS=$OLD_CXXFLAGS
#FFLAGS=$OLD_FFLAGS
#FCFLAGS=$OLD_FCFLAGS
dnl enable silent rules
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
dnl--------------------------------------------------------------------
dnl enable-debug for compilling with debug options (no by default)
dnl--------------------------------------------------------------------
AC_ARG_ENABLE([debug],
[ --enable-debug Turn on debugging],
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac],[debug=false])
if test "x$debug" = "xtrue"
then
FCFLAGS=" -g -ggdb -fcheck=all -ffpe-trap=invalid,zero,overflow "
fi
dnl--------------------------------------------------------------------
dnl enable-openmp for compilling with openmp options (no by default)
dnl--------------------------------------------------------------------
AC_ARG_ENABLE([openmp],
[ --enable-openmp Turn on debugging],
[case "${enableval}" in
yes) openmp=true ;;
no) openmp=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-openmp]) ;;
esac],[openmp=false])
AM_CONDITIONAL([OPENMP], [test x$openmp = xtrue])
if test "x$openmp" = "xtrue"
then
AC_OPENMP
OPENMPLIB="$OPENMP_FCFLAGS"
AC_SUBST(OPENMPLIB)
if test "x$OPENMPLIB" != "x"
then
OPENMP_FFLAGS="$OPENMP_FCFLAGS"
fi
AC_SUBST(OPENMP_FFLAGS)
AC_SUBST(OPENMP_FCFLAGS)
fi
dnl--------------------------------------------------------------------
dnl with-python for compiling python wrapper
dnl--------------------------------------------------------------------
pyOC=no
AC_ARG_WITH(python,
AC_HELP_STRING([--with-python],[compile python wrapper]),
[],[withval="no"])
if test "x$withval" == "xyes" ; then
pyOC=yes
AM_PATH_PYTHON([3.6])
fi
AM_CONDITIONAL(WITH_PYTHON, test "x$pyOC" = "xyes")
dnl--------------------------------------------------------------------
dnl with-lapack for compiling with user lapack library
dnl--------------------------------------------------------------------
lapack=no
AC_ARG_WITH(lapack,
AC_HELP_STRING([--with-lapack],[compile with user lapack library)]),
[],[withval="no"])
if test "x$withval" == "xyes" ; then
lapack=yes
fi
AM_CONDITIONAL(WITH_LAPACK, test "x$lapack" = "xyes")
dnl--------------------------------------------------------------------
dnl with-ochelp for compiling with browser help on Linux, command line
dnl editing and open files
dnl--------------------------------------------------------------------
ocHelp=no
AC_ARG_WITH(ochelp,
AC_HELP_STRING([--with-ochelp],[compile with browser help on Linux]),
[],[withval="no"])
if test "x$withval" == "xyes" ; then
ocHelp=yes
fi
AM_CONDITIONAL(WITH_OCHELP, test "x$ocHelp" = "xyes")
dnl--------------------------------------------------------------------
dnl with-xplot for compiling with Gnuplot
dnl--------------------------------------------------------------------
xplot=no
AC_ARG_WITH(xplot,
AC_HELP_STRING([--with-xplot],[compile with Gnuplot]),
[],[withval="no"])
if test "x$withval" == "xyes" ; then
xplot=yes
fi
AM_CONDITIONAL(WITH_OCPLOT, test "x$xplot" = "xyes")
#####################################################################
# Generate configuration file envOC.sh to set environment for running
# tests directly from source and build directory
#####################################################################
echo '# This script is generated by configure' > envOC.sh
echo '# Use it to set environment for running from build dir' >> envOC.sh
BUILDDIR=`pwd`
echo "export BUILDDIR=$BUILDDIR" >> envOC.sh
SRCDIR=`dirname $0`
cd $SRCDIR && SRCDIR=`pwd` && cd $BUILDDIR
echo "export SRCDIR=$SRCDIR" >> envOC.sh
echo "export OPENCALPHAD_ROOT=$SRCDIR" >> envOC.sh
echo "export OCHOME=$SRCDIR/doc/manual/" >> envOC.sh
echo "" >> envOC.sh
echo 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$BUILDDIR/src/.libs:$BUILDDIR/src/utilities/.libs:$BUILDDIR/src/numlib/.libs:$BUILDDIR/src/models/.libs:$BUILDDIR/.libs:$BUILDDIR/src/minimizer/.libs' >> envOC.sh
echo 'PATH=$BUILDDIR:$PATH' >> envOC.sh
echo "export PATH" >> envOC.sh
echo "" >> envOC.sh
###################
AC_CONFIG_FILES([
Makefile])
================================================
FILE: doc/makedok4.F90
================================================
! program to extract dokumentation of a Fortran source file
! written by Bo Sundman 2016-2019
!
Program makedok
integer, parameter :: maxtab=500
character pfil*64,dfil*64,sfil*64,line*80,dline*80,curfil*64
character beginxverb*18,endxverb*16,ch1*1
character verbbuff(500)*80,lastverb*64,sameverb*64,texverb*64
character verbanew(500)*80
character nounderscore1*80,nounderscore2*40
character tablentries(maxtab)*80,tablefile(maxtab)*40
character sectext*80
integer, dimension(maxtab) :: tabord
integer, dimension(3,500) :: nsecverb
logical dokfil,once,lend,dend,EOF,merge,newverb,percentplus
integer foundverb,includedverb
beginxverb='!\begin{verbatim} '
endxverb='!\end{verbatim} '
write(*,*)'ASCII value of backslash: ',ichar('\')
write(*,10)
texverb=' '
ntablentries=0
includedverb=0
percentplus=.false.
!
! Below the idea is to extract the text between
! 1. the closest \section BEFORE current \verbatim and
! 2. the closest BEFORE THE NEXT \verbatim.
! maybe better change to the text
! 1. the closest \section AFTER THE PREVIOUS \verbatim to
! 2. to closest \section AFTER THE CURRENT \verbatim
! The important thing is to keep text belonging together together
! and not to miss any documentation text
!
! Added that a source file can have (one level) of include files
!
! The extraction stops if the first line after \verbatim in the documentation
! does not fit the first line found in the source code and ask for manual
! editing of this. It turned out to be very complicated to handle when new
! subroutines had been added or shifted place.
!
10 format(///' This is a program to generate and update documentation',&
' of software.'//&
' written by Bo Sundman 2016-2019 for OpenCalphad, version 2',//&
'It expects two files, one with the software code',/&
'and one with existing LaTeX documentation (which can be empty)',//&
'The idea is that "critical" parts of the code should be included ',&
'in the '/&
'documentation and that whenever such a section in the source ',&
'code has been '/&
'updated such changes will be detected by this program and replaced.'/&
'A critical part is typically global data declarations and ',&
'subroutines and '/&
'functions with their arguments.'//&
'Updating the documentation of a developing soft
gitextract_c_zt9wcv/
├── Makefile
├── Makefile.am
├── Makefile_Claude
├── Makefile_MacOS
├── OCisoCbinding/
│ ├── liboctq.F90
│ ├── liboctqisoc.F90
│ ├── octqc.h
│ └── pyOC/
│ ├── example.ipynb
│ ├── example.py
│ ├── pyOC.f90
│ ├── pyOC.py
│ └── pyOCUnitTest.py
├── README.md
├── build_configure
├── configure.ac.1
├── doc/
│ ├── makedok4.F90
│ └── manual/
│ ├── ochelp.html
│ └── ochelp.tex
├── examples/
│ ├── TQ4lib/
│ │ ├── Cpp/
│ │ │ ├── Makefile
│ │ │ ├── Matthias/
│ │ │ │ ├── FECRMNC.TDB
│ │ │ │ ├── FENI.TDB
│ │ │ │ ├── Makefile
│ │ │ │ ├── Makefile-parallel
│ │ │ │ ├── OC-isoC.h
│ │ │ │ ├── crfe/
│ │ │ │ │ ├── crfe.TDB
│ │ │ │ │ └── tqex1.cpp
│ │ │ │ ├── feni/
│ │ │ │ │ ├── FENI.TDB
│ │ │ │ │ └── tqex2.cpp
│ │ │ │ ├── liboctqcpp.cpp
│ │ │ │ ├── liboctqcpp.h
│ │ │ │ ├── liboctqisoc.F90
│ │ │ │ ├── linkmake
│ │ │ │ ├── steel1.TDB
│ │ │ │ ├── tqcpptest1.cpp
│ │ │ │ ├── tqex3.cpp
│ │ │ │ └── tqintf.h
│ │ │ ├── Scheil/
│ │ │ │ ├── Compile_OCASI_win32.bash
│ │ │ │ ├── Example_OCASI.cpp
│ │ │ │ ├── cost507r.TDB
│ │ │ │ ├── liboctqisoc.F90
│ │ │ │ ├── linkscheil
│ │ │ │ ├── ocasiintf.h
│ │ │ │ ├── octqc.h
│ │ │ │ ├── readme-scheil.tex
│ │ │ │ └── tqintf.h
│ │ │ ├── liboctq.F90
│ │ │ └── liboctqisoc.F90
│ │ ├── F90/
│ │ │ ├── crfe/
│ │ │ │ ├── TQ1-crfe.F90
│ │ │ │ ├── crfe.TDB
│ │ │ │ ├── link-tqtest1
│ │ │ │ └── readme-tq1.tex
│ │ │ ├── feni/
│ │ │ │ ├── FENI.TDB
│ │ │ │ ├── TQ2-feni.F90
│ │ │ │ ├── linkmake
│ │ │ │ └── readme.tex
│ │ │ ├── liboctq.F90
│ │ │ └── parallel-alnipt/
│ │ │ ├── AlNiPt-2005.TDB
│ │ │ ├── README.sim
│ │ │ ├── liboctq.F90
│ │ │ ├── linksim
│ │ │ ├── setup.input
│ │ │ └── sim-alnipt.F90
│ │ └── readme.tex
│ └── macros/
│ ├── AlC-OC.TDB
│ ├── AlC-diagrams.OCM
│ ├── AlFe-4SLBF.TDB
│ ├── BEF.TDB
│ ├── CHO-gas.TDB
│ ├── MgNaCl.TDB
│ ├── MgNaClX.TDB
│ ├── MoRe.TDB
│ ├── MoRe1.PDB
│ ├── OU.TDB
│ ├── SGTE-unary1991-2010.TDB
│ ├── agcu.TDB
│ ├── all-from-map19.OCM
│ ├── all-from-map4.OCM
│ ├── all-from-tzero.OCM
│ ├── all.OCM
│ ├── allcost.OCM
│ ├── alni-4slx.TDB
│ ├── cost507R.TDB
│ ├── cslaf-excess.TDB
│ ├── cslaf-map.OCM
│ ├── hogas.TDB
│ ├── iron4cd.TDB
│ ├── map1.OCM
│ ├── map10.OCM
│ ├── map11.OCM
│ ├── map12.OCM
│ ├── map13.OCM
│ ├── map14.OCM
│ ├── map15.OCM
│ ├── map16.OCM
│ ├── map17.OCM
│ ├── map18.OCM
│ ├── map19.OCM
│ ├── map2.OCM
│ ├── map3.OCM
│ ├── map4.OCM
│ ├── map5.OCM
│ ├── map6.OCM
│ ├── map7.OCM
│ ├── map8.OCM
│ ├── map9.OCM
│ ├── maplast.OCM
│ ├── melting.OCM
│ ├── mqtest-1C.OCM
│ ├── opttest1.OCM
│ ├── opttest2-map-diagram.OCM
│ ├── opttest2-plot-cpcumg2.OCM
│ ├── opttest2-plot-cplaves.OCM
│ ├── opttest2-plot-hliq.OCM
│ ├── opttest2.OCM
│ ├── opttest2A.OCM
│ ├── opttest2B.OCM
│ ├── opttest2C.OCM
│ ├── opttest2D.OCM
│ ├── opttest2E.OCM
│ ├── opttest2F.OCM
│ ├── opttest2G.OCM
│ ├── parallel1.OCM
│ ├── parallel2.OCM
│ ├── saf2507.TDB
│ ├── save.OCM
│ ├── sro-cef.OCM
│ ├── steel1.TDB
│ ├── steel7.TDB
│ ├── step-epz.OCM
│ ├── step-scheil.OCM
│ ├── step-tzero.OCM
│ ├── step1.OCM
│ ├── step2.OCM
│ ├── step3.OCM
│ ├── step4.OCM
│ ├── step5.OCM
│ ├── step6.OCM
│ ├── step7.OCM
│ ├── step8.OCM
│ ├── step9.OCM
│ ├── testcond1.OCM
│ ├── unary.OCM
│ └── uniquac.OCM
├── linkmake
├── linkoc
├── linkpara
├── oc6P
└── src/
├── linkocdate.F90
├── minimizer/
│ └── matsmin.F90
├── models/
│ ├── OC-isoC.h
│ ├── gtp3.F90
│ ├── gtp3A.F90
│ ├── gtp3B.F90
│ ├── gtp3C.F90
│ ├── gtp3D.F90
│ ├── gtp3E.F90
│ ├── gtp3EX.F90
│ ├── gtp3EY.F90
│ ├── gtp3F.F90
│ ├── gtp3G.F90
│ ├── gtp3H.F90
│ ├── gtp3X.F90
│ ├── gtp3XQ.F90
│ ├── gtp3Y.F90
│ ├── gtp3Z.F90
│ ├── gtp3_dd1.F90
│ ├── gtp3_dd2.F90
│ ├── gtp3_xml.F90
│ └── ocparam.F90
├── numlib/
│ ├── minpack1.F90
│ ├── oclablas.F90
│ └── ocnum.F90
├── pmain1.F90
├── stepmapplot/
│ ├── smp2.F90
│ ├── smp2A.F90
│ └── smp2B.F90
├── userif/
│ └── pmon6.F90
└── utilities/
├── GETKEY/
│ ├── M_getkey.F90
│ ├── Makefile
│ └── getkey.c
├── TINYFILEDIALOGS/
│ ├── Makefile
│ ├── compile_and_link
│ ├── ftinyopen.F90
│ ├── tinyfiledialogs.c
│ ├── tinyfiledialogs.h
│ └── tinyopen.c
└── metlib4.F90
SYMBOL INDEX (265 symbols across 18 files)
FILE: OCisoCbinding/octqc.h
type tpfun_parres (line 16) | typedef struct {
type gtp_components (line 22) | typedef struct {
type gtp_phasetuple (line 31) | typedef struct {
type gtp_state_variable (line 35) | typedef struct {
type gtp_fraction_set (line 42) | typedef struct {
type gtp_phase_varres (line 55) | typedef struct {
type gtp_condition (line 79) | typedef struct gtp_condition {
type gtp_equilibrium_data (line 90) | typedef struct {
FILE: OCisoCbinding/pyOC/pyOC.py
class PhaseStatus (line 8) | class PhaseStatus(IntEnum):
class GridMinimizerStatus (line 14) | class GridMinimizerStatus(IntEnum):
class PhasesAtEquilibrium (line 18) | class PhasesAtEquilibrium(object):
method __init__ (line 20) | def __init__(self, phaseMolarAmounts, phaseElementComposition, phaseSi...
method getPhaseMolarAmounts (line 26) | def getPhaseMolarAmounts(self):
method getPhaseElementComposition (line 29) | def getPhaseElementComposition(self):
method getPhaseSites (line 32) | def getPhaseSites(self):
method getPhaseConstituentComposition (line 35) | def getPhaseConstituentComposition(self):
method __str__ (line 38) | def __str__(self):
class OpenCalphad (line 41) | class OpenCalphad(object):
method __init__ (line 49) | def __init__(self):
method setVerbosity (line 61) | def setVerbosity(self, isVerbose):
method raw (line 71) | def raw(self):
method eq (line 74) | def eq(self):
method readtdb (line 77) | def readtdb(self,tdbFilePath, elements=None):
method getComponentNames (line 94) | def getComponentNames(self):
method getConstituentsDescription (line 97) | def getConstituentsDescription(self):
method setPhasesStatus (line 101) | def setPhasesStatus(self, phaseNames, phaseStatus, phaseAmount=0.0):
method setTemperature (line 106) | def setTemperature(self,temperature):
method setPressure (line 110) | def setPressure(self,pressure):
method setElementMolarAmounts (line 114) | def setElementMolarAmounts(self,elementMolarAmounts):
method changeEquilibriumRecord (line 120) | def changeEquilibriumRecord(self,eqName=None,copiedEqName=None):
method calculateEquilibrium (line 137) | def calculateEquilibrium(self,gridMinimizerStatus=GridMinimizerStatus....
method getErrorCode (line 145) | def getErrorCode(self):
method resetErrorCode (line 148) | def resetErrorCode(self):
method getScalarResult (line 151) | def getScalarResult(self,symbol):
method getGibbsEnergy (line 157) | def getGibbsEnergy(self):
method getComponentAssociatedResult (line 160) | def getComponentAssociatedResult(self, symbol):
method getChemicalPotentials (line 169) | def getChemicalPotentials(self):
method getPhasesAtEquilibrium (line 172) | def getPhasesAtEquilibrium(self):
FILE: OCisoCbinding/pyOC/pyOCUnitTest.py
class test_feouzr (line 10) | class test_feouzr(unittest.TestCase):
method setUp (line 11) | def setUp(self):
method test_LiquidWithMiscibilityGap (line 46) | def test_LiquidWithMiscibilityGap(self):
method test_LiquidWithoutMiscibilityGap (line 104) | def test_LiquidWithoutMiscibilityGap(self):
method test_SuspendingLiquid (line 166) | def test_SuspendingLiquid(self):
class test_steel7 (line 198) | class test_steel7(unittest.TestCase):
method setUp (line 199) | def setUp(self):
method test_melting (line 258) | def test_melting(self):
FILE: examples/TQ4lib/Cpp/Matthias/OC-isoC.h
type tpfun_parres (line 13) | typedef struct {
type gtp_components (line 19) | typedef struct {
type gtp_phasetuple (line 28) | typedef struct {
type gtp_state_variable (line 32) | typedef struct {
type gtp_fraction_set (line 39) | typedef struct {
type gtp_phase_varres (line 52) | typedef struct {
type gtp_condition (line 75) | typedef struct gtp_condition {
type gtp_equilibrium_data (line 86) | typedef struct {
FILE: examples/TQ4lib/Cpp/Matthias/crfe/tqex1.cpp
function main (line 4) | int main(int argc, char *argv[])
FILE: examples/TQ4lib/Cpp/Matthias/feni/tqex2.cpp
function main (line 5) | int main(int argc, char *argv[])
FILE: examples/TQ4lib/Cpp/Matthias/liboctqcpp.cpp
function string (line 106) | string liboctqcpp::tqgpn(int i, void * ceq)
function string (line 128) | string liboctqcpp::tqgpcn2(int phidx, int i, void * ceq)
function string (line 135) | string liboctqcpp::tqgpcn(int phidx, int i, void * ceq)
FILE: examples/TQ4lib/Cpp/Matthias/liboctqcpp.h
function class (line 48) | class liboctqcpp
FILE: examples/TQ4lib/Cpp/Matthias/tqcpptest1.cpp
function main (line 10) | int main(int argc, char **argv)
function example_1 (line 93) | void example_1(string fname, double t, double p, double n, vector<double...
function example_2 (line 123) | void example_2(string fname, int phidx, double t, double p, double n,
function example_3 (line 165) | void example_3(string fname, int phidx, double t, double p, double n,
FILE: examples/TQ4lib/Cpp/Matthias/tqex3.cpp
function main (line 10) | int main(int argc, char *argv[])
FILE: examples/TQ4lib/Cpp/Matthias/tqintf.h
function Initialize (line 47) | void Initialize(void *ceq)
function ReadDatabase (line 59) | void ReadDatabase(string fname, void *ceq)
function ReadDatabaseLimited (line 80) | void ReadDatabaseLimited(string fname, vector<string> elnames, void *ceq)
function ReadPhases (line 110) | void ReadPhases(vector<string> &phnames, void *ceq)
function SetTemperature (line 138) | void SetTemperature(double T, void *ceq)
function SetPressure (line 154) | void SetPressure(double P, void *ceq)
function SetMoles (line 170) | void SetMoles(double N, void *ceq)
function SetComposition (line 185) | void SetComposition(vector<double> X, void *ceq)
function SetConstituents (line 221) | void SetConstituents(int phidx, vector<double> y, void *ceq)
function SelectSinglePhase (line 248) | void SelectSinglePhase(int PhIdx, void *ceq)
function CalculateEquilibrium (line 253) | void CalculateEquilibrium(void *ceq)
function GetGibbsData (line 268) | void GetGibbsData(int phidx, void *ceq)
function ListPhaseFractions (line 340) | void ListPhaseFractions(vector<string> phnames, vector<double>& phfract,
function ListConstituentFractions (line 369) | void ListConstituentFractions(vector<string> phnames, vector<double> phf...
function ListExtConstituentFractions (line 409) | void ListExtConstituentFractions(int phidx, vector<string> phnames, void...
FILE: examples/TQ4lib/Cpp/Scheil/Example_OCASI.cpp
function main (line 24) | int main(int argc, char **argv)
FILE: examples/TQ4lib/Cpp/Scheil/ocasiintf.h
type basic_teebuf (line 81) | struct basic_teebuf
type std (line 83) | typedef std::basic_streambuf< CHAR_TYPE, TRAITS_TYPE > streambuf_type ;
type typename (line 84) | typedef typename TRAITS_TYPE::int_type int_type ;
function virtual (line 105) | virtual int sync()
type basic_teestream (line 115) | struct basic_teestream
type std (line 117) | typedef std::basic_ostream< CHAR_TYPE, TRAITS_TYPE > stream_type ;
type basic_teebuf (line 118) | typedef basic_teebuf< CHAR_TYPE, TRAITS_TYPE > streambuff_type ;
type basic_teebuf (line 127) | typedef basic_teebuf<char> teebuf ;
type basic_teestream (line 128) | typedef basic_teestream<char> teestream ;
function Get_Ceq (line 132) | void Get_Ceq(const int &iceq,void *ceq){
function Initialize (line 136) | void Initialize(void *ceq)
function Create_New_Ceq_and_Return_ID (line 149) | int Create_New_Ceq_and_Return_ID(const string &Ceq_Name){
function Get_Ceq_pointer (line 157) | void Get_Ceq_pointer(const int &ieq, void *ceq){
function GetAllElementsFromDatabase (line 163) | void GetAllElementsFromDatabase(string tdbfilename){
function ReadDatabase (line 171) | void ReadDatabase(string tdbfilename, void *ceq)
function ReadDatabaseLimited (line 193) | void ReadDatabaseLimited(string &tdbfilename, vector<string> &elnames, v...
function ReadPhases (line 225) | void ReadPhases(vector<string> &phnames, void *ceq)
function ResetTemperature (line 260) | void ResetTemperature(void *ceq){
function ResetAllConditionsButPandN (line 268) | void ResetAllConditionsButPandN(void *ceq, const vector<string> &el_redu...
function Change_Phase_Status (line 291) | void Change_Phase_Status(const string &name,int nystat,double val,void *...
function SetTemperature (line 299) | void SetTemperature(const double &T, void *ceq)
function SetPressure (line 317) | void SetPressure(const double &P, void *ceq)
function SetMoles (line 333) | void SetMoles(const double &N, void *ceq)
function SetComposition (line 348) | void SetComposition(vector<double>& X, void *ceq, const int &i_ref,strin...
function SetConstituents (line 390) | void SetConstituents(int phidx, vector<double> y, void *ceq)
function ReadPhaseFractions (line 417) | void ReadPhaseFractions(const vector<string> &phnames, vector<double>& p...
function GetGibbsData (line 454) | void GetGibbsData(int phidx, void *ceq)
function SelectSinglePhase (line 526) | void SelectSinglePhase(int PhIdx, void *ceq)
function List_Conditions (line 530) | void List_Conditions(void *ceq){
function CalculateEquilibrium (line 533) | void CalculateEquilibrium(void *ceq, const int &n1, int &i_error, const ...
function Safer_CalculateEquilibrium (line 560) | void Safer_CalculateEquilibrium (void *ceq, const int &n1, int &i_error,...
function ReadMU (line 595) | void ReadMU(void *ceq, vector < double > &MU)
function ReadTemperature (line 614) | double ReadTemperature(void *ceq)
function ReadTotalEnthalpy (line 631) | double ReadTotalEnthalpy(void *ceq)
function ReadConstituentFractions (line 648) | void ReadConstituentFractions(const vector<string> &phnames, const vecto...
function ListExtConstituentFractions (line 697) | void ListExtConstituentFractions(int phidx, vector<string> phnames, void...
function Write_Results_Equilibrium (line 748) | void Write_Results_Equilibrium(ofstream& file, const vector<string> &el_...
function Find_Transitions (line 835) | void Find_Transitions(const string &strLIQUID,const string &strSOLSOL,co...
function Global_Find_Transitions (line 984) | void Global_Find_Transitions(const string &strLIQUID,const string &strSO...
function scheil_solidif (line 1127) | void scheil_solidif(const string strGradientFileOut,const string &strLIQ...
function All_Capital_Letters (line 1424) | void All_Capital_Letters(string &mystring){
function find_TK_for_a_given_Liquid_fraction (line 1428) | void find_TK_for_a_given_Liquid_fraction(double &TK, int &i_error, const...
FILE: examples/TQ4lib/Cpp/Scheil/octqc.h
type tpfun_parres (line 13) | typedef struct {
type gtp_components (line 19) | typedef struct {
type gtp_phasetuple (line 28) | typedef struct {
type gtp_state_variable (line 32) | typedef struct {
type gtp_fraction_set (line 39) | typedef struct {
type gtp_phase_varres (line 52) | typedef struct {
type gtp_condition (line 76) | typedef struct gtp_condition {
type gtp_equilibrium_data (line 87) | typedef struct {
FILE: examples/TQ4lib/Cpp/Scheil/tqintf.h
function Get_Ceq (line 79) | void Get_Ceq(const int &iceq,void *ceq){
function Initialize (line 83) | void Initialize(void *ceq)
function Create_New_Ceq_and_Return_ID (line 96) | int Create_New_Ceq_and_Return_ID(const string &Ceq_Name){
function Get_Ceq_pointer (line 104) | void Get_Ceq_pointer(const int &ieq, void *ceq){
function GetAllElementsFromDatabase (line 110) | void GetAllElementsFromDatabase(string tdbfilename){
function ReadDatabase (line 118) | void ReadDatabase(string tdbfilename, void *ceq)
function ReadDatabaseLimited (line 140) | void ReadDatabaseLimited(string &tdbfilename, vector<string> &elnames, v...
function ReadPhases (line 172) | void ReadPhases(vector<string> &phnames, void *ceq)
function ResetTemperature (line 207) | void ResetTemperature(void *ceq){
function ResetAllConditionsButPandN (line 215) | void ResetAllConditionsButPandN(void *ceq, const vector<string> &el_redu...
function Change_Phase_Status (line 238) | void Change_Phase_Status(const string &name,int nystat,double val,void *...
function SetTemperature (line 246) | void SetTemperature(const double &T, void *ceq)
function SetPressure (line 264) | void SetPressure(const double &P, void *ceq)
function SetMoles (line 280) | void SetMoles(const double &N, void *ceq)
function SetComposition (line 295) | void SetComposition(vector<double>& X, void *ceq, const int &i_ref,strin...
function SetConstituents (line 337) | void SetConstituents(int phidx, vector<double> y, void *ceq)
function SelectSinglePhase (line 364) | void SelectSinglePhase(int PhIdx, void *ceq)
function List_Conditions (line 368) | void List_Conditions(void *ceq){
function CalculateEquilibrium (line 371) | void CalculateEquilibrium(void *ceq, const int &n1, int &i_error, const ...
function GetGibbsData (line 399) | void GetGibbsData(int phidx, void *ceq)
function ReadPhaseFractions (line 471) | void ReadPhaseFractions(const vector<string> &phnames, vector<double>& p...
function ReadMU (line 505) | void ReadMU(void *ceq, vector < double > &MU)
function ReadTemperature (line 524) | double ReadTemperature(void *ceq)
function ReadTotalEnthalpy (line 541) | double ReadTotalEnthalpy(void *ceq)
function ReadConstituentFractions (line 558) | void ReadConstituentFractions(const vector<string> &phnames, const vecto...
function ListExtConstituentFractions (line 612) | void ListExtConstituentFractions(int phidx, vector<string> phnames, void...
function Write_Results_Equilibrium (line 663) | void Write_Results_Equilibrium(ofstream& file, const vector<string> &el_...
function Find_Transitions (line 737) | void Find_Transitions( const double &TK_start,const int &nstep,const dou...
function Global_Find_Transitions (line 885) | void Global_Find_Transitions(ofstream& file,double &TK_start,const int &...
function Random_Equilibrium_Loop (line 1022) | void Random_Equilibrium_Loop(double &TK_min,double &TK_max, vector<doubl...
function scheil_solidif (line 1233) | void scheil_solidif(const string &strLIQUID, const string &strSOLIDSOLUT...
function All_Capital_Letters (line 1435) | void All_Capital_Letters(string &mystring){
function find_TK_for_a_given_Liquid_fraction (line 1439) | void find_TK_for_a_given_Liquid_fraction(double &TK, int &i_error, const...
FILE: src/models/OC-isoC.h
type tpfun_parres (line 15) | typedef struct {
type gtp_components (line 21) | typedef struct {
type gtp_phasetuple (line 30) | typedef struct {
type gtp_state_variable (line 34) | typedef struct {
type gtp_fraction_set (line 41) | typedef struct {
type gtp_phase_varres (line 54) | typedef struct {
type gtp_condition (line 78) | typedef struct gtp_condition {
type gtp_equilibrium_data (line 89) | typedef struct {
FILE: src/utilities/GETKEY/getkey.c
function getkeyC (line 38) | char getkeyC(void) {
function getkey4f_ (line 80) | int getkey4f_(void) { return(getkeyC()); }
function _getkey4f (line 81) | int _getkey4f(void) { return(getkeyC()); }
function getkey4f (line 82) | int getkey4f(void) { return(getkeyC()); }
function GETKEY4F (line 83) | int GETKEY4F(void) { return(getkeyC()); }
FILE: src/utilities/TINYFILEDIALOGS/tinyfiledialogs.c
function ensureFinalSlash (line 299) | static void ensureFinalSlash( char * aioString )
function Hex2RGB (line 312) | static void Hex2RGB( char const aHexRGB [8] ,
function RGB2Hex (line 337) | static void RGB2Hex( unsigned char const aRGB [3] ,
function replaceSubStr (line 361) | static void replaceSubStr( char const * aSource ,
function filenameValid (line 397) | static int filenameValid( char const * aFileNameWithoutPath )
function fileExists (line 410) | static int fileExists( char const * aFilePathAndName )
function fileExists (line 428) | static int fileExists( char const * aFilePathAndName )
function wipefile (line 451) | static void wipefile(char const * aFilename)
function tinyfd_setWinUtf8 (line 474) | void tinyfd_setWinUtf8(int aIsUtf8) /* made to be used from C# to modify...
function replaceChr (line 480) | static int replaceChr( char * aString ,
function sizeUtf16From8 (line 513) | static int sizeUtf16From8(char const * aUtf8string)
function sizeUtf16FromMbcs (line 520) | static int sizeUtf16FromMbcs(char const * aMbcsString)
function sizeUtf8 (line 527) | static int sizeUtf8(wchar_t const * aUtf16string)
function sizeMbcs (line 534) | static int sizeMbcs(wchar_t const * aMbcsString)
function wchar_t (line 543) | wchar_t * tinyfd_utf8to16(char const * aUtf8string)
function wchar_t (line 590) | static wchar_t * mbcsTo16(char const * aMbcsString)
function dirExists (line 640) | static int dirExists(char const * aDirPath)
function tinyfd_beep (line 657) | void tinyfd_beep(void)
function tinyfd_beep (line 664) | void tinyfd_beep(void)
function wipefileW (line 670) | static void wipefileW(wchar_t const * aFilename)
function wchar_t (line 690) | static wchar_t * getPathWithoutFinalSlashW(
function wchar_t (line 720) | static wchar_t * getLastNameW(
function Hex2RGBW (line 750) | static void Hex2RGBW(wchar_t const aHexRGB[8],
function RGB2HexW (line 776) | static void RGB2HexW(
function dirExists (line 807) | static int dirExists(char const * aDirPath)
function fileExists (line 842) | static int fileExists(char const * aFilePathAndName)
function replaceWchar (line 877) | static int replaceWchar(wchar_t * aString,
function EnumThreadWndProc (line 959) | static int __stdcall EnumThreadWndProc(HWND hwnd, LPARAM lParam)
function hiddenConsoleW (line 973) | static void hiddenConsoleW(wchar_t const * aString, wchar_t const * aDia...
function tinyfd_messageBoxW (line 1004) | int tinyfd_messageBoxW(
function messageBoxWinGui8 (line 1072) | static int messageBoxWinGui8(
function tinyfd_notifyPopupW (line 1117) | int tinyfd_notifyPopupW(
function notifyWinGui (line 1185) | static int notifyWinGui(
function inputBoxWinGui (line 1515) | static int inputBoxWinGui(
function wchar_t (line 1590) | wchar_t * tinyfd_saveFileDialogW(
function wchar_t (line 1753) | wchar_t * tinyfd_openFileDialogW(
function BOOL (line 1974) | BOOL CALLBACK BrowseCallbackProc_enum(HWND hWndChild, LPARAM lParam)
function BOOL (line 1988) | BOOL CALLBACK BrowseCallbackProcW_enum(HWND hWndChild, LPARAM lParam)
function BrowseCallbackProc (line 2000) | static int __stdcall BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp,...
function BrowseCallbackProcW (line 2013) | static int __stdcall BrowseCallbackProcW(HWND hwnd, UINT uMsg, LPARAM lp...
function wchar_t (line 2025) | wchar_t * tinyfd_selectFolderDialogW(
function wchar_t (line 2108) | wchar_t * tinyfd_colorChooserW(
function messageBoxWinGuiA (line 2212) | static int messageBoxWinGuiA(
function dialogPresent (line 2636) | static int dialogPresent(void)
function messageBoxWinConsole (line 2670) | static int messageBoxWinConsole(
function inputBoxWinConsole (line 2785) | static int inputBoxWinConsole(
function writeUtf8 (line 3064) | static void writeUtf8( char const * aUtf8String )
function tinyfd_messageBox (line 3076) | int tinyfd_messageBox(
function tinyfd_notifyPopup (line 3208) | int tinyfd_notifyPopup(
function isDarwin (line 3643) | static int isDarwin(void)
function dirExists (line 3655) | static int dirExists( char const * aDirPath )
function detectPresence (line 3670) | static int detectPresence( char const * aExecutable )
function tryCommand (line 3734) | static int tryCommand( char const * aCommand )
function isTerminalRunning (line 3754) | static int isTerminalRunning(void)
function isDialogVersionBetter09b (line 3790) | int isDialogVersionBetter09b(void)
function whiptailPresentOnly (line 3827) | static int whiptailPresentOnly(void)
function whiptailPresent (line 3981) | static int whiptailPresent(void)
function graphicMode (line 3997) | static int graphicMode(void)
function pactlPresent (line 4005) | static int pactlPresent(void)
function speakertestPresent (line 4016) | static int speakertestPresent(void)
function beepexePresent (line 4027) | static int beepexePresent(void)
function xmessagePresent (line 4038) | static int xmessagePresent(void)
function gxmessagePresent (line 4049) | static int gxmessagePresent(void)
function gmessagePresent (line 4060) | static int gmessagePresent(void)
function notifysendPresent (line 4071) | static int notifysendPresent(void)
function perlPresent (line 4082) | static int perlPresent(void)
function afplayPresent (line 4106) | static int afplayPresent(void)
function xdialogPresent (line 4130) | static int xdialogPresent(void)
function gdialogPresent (line 4141) | static int gdialogPresent(void)
function osascriptPresent (line 4152) | static int osascriptPresent(void)
function qarmaPresent (line 4164) | static int qarmaPresent(void)
function matedialogPresent (line 4175) | static int matedialogPresent(void)
function shellementaryPresent (line 4186) | static int shellementaryPresent(void)
function zenityPresent (line 4197) | static int zenityPresent(void)
function zenity3Present (line 4208) | static int zenity3Present(void)
function kdialogPresent (line 4249) | static int kdialogPresent(void)
function osx9orBetter (line 4302) | static int osx9orBetter(void)
function python3Present (line 4329) | static int python3Present(void)
function python2Present (line 4358) | static int python2Present(void)
function tkinter3Present (line 4387) | static int tkinter3Present(void)
function tkinter2Present (line 4408) | static int tkinter2Present(void)
function pythonDbusPresent (line 4429) | static int pythonDbusPresent(void)
function sigHandler (line 4462) | static void sigHandler(int sig)
function tinyfd_beep (line 4471) | void tinyfd_beep(void)
function tinyfd_messageBox (line 4521) | int tinyfd_messageBox(
function tinyfd_notifyPopup (line 5447) | int tinyfd_notifyPopup(
type termios (line 5663) | struct termios
type termios (line 5664) | struct termios
Condensed preview — 187 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (9,037K chars).
[
{
"path": "Makefile",
"chars": 6081,
"preview": "#\n# Modified 2020.04.25 for the new direcory structure. Bo Sundman\n#\nOBJS=getkey.o M_getkey.o ftinyopen.o tinyopen.o ti"
},
{
"path": "Makefile.am",
"chars": 4938,
"preview": "AUTOMAKE_OPTIONS = subdir-objects\n\n.NOTPARALLEL:\n\nSUBDIRS=\nDIST_SUBDIRS=\nAM_FCFLAGS=-Dnotwin @OPENMP_FCFLAGS@\nbin_PROGRA"
},
{
"path": "Makefile_Claude",
"chars": 5908,
"preview": "#\n# Makefile for Open Calphad (OC) - Claude version\n#\n# Targets: all, debug, clean\n#\n# *********************************"
},
{
"path": "Makefile_MacOS",
"chars": 4750,
"preview": "#\n# Modified but not tested for the new directory structure\n#\nOBJS=getkey.o M_getkey.o ftinyopen.o tinyopen.o tinyfiledi"
},
{
"path": "OCisoCbinding/liboctq.F90",
"chars": 51360,
"preview": "!\n!\n! Update proposed by Romain Le Tellier and Clément Introïni\n!\n!\n! Minimal TQ interface.\n!\n! To compile and link this"
},
{
"path": "OCisoCbinding/liboctqisoc.F90",
"chars": 56193,
"preview": "! \n!\n! Part of iso-C binding for OC TQlib from Teslos\n! modified by Matthias Stratmann, Christophe Sigli,\n! and Bo Sundm"
},
{
"path": "OCisoCbinding/octqc.h",
"chars": 2505,
"preview": "/*\n* Update proposed by Romain Le Tellier and Clément Introïni\n*/\n#if !defined __OCASI__\n#define __OCASI__\n\n/* Modifica"
},
{
"path": "OCisoCbinding/pyOC/example.ipynb",
"chars": 16413,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n "
},
{
"path": "OCisoCbinding/pyOC/example.py",
"chars": 3463,
"preview": "#!/usr/bin/env python\n# coding: utf-8\n\n# In[1]:\n\n\nimport os\n\n\n# ### Imports for pyOC\n\n# In[2]:\n\n\nimport pyOC\nfrom pyOC i"
},
{
"path": "OCisoCbinding/pyOC/pyOC.f90",
"chars": 6839,
"preview": "! This module is simply a 'sanitized' and f90wrapp-compatible version of the different subroutines available in the OCAS"
},
{
"path": "OCisoCbinding/pyOC/pyOC.py",
"chars": 8848,
"preview": "import logging, sys\nimport json\nimport numpy as np\nimport rawpyOC\nfrom rawpyOC import rawopencalphad as oc\nfrom enum imp"
},
{
"path": "OCisoCbinding/pyOC/pyOCUnitTest.py",
"chars": 21004,
"preview": "import unittest\nimport numpy as np\nimport os\nimport pyOC\nfrom pyOC import opencalphad as oc\nfrom pyOC import PhaseStatus"
},
{
"path": "README.md",
"chars": 883,
"preview": "\nThis is the development version of OpenCalphad, normally updated a few times each month.\n\nThe stable version can be dow"
},
{
"path": "build_configure",
"chars": 824,
"preview": "#!/bin/bash\n\nfunction header {\necho \"============== Log Start =================\"\ndate \necho \"============ Tools & Path ="
},
{
"path": "configure.ac.1",
"chars": 5563,
"preview": "AC_INIT([opencalphad], [master], [clement.introini@cea.fr], [opencalphad])\n### minimum version of autoconf :\nAC_PREREQ(2"
},
{
"path": "doc/makedok4.F90",
"chars": 22567,
"preview": "! program to extract dokumentation of a Fortran source file\n! written by Bo Sundman 2016-2019\n!\nProgram makedok\n intege"
},
{
"path": "doc/manual/ochelp.html",
"chars": 449455,
"preview": "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \n \"http://www.w3.org/TR/html4/loose.dtd\"> \n<html > \n<h"
},
{
"path": "doc/manual/ochelp.tex",
"chars": 205205,
"preview": "\\documentclass[11pt]{article}\n\\usepackage[utf8]{inputenc}\n% NEXT LINE is needed for generate a HTML file with targets (h"
},
{
"path": "examples/TQ4lib/Cpp/Makefile",
"chars": 104,
"preview": "all:\n# Example written in C++ using ISO-C-Binding\n\tmake -C ./Matthias\n\nclean:\n\tmake -C ./Matthias clean\n"
},
{
"path": "examples/TQ4lib/Cpp/Matthias/FECRMNC.TDB",
"chars": 33158,
"preview": "\n$ Database file written 14- 5-11\n$\n ELEMENT /- ELECTRON_GAS 0.0000E+00 0.0000E+00 0.0000E+00!\n ELEMENT"
},
{
"path": "examples/TQ4lib/Cpp/Matthias/FENI.TDB",
"chars": 5332,
"preview": "$ Database file written 2014- 1-15\n$ From database: SSOL2 \n ELEMENT /- ELECTRON_GAS 0.0"
},
{
"path": "examples/TQ4lib/Cpp/Matthias/Makefile",
"chars": 689,
"preview": "EXE=cpptest\nLIBS=../../..\nCFLAGS=-lstdc++\n#UNCOMMENT THE NEXT LINE IF YOU WANT TO COMPILE OPENCALPHAD IN PARALLEL\n#CFLAG"
},
{
"path": "examples/TQ4lib/Cpp/Matthias/Makefile-parallel",
"chars": 489,
"preview": "OBJS=liboctq.o liboctqisoc.o\nEXE=tqintf\nLIBS=../..\n\n.PHONY : all clean\n\nall:\n\tmake $(EXE)\n\nclean:\n\trm -f *.o *.mod $(EXE"
},
{
"path": "examples/TQ4lib/Cpp/Matthias/OC-isoC.h",
"chars": 2422,
"preview": "#if !defined __OCASI__\n#define __OCASI__\n\n/* Modification history\n160829 Bo Sundman Update\n2015-2016 Matthias Stratmann "
},
{
"path": "examples/TQ4lib/Cpp/Matthias/crfe/crfe.TDB",
"chars": 8514,
"preview": "\n$ Database file written 2012- 9- 7\n$ From database: SSOL2 \n ELEMENT /- ELECTRON_GAS 0."
},
{
"path": "examples/TQ4lib/Cpp/Matthias/crfe/tqex1.cpp",
"chars": 3555,
"preview": "#include \"../liboctqcpp.h\"\nusing namespace std;\n\nint main(int argc, char *argv[])\n{\n /* Bugtracker:\n 1) OCASI.tqge"
},
{
"path": "examples/TQ4lib/Cpp/Matthias/feni/FENI.TDB",
"chars": 5332,
"preview": "$ Database file written 2014- 1-15\n$ From database: SSOL2 \n ELEMENT /- ELECTRON_GAS 0.0"
},
{
"path": "examples/TQ4lib/Cpp/Matthias/feni/tqex2.cpp",
"chars": 4893,
"preview": "#include \"../liboctqcpp.h\"\n#include <cmath>\nusing namespace std;\n\nint main(int argc, char *argv[])\n{\n /* Bugtracker:\n"
},
{
"path": "examples/TQ4lib/Cpp/Matthias/liboctqcpp.cpp",
"chars": 11333,
"preview": "#include \"liboctqcpp.h\"\nusing namespace std;\n\n#define MAXEL 24;\n#define MAXPH 20\n\nvoid liboctqcpp::tqini(int n, void * c"
},
{
"path": "examples/TQ4lib/Cpp/Matthias/liboctqcpp.h",
"chars": 3794,
"preview": "#include <string>\n#include <cstdlib>\n#include <iostream>\n#include <cstring>\n#include <vector>\n#include <cstdio>\n\nextern\""
},
{
"path": "examples/TQ4lib/Cpp/Matthias/liboctqisoc.F90",
"chars": 20201,
"preview": "module cstr\n\n contains\n\n function c_to_f_string(s) result(str)\n use iso_c_binding\n implicit none\n "
},
{
"path": "examples/TQ4lib/Cpp/Matthias/linkmake",
"chars": 771,
"preview": "REM 160926 Bo Sundman update\nREM 151210 Mathias original\n\nREM You must have compiled the OC software without paralleliza"
},
{
"path": "examples/TQ4lib/Cpp/Matthias/steel1.TDB",
"chars": 56433,
"preview": "\n$ Database file written 2012- 2-11\n$ From database: SSOL2 \n ELEMENT /- ELECTRON_GAS 0."
},
{
"path": "examples/TQ4lib/Cpp/Matthias/tqcpptest1.cpp",
"chars": 12521,
"preview": "#include \"tqintf.h\"\n\nvoid example_1(string fname, double t, double p, double n, vector<double> x);\nvoid example_2(string"
},
{
"path": "examples/TQ4lib/Cpp/Matthias/tqex3.cpp",
"chars": 11795,
"preview": "#include \"liboctqcpp.h\"\nusing namespace std;\n\n/*************************************************************************"
},
{
"path": "examples/TQ4lib/Cpp/Matthias/tqintf.h",
"chars": 12312,
"preview": "#define MAXEL 10\n#define MAXPH 20\n//#include \"octqc.h\"\n#include \"OC-isoC.h\"\n#include <string>\n#include <cstdlib>\n#includ"
},
{
"path": "examples/TQ4lib/Cpp/Scheil/Compile_OCASI_win32.bash",
"chars": 483,
"preview": "#!/bin/bash\n#\n# You must adjust this command file to your local environment\n#\nCOMPILER=i686-w64-mingw32\nGFORTRAN=${COMPI"
},
{
"path": "examples/TQ4lib/Cpp/Scheil/Example_OCASI.cpp",
"chars": 48129,
"preview": "#define CTEC 0// should be 0 for non CTEC users\n\n# if CTEC<1\n#include \"ocasiintf.h\"\n#define OCVERSION \"Open CalPhad Soft"
},
{
"path": "examples/TQ4lib/Cpp/Scheil/cost507r.TDB",
"chars": 147097,
"preview": "\n$ From cast project 507\n DATABASE_INFO about the COST 507 database\n This thermodynamic database is the result of the Eu"
},
{
"path": "examples/TQ4lib/Cpp/Scheil/liboctqisoc.F90",
"chars": 31544,
"preview": "!\n! Part of iso-C bining for OC TQlib from Teslos\n! modified by Matthias Stratmann, Christophe Sigli and Bo Sundman\n!\nMO"
},
{
"path": "examples/TQ4lib/Cpp/Scheil/linkscheil",
"chars": 625,
"preview": "REM You must first install OC to generate the libraries\nREM liboceq.a, liboceqplus.mod\nREM You must compile the parallel"
},
{
"path": "examples/TQ4lib/Cpp/Scheil/ocasiintf.h",
"chars": 48653,
"preview": "//define PARALLEL 0 no loop with parallelization\n//define PARALLEL 1 declared loops with parallelization\n#define PARALLE"
},
{
"path": "examples/TQ4lib/Cpp/Scheil/octqc.h",
"chars": 2438,
"preview": "#if !defined __OCASI__\n#define __OCASI__\n\n/* Modification history\n160829 Bo Sundman Update\n2015-2016 Matthias Stratmann "
},
{
"path": "examples/TQ4lib/Cpp/Scheil/readme-scheil.tex",
"chars": 6018,
"preview": "\\documentclass[12pt]{article}\n\\textwidth 175mm\n\\textheight 210mm\n\\oddsidemargin 1mm\n\\evensidemargin 1mm\n\\topmargin 1mm"
},
{
"path": "examples/TQ4lib/Cpp/Scheil/tqintf.h",
"chars": 47050,
"preview": "//define PARALLEL 0 no loop with parallelization\n//define PARALLEL 1 declared loops with parallelization\n#define PARALLE"
},
{
"path": "examples/TQ4lib/Cpp/liboctq.F90",
"chars": 56902,
"preview": "!!\n! Minimal TQ interface.\n!\n! To compile and link this with an application one must first compile\n! and form a library "
},
{
"path": "examples/TQ4lib/Cpp/liboctqisoc.F90",
"chars": 33409,
"preview": "!\n! Part of iso-C bining for OC TQlib from Teslos\n! modified by Matthias Stratmann, Christophe Sigli and Bo Sundman\n!\nMO"
},
{
"path": "examples/TQ4lib/F90/crfe/TQ1-crfe.F90",
"chars": 7794,
"preview": "!\n! The first test program of programming interface LIBOCTQ using Cr-Fe binary\n!\n! Before compiling this you must first "
},
{
"path": "examples/TQ4lib/F90/crfe/crfe.TDB",
"chars": 8514,
"preview": "\n$ Database file written 2012- 9- 7\n$ From database: SSOL2 \n ELEMENT /- ELECTRON_GAS 0."
},
{
"path": "examples/TQ4lib/F90/crfe/link-tqtest1",
"chars": 582,
"preview": "REM command file to cretate test program 1 for OCASI/TQ\n\nREM Either execute the commands below interactivly or rename\nRE"
},
{
"path": "examples/TQ4lib/F90/crfe/readme-tq1.tex",
"chars": 10830,
"preview": "\\documentclass[12pt]{article}\n\\textwidth 165mm\n\\textheight 210mm\n\\oddsidemargin 1mm\n\\evensidemargin 1mm\n\\topmargin 1mm"
},
{
"path": "examples/TQ4lib/F90/feni/FENI.TDB",
"chars": 5332,
"preview": "$ Database file written 2014- 1-15\n$ From database: SSOL2 \n ELEMENT /- ELECTRON_GAS 0.0"
},
{
"path": "examples/TQ4lib/F90/feni/TQ2-feni.F90",
"chars": 8760,
"preview": "! second test program of OC-TQ\nprogram octq2\n!\n use liboctq\n!\n implicit none\n! maxel and maxph defined in pmod package"
},
{
"path": "examples/TQ4lib/F90/feni/linkmake",
"chars": 451,
"preview": "REM Copy libraries (compiled without OpenMP) from OC directory\ncopy ..\\..\\..\\..\\libs\\liboceq.a .\nREM copy ..\\..\\..\\..\\li"
},
{
"path": "examples/TQ4lib/F90/feni/readme.tex",
"chars": 6623,
"preview": "\\documentclass[12pt]{article}\n\\textwidth 165mm\n\\textheight 210mm\n\\oddsidemargin 1mm\n\\evensidemargin 1mm\n\\topmargin 1mm"
},
{
"path": "examples/TQ4lib/F90/liboctq.F90",
"chars": 56836,
"preview": "!\n! Minimal TQ interface.\n!\n! To compile and link this with an application one must first compile\n! and form a library w"
},
{
"path": "examples/TQ4lib/F90/parallel-alnipt/AlNiPt-2005.TDB",
"chars": 38432,
"preview": "$ AL-PT FROM /alnipt/alpt-new/MSL/alpt.PAR, \n$ this is the only differences from alnipt-1221.TDB \n$ L(L12, AL:A"
},
{
"path": "examples/TQ4lib/F90/parallel-alnipt/README.sim",
"chars": 983,
"preview": "\nThis contain the instructions to compile and run the AlNiPt example.\nThe OC-parallel2.pdf is a presentation of the exam"
},
{
"path": "examples/TQ4lib/F90/parallel-alnipt/liboctq.F90",
"chars": 58655,
"preview": "!\n! Minimal TQ interface.\n!\n! To compile and link this with an application one must first compile\n! and form a library w"
},
{
"path": "examples/TQ4lib/F90/parallel-alnipt/linksim",
"chars": 607,
"preview": "REM C:\\Users\\bosun\\Documents\\OC\\OC6\\examples\\TQ4lib\\F90\\parasim\\\n\nREM Compile the OC program\n\nREM copy ..\\..\\..\\..\\libs"
},
{
"path": "examples/TQ4lib/F90/parallel-alnipt/setup.input",
"chars": 960,
"preview": "# This is input file for the Al-Ni-Pt simulation\n# A line starting with a # character is a comment line\n#\n# database fil"
},
{
"path": "examples/TQ4lib/F90/parallel-alnipt/sim-alnipt.F90",
"chars": 19772,
"preview": "!\n! Small program to simulate diffusion in 1D using OC\n! Ternary system Al-Ni-Pt coating of superallys\n!\nprogram sim2\n!\n"
},
{
"path": "examples/TQ4lib/readme.tex",
"chars": 2808,
"preview": "\\documentclass[12pt]{article}\n\\textwidth 165mm\n\\textheight 210mm\n\\oddsidemargin 1mm\n\\evensidemargin 1mm\n\\topmargin 1mm"
},
{
"path": "examples/macros/AlC-OC.TDB",
"chars": 7120,
"preview": "$ Database file written 2020-09-10\n$ Tentative assessment of AlC using Einstein model\n \n ELEMENT /- ELECTRON_GAS "
},
{
"path": "examples/macros/AlC-diagrams.OCM",
"chars": 3995,
"preview": "@$=======================================================================\r\n@$ Example calculating Al-C phase diagram and"
},
{
"path": "examples/macros/AlFe-4SLBF.TDB",
"chars": 8435,
"preview": "\n$ Database file written 2008- 8-15\n$ From database: User data 2008. 8. 1 \n ELEMENT /- ELECTRON_GAS 0."
},
{
"path": "examples/macros/BEF.TDB",
"chars": 20672,
"preview": "\n$\n$ Mo-Ni-Re ND 2017 June 1st - to be used with OC\n$\n$ Mo-Re Mathieu 2013, sigma slightly modified\n$ Mo-Ni Frisk 19"
},
{
"path": "examples/macros/CHO-gas.TDB",
"chars": 55287,
"preview": "\n$ Database file written 2015- 8-29\n$ From database: SSUB3 \n DATABASE_INFO about the CHO-gas database\n"
},
{
"path": "examples/macros/MgNaCl.TDB",
"chars": 4113,
"preview": "$ MgCl2-NaCl.TDB\n$ File converted by dat2TDB_ND2021 on 2021-12-15 11:33\n$ from file MgCl2-NaCl.dat \n$\n$ System Cl-Mg-"
},
{
"path": "examples/macros/MgNaClX.TDB",
"chars": 4107,
"preview": "$ MgCl2-NaCl.TDB\n$ File converted by dat2TDB_ND2021 on 2021-12-15 11:33\n$ from file MgCl2-NaCl.dat \n$\n$ System Cl-Mg-"
},
{
"path": "examples/macros/MoRe.TDB",
"chars": 12455,
"preview": "$ Database file written by Open Calphad 2023-09-21\n\nELEMENT /- Electron_gas 0.0000E+00 0.0000E+00 0.0000"
},
{
"path": "examples/macros/MoRe1.PDB",
"chars": 12098,
"preview": "$ Database file written by Open Calphad 2016-10-17\n\nELEMENT /- Electron_gas 0.0000E+00 0.0000E+00 0.0000"
},
{
"path": "examples/macros/OU.TDB",
"chars": 13174,
"preview": "\n$ Database file written 2013- 3-10\n$ From database: USER \n ELEMENT /- ELECTRON_GAS 0."
},
{
"path": "examples/macros/SGTE-unary1991-2010.TDB",
"chars": 128956,
"preview": "\n$ Database file written 2021- 5- 4\n$ From database: PURE5 \n ELEMENT /- ELECTRON_GAS 0."
},
{
"path": "examples/macros/agcu.TDB",
"chars": 3188,
"preview": "$ Database file written 2014- 2-22\n$ From database: SSOL2 \n ELEMENT /- ELECTRON_GAS 0.0"
},
{
"path": "examples/macros/all-from-map19.OCM",
"chars": 2251,
"preview": "@$\n@$ running all test macros\n@$\n@$\n@$\n@$ Before running this use the command SET ADVANCED WORKSPACE\n@$ to the directory"
},
{
"path": "examples/macros/all-from-map4.OCM",
"chars": 5058,
"preview": "@$\n@$ running all test macros\n@$\n@$\n@$\n@$ Before running this use the command SET ADVANCED WORKSPACE\n@$ to the directory"
},
{
"path": "examples/macros/all-from-tzero.OCM",
"chars": 6122,
"preview": "@$\n@$ running all test macros\n@$\n@$\n@$\n@$ Before running this use the command SET ADVANCED WORKSPACE\n@$ to the directory"
},
{
"path": "examples/macros/all.OCM",
"chars": 8923,
"preview": "@$\n@$ running all test macros\n@$\n@$\n@$\n@$ Before running this use the command SET ADVANCED WORKSPACE\n@$ to the directory"
},
{
"path": "examples/macros/allcost.OCM",
"chars": 3355,
"preview": "new Y\n\nset echo Y\n\n@$ ==============================================================\n@$\n@$\n@$\n@$\n@$\n@$ This macro calcul"
},
{
"path": "examples/macros/alni-4slx.TDB",
"chars": 14010,
"preview": "\n$ Database file written 2017- 8- 2\n$ From database: USER \n ELEMENT /- ELECTRON_GAS 0."
},
{
"path": "examples/macros/cost507R.TDB",
"chars": 147460,
"preview": "$ From COST project 507\n DATABASE_INFO about the COST 507 database\n This thermodynamic database is the result of the Eur"
},
{
"path": "examples/macros/cslaf-excess.TDB",
"chars": 2490,
"preview": "$ CSLAF FROM DAT WITH SPLIT REFERENCE ENERGEIS\n\nELEMENT CS SER 132.9 0 0 0 !\nELEMENT F GAS 18.9984 0 0 0 !\nELEMENT LA "
},
{
"path": "examples/macros/cslaf-map.OCM",
"chars": 889,
"preview": "new Y\r\n\r\nset echo Y\r\n\r\n@$=================================================================\r\n@$\r\n@$\r\n@$\r\n@$\r\n@$\r\n@$\r\n@$\r\n"
},
{
"path": "examples/macros/hogas.TDB",
"chars": 7536,
"preview": "\n$ Database file written 2012- 5-31\n$ From database: USER \n ELEMENT /- ELECTRON_GAS 0."
},
{
"path": "examples/macros/iron4cd.TDB",
"chars": 422114,
"preview": "$\n$ Database for cast iron (Fe-Cr-Cu-Mg-Mn-Mo-Nb-Ni-Si-Ti-V-C-N),\n$ Version 4c.\n$ Compiled by Bengt Hallstedt, July 2020"
},
{
"path": "examples/macros/map1.OCM",
"chars": 1092,
"preview": "new Y\n\nset echo Y\n\n@$ =========================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@"
},
{
"path": "examples/macros/map10.OCM",
"chars": 1539,
"preview": "new Y\n\nset echo Y\n\n\n@$ ====================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@"
},
{
"path": "examples/macros/map11.OCM",
"chars": 1517,
"preview": "new Y\n\nset echo Y\n\n\n@$=================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$"
},
{
"path": "examples/macros/map12.OCM",
"chars": 785,
"preview": "new Y\n\nset echo Y\n\n@$ =============================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n"
},
{
"path": "examples/macros/map13.OCM",
"chars": 1189,
"preview": "@$\nnew Y\n\nset echo Y\n\n@$\n@$ ===========================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$"
},
{
"path": "examples/macros/map14.OCM",
"chars": 1166,
"preview": "new Y\n\nset echo Y\n\n\n@$ ====================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@"
},
{
"path": "examples/macros/map15.OCM",
"chars": 2255,
"preview": "@$\nnew Y\n\n\nset echo Y\n\n\n@$===============================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n"
},
{
"path": "examples/macros/map16.OCM",
"chars": 1645,
"preview": "@$\nnew Y\n\nset echo Y\n\n@$===================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@"
},
{
"path": "examples/macros/map17.OCM",
"chars": 4030,
"preview": "new Y\n\nset echo Y\n\n\n@$ ==============================================================\n@$\n@$ calculate Al-Fe phase diagra"
},
{
"path": "examples/macros/map18.OCM",
"chars": 856,
"preview": "new Y\n\nset echo Y\n\n@$ =========================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@"
},
{
"path": "examples/macros/map19.OCM",
"chars": 3837,
"preview": "@$\r\n\r\nnew Y\r\n\r\nset echo Y\r\n\r\n@$========================================================================\r\n@$\r\n@$\r\n@$\r\n@$\r"
},
{
"path": "examples/macros/map2.OCM",
"chars": 849,
"preview": "new Y\n\n\nset echo Y\n\n@$ =============================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$"
},
{
"path": "examples/macros/map3.OCM",
"chars": 2068,
"preview": "new Y\n\nset echo Y\n\n@$ =================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$"
},
{
"path": "examples/macros/map4.OCM",
"chars": 2369,
"preview": "new Y\n\n\nset echo Y\n\n\n@$ ===============================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$"
},
{
"path": "examples/macros/map5.OCM",
"chars": 1893,
"preview": "new Y\n\nset echo Y\n\n@$ ===============================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@"
},
{
"path": "examples/macros/map6.OCM",
"chars": 1169,
"preview": "new Y\n\nset echo Y\n\n\n@$ ===========================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@"
},
{
"path": "examples/macros/map7.OCM",
"chars": 2036,
"preview": "new Y\n\n\nset echo Y\n\n\n@$ =============================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@"
},
{
"path": "examples/macros/map8.OCM",
"chars": 4554,
"preview": "new Y\n\nset echo Y\n\n\n@$ ====================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@"
},
{
"path": "examples/macros/map9.OCM",
"chars": 15762,
"preview": "new Y\n\nset echo Y\n\n@$ ===================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n"
},
{
"path": "examples/macros/maplast.OCM",
"chars": 2308,
"preview": "@$ running test macros from map15\n@$ Frequetly there is a crash after map15, I assume because no memory left\n\nset echo Y"
},
{
"path": "examples/macros/melting.OCM",
"chars": 4688,
"preview": "new YES\n\nset echo Y\n\n@$ =========================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$"
},
{
"path": "examples/macros/mqtest-1C.OCM",
"chars": 3450,
"preview": "@$ test entering an A-AB-B system with SRO\n\nnew Y\n\nset echo Y\n\n\n@$ ============== ELEMENTS\n\nenter element Fe Fe LIQUID "
},
{
"path": "examples/macros/opttest1.OCM",
"chars": 7935,
"preview": "new Y\n@$ ==================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$"
},
{
"path": "examples/macros/opttest2-map-diagram.OCM",
"chars": 357,
"preview": "@$\n@$ Cu-Mg phase diagram\n@$ Calculation and comparison to experiments\n@$\n\nsel eq 1\n\nset stat ph *=ent 0\n\nset cond *:=no"
},
{
"path": "examples/macros/opttest2-plot-cpcumg2.OCM",
"chars": 467,
"preview": "@$\n@$ CuMg2 heat capacity\n@$ Calculation and comparison to experiments"
},
{
"path": "examples/macros/opttest2-plot-cplaves.OCM",
"chars": 512,
"preview": "@$\n@$ Cu2Mg (C15 Laves) heat capacity\n@$ Calculation and comparison to experiments\n@$\n@$"
},
{
"path": "examples/macros/opttest2-plot-hliq.OCM",
"chars": 570,
"preview": "@$\n@$ Mixing enthalpy in the liquid phase\n@$ Calculation and comparison to experiments\n@$\n\n@$ step and"
},
{
"path": "examples/macros/opttest2.OCM",
"chars": 935,
"preview": "@$\nnew Y\n@$ ================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@"
},
{
"path": "examples/macros/opttest2A.OCM",
"chars": 53670,
"preview": "@$\n\nnew Y\n\n@$ ================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$"
},
{
"path": "examples/macros/opttest2B.OCM",
"chars": 5456,
"preview": "@$===================================================================\n@$================================================"
},
{
"path": "examples/macros/opttest2C.OCM",
"chars": 2886,
"preview": "@$================================================================\n@$==================================================="
},
{
"path": "examples/macros/opttest2D.OCM",
"chars": 2561,
"preview": "@$===================================================================\n@$================================================"
},
{
"path": "examples/macros/opttest2E.OCM",
"chars": 6052,
"preview": "@$===================================================================\n@$================================================"
},
{
"path": "examples/macros/opttest2F.OCM",
"chars": 4549,
"preview": "@$===================================================================\n@$================================================"
},
{
"path": "examples/macros/opttest2G.OCM",
"chars": 2686,
"preview": "@$===================================================================\n@$================================================"
},
{
"path": "examples/macros/parallel1.OCM",
"chars": 3680,
"preview": "new Y\n\nset echo Y\n\n@$ =================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$"
},
{
"path": "examples/macros/parallel2.OCM",
"chars": 14019,
"preview": "new Y\n\nset echo Y\n\n@$ ================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n"
},
{
"path": "examples/macros/saf2507.TDB",
"chars": 51275,
"preview": "\n$ Database file written 2014-10- 1\n$ From database: SSOL2 \n DATABASE_INFO about the SAF2507 database\n"
},
{
"path": "examples/macros/save.OCM",
"chars": 3292,
"preview": "new YES\n\n@$ ====================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n"
},
{
"path": "examples/macros/sro-cef.OCM",
"chars": 5934,
"preview": "new Y\n\nset echo Y\n\n@$ ====================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$"
},
{
"path": "examples/macros/steel1.TDB",
"chars": 56736,
"preview": "\n$ Database file written 2012- 2-11\n$ From database: SSOL2 \n DATABASE_INFO about the steel1 database\n "
},
{
"path": "examples/macros/steel7.TDB",
"chars": 56737,
"preview": "\n$ Database file written 2012- 2-11\n$ From database: SSOL2 \n DATABASE_INFO about the steel1 database\n "
},
{
"path": "examples/macros/step-epz.OCM",
"chars": 4262,
"preview": "@$\nnew Y\n\nset echo Y\n\n@$===============================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$"
},
{
"path": "examples/macros/step-scheil.OCM",
"chars": 2875,
"preview": "@$\n\nnew Y\n\nset echo Y\n\n@$===============================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@"
},
{
"path": "examples/macros/step-tzero.OCM",
"chars": 4157,
"preview": "new Y\n\n\nset echo Y\n\n@$===============================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@"
},
{
"path": "examples/macros/step1.OCM",
"chars": 5197,
"preview": "\nnew Y\n\nset echo Y\n\n@$ ==========================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$"
},
{
"path": "examples/macros/step2.OCM",
"chars": 1408,
"preview": "new Y\n\n\nset echo Y\n\n@$ ===================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$"
},
{
"path": "examples/macros/step3.OCM",
"chars": 1591,
"preview": "new Y\n\nset echo Y\n\n@$ ===================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n"
},
{
"path": "examples/macros/step4.OCM",
"chars": 7938,
"preview": "new Y\n\nset echo Y\n\n@$ ================================================================\n@$ \n@$ \n@$ \n@$ \n@$ \n@$ \n@$ \n@$ \n@"
},
{
"path": "examples/macros/step5.OCM",
"chars": 4445,
"preview": "new Y\n\n\nset etco Y\n\n@$ ===================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$"
},
{
"path": "examples/macros/step6.OCM",
"chars": 972,
"preview": "new Y\n\n\nset echo y\n\n@$ ==================================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n"
},
{
"path": "examples/macros/step7.OCM",
"chars": 1452,
"preview": "new Y\n\n\nset echo Y\n\n@$ ===========================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@"
},
{
"path": "examples/macros/step8.OCM",
"chars": 8446,
"preview": "new Y\n\n\nset echo Y\n\n@$ =============================================================\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$"
},
{
"path": "examples/macros/step9.OCM",
"chars": 3873,
"preview": "@$ ordering in a reciprocal system B2 with z=8 nn\n@$ Adding SRO by a T**(-1) dependent reciprocal parameter\n\nnew Y\n\nset "
},
{
"path": "examples/macros/testcond1.OCM",
"chars": 11474,
"preview": "@$===============================================================\n\nnew Y\n\nset echo Y\n\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@"
},
{
"path": "examples/macros/unary.OCM",
"chars": 1899,
"preview": "@$==========================================================================\nnew Y\n\nset echo Y\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@$\n@"
},
{
"path": "examples/macros/uniquac.OCM",
"chars": 6127,
"preview": "\nnew Y\n\nset echo Y\n\n@$==================================================================\n@$\n@$\n@$\n@&\n@$\n@$\n@$\n@$\n@$\n@$\n@"
},
{
"path": "linkmake",
"chars": 2745,
"preview": "REM This file must be given the extension .cmd to be run on Windows\nREM It compiles OC with openMP amd the popup window "
},
{
"path": "linkpara",
"chars": 2982,
"preview": "REM This file must be given the extension .cmd to be run on Windows\nREM It compiles OC with openMP amd the popup window "
},
{
"path": "src/linkocdate.F90",
"chars": 641,
"preview": "program linkocdate\n! extract current date and inserts it in the source code of the main program\n character date*20,mdat"
},
{
"path": "src/minimizer/matsmin.F90",
"chars": 535558,
"preview": "! Hillert's Minimizer as implemented by Sundman (HMS)\n! Based on Mats Hillert paper in Physica 1981 and Bo Janssons thes"
},
{
"path": "src/models/OC-isoC.h",
"chars": 2440,
"preview": "#if !defined __OCASI__\n#define __OCASI__\n\n/* Modification history\n160829 Bo Sundman Update\n2015-2016 Matthias Stratmann "
},
{
"path": "src/models/gtp3.F90",
"chars": 2892,
"preview": "!\n!***************************************************************\n! General Thermodynamic Package (GTP)\n! for thermodyn"
},
{
"path": "src/models/gtp3A.F90",
"chars": 122570,
"preview": "!\n! gtp3A.F90 included in gtp3.F90\n!\n!****************************************************\n! general subroutines for cre"
},
{
"path": "src/models/gtp3B.F90",
"chars": 358505,
"preview": "!\n! gtp3B included in gtp3.F90\n!\n!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\\n!> 6. "
},
{
"path": "src/models/gtp3C.F90",
"chars": 186598,
"preview": "!\n! gtp3C included in gtp3.F90\n!\n!/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\\n!> 7. "
},
{
"path": "src/models/gtp3D.F90",
"chars": 95119,
"preview": "!\n! gtp3D included in gtp3.F90\n!\n!/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\\n!> 8. "
},
{
"path": "src/models/gtp3E.F90",
"chars": 287897,
"preview": "!\n! gtp3E included in gtp3.F90\n!\n!/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\\n!> 9A."
},
{
"path": "src/models/gtp3EX.F90",
"chars": 68297,
"preview": "!\r\n! gtp3EX included in gtp3.F90\r\n!\r\n!/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\\r\n!> "
},
{
"path": "src/models/gtp3EY.F90",
"chars": 137436,
"preview": "!----------------------------\r\n! Reading the XTDB file with AppendXTDB: Models, parameters, TPfun and Biblio\r\n! 1. All d"
},
{
"path": "src/models/gtp3F.F90",
"chars": 173219,
"preview": "!\r\n! GTP3F included in gtp3.F90\r\n!\r\n!/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\\r\n!> "
},
{
"path": "src/models/gtp3G.F90",
"chars": 89070,
"preview": "!\r\n! gtp3G included in gtp3.F90\r\n!\r\n!/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\\r\n!> "
},
{
"path": "src/models/gtp3H.F90",
"chars": 183015,
"preview": "! gtp3H included in gtp3.F90\n!\n!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\n!> 14. Ad"
},
{
"path": "src/models/gtp3X.F90",
"chars": 250721,
"preview": "!\n! gtp3X included in gtp3.F90, separate gtp3XQ for MQMQA\n!\n!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\"
},
{
"path": "src/models/gtp3XQ.F90",
"chars": 236911,
"preview": "!\r\n! gtp3XQ for for MQMQA\r\n!\r\n!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\r\n!> 15B. S"
},
{
"path": "src/models/gtp3Y.F90",
"chars": 290330,
"preview": "!\n! gtp3Y included in gtp3.F90\n!\n!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\\n!> 16"
},
{
"path": "src/models/gtp3Z.F90",
"chars": 142717,
"preview": "!\n! gtp3Z included in gtp3.F90\n!\n!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\!/!\\\n!> 18. Sect"
},
{
"path": "src/models/gtp3_dd1.F90",
"chars": 4638,
"preview": "!\n! Data structures for the TPFUN package\n!\n!=================================================================\n! VARIABL"
},
{
"path": "src/models/gtp3_dd2.F90",
"chars": 133120,
"preview": "!**************************************************************\n! General Thermodynamic Package (GTP)\n! for thermodynami"
},
{
"path": "src/models/gtp3_xml.F90",
"chars": 22971,
"preview": "!***************************************************************\n! General Thermodynamic Package (GTP)\n! for thermodynam"
},
{
"path": "src/models/ocparam.F90",
"chars": 8743,
"preview": "\nMODULE OCPARAM\n\t\nIMPLICIT NONE\n!\\begin{verbatim}\n!---------------------------------------------------------------------"
},
{
"path": "src/numlib/minpack1.F90",
"chars": 97701,
"preview": "! This extract from MINPACK contains:\n! LMDIF1: least square routine\n! HYBRD1: solving systems of non-linear equations\n!"
},
{
"path": "src/numlib/oclablas.F90",
"chars": 661203,
"preview": "!\nMODULE OCLABLAS\n!\n! This is an extract of a fews routines from LAPACK and BLAS version 3.6.0\n! used to invert a symmet"
},
{
"path": "src/numlib/ocnum.F90",
"chars": 20447,
"preview": "!\n! MODULE LUKASNUM\nMODULE OCNUM\n!\n! This is free software using LAPACK and BLAS\n!\n! This program is free software; y"
},
{
"path": "src/pmain1.F90",
"chars": 1676,
"preview": "PROGRAM pmain1\n!************************************\n! main program for the free Open Calphad software\n!****************"
},
{
"path": "src/stepmapplot/smp2.F90",
"chars": 18437,
"preview": "! Data structures and routines for step/map/plot (using gnuplot)\n!\nMODULE ocsmp\n!\n! Copyright 2012-2021, Bo Sundman, Fra"
},
{
"path": "src/stepmapplot/smp2A.F90",
"chars": 403714,
"preview": "! These soubroutine calculate the diagram, smp2B plot it\n\n!\\addtotable subroutine map_setup\n!\\begin{verbatim}\n subrouti"
},
{
"path": "src/stepmapplot/smp2B.F90",
"chars": 186252,
"preview": "! included in smp2.F90. Generating graphics using GNUPLOT\n\n!\\addtotable subroutine ocplot2\n!\\begin{verbatim}\n subrouti"
},
{
"path": "src/userif/pmon6.F90",
"chars": 402748,
"preview": "!\nMODULE cmon1oc\n!\n! Copyright 2012-2025, Bo Sundman, France\n!\n! This program is free software; you can redistribute "
},
{
"path": "src/utilities/GETKEY/M_getkey.F90",
"chars": 1412,
"preview": "!=======================================================================--------\n!()()()()()()()()()()()()()()()()()()()"
},
{
"path": "src/utilities/GETKEY/Makefile",
"chars": 401,
"preview": "OBJS=getkey.o bintxt.o \nEXE=tin\n\nall: $(EXE)\n\ngetkey.o:\n# uncomment the appropriate line below\n# for MAC\n#\tgcc -c -DBSD "
},
{
"path": "src/utilities/GETKEY/getkey.c",
"chars": 2037,
"preview": "/*\n * @(#) Driver for reading a character from keyboard in raw I/O mode\n */\n#include <stdlib.h>\n#include <unistd.h>"
},
{
"path": "src/utilities/TINYFILEDIALOGS/Makefile",
"chars": 298,
"preview": "OBJS=tinyfiledialogs.o tinyopen.o ftinyopen.o\nEXE=gopen\n\nall: $(EXE)\n\ntinyfiledialogs.o:\n\tgcc -c tinyfiledialogs.c\n\ntiny"
},
{
"path": "src/utilities/TINYFILEDIALOGS/compile_and_link",
"chars": 120,
"preview": "gcc -c tinyfiledialogs.c\ngcc -c tinyopen.c\n\ngfortran -o fopen main.F90 tinyopen.o tinyfiledialogs.c -lcomdlg32 -lole32\n\n"
},
{
"path": "src/utilities/TINYFILEDIALOGS/ftinyopen.F90",
"chars": 1661,
"preview": "module ftinyopen\n use iso_c_binding\n implicit none\n\n! A C function that returns a string need a pointer to the array o"
},
{
"path": "src/utilities/TINYFILEDIALOGS/tinyfiledialogs.c",
"chars": 280137,
"preview": "/*_________\n / \\ tinyfiledialogs.c v3.6.4 [Sep 14, 2020] zlib licence\n |tiny file| Unique code file created [Nov"
},
{
"path": "src/utilities/TINYFILEDIALOGS/tinyfiledialogs.h",
"chars": 14759,
"preview": "/*_________\n / \\ tinyfiledialogs.h v3.6.4 [Sep 14, 2020] zlib licence\n |tiny file| Unique header file created [N"
},
{
"path": "src/utilities/TINYFILEDIALOGS/tinyopen.c",
"chars": 3869,
"preview": "/*_________\n / \\ tinyfiledialogs v3.5.0 [Apr 13, 2020] zlib licence\n |tiny file| \n | dialogs | Copyright (c) 201"
},
{
"path": "src/utilities/metlib4.F90",
"chars": 251188,
"preview": "!\n! general utilities in Fortran 95 a la METLIB upgraded 2015-2019 to\n! eliminate most specific F77 features\n! 1. All EN"
}
]
// ... and 2 more files (download for full content)
About this extraction
This page contains the full source code of the sundmanbo/opencalphad GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 187 files (8.3 MB), approximately 2.2M tokens, and a symbol index with 265 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.