Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Sep 21 23:35

    richardotis on chempot-dof

    WIP: tweaks to improve converge… (compare)

  • Sep 21 16:47
    igorjrd synchronize #239
  • Sep 20 23:48

    richardotis on chempot-dof

    WIP: Diffusion potential constr… WIP: callables: wired up diffus… WIP: Model: fix for diffusion p… and 6 more (compare)

  • Sep 20 19:04

    richardotis on website

    DOC: Deploy 'latest' docs to we… (compare)

  • Sep 20 18:56

    bocklund on develop

    ENH: Add element reference data… (compare)

  • Sep 20 18:56
    bocklund closed #240
  • Sep 20 14:02

    richardotis on chempot-dof

    FIX: callables: Hessian generat… WIP: Problem/solver: Try to fix… WIP diffusion potential constra… (compare)

  • Sep 18 15:27
    bocklund commented #239
  • Sep 18 15:22
    bocklund commented #240
  • Sep 18 15:18
    bocklund commented #240
  • Sep 18 15:14
    richardotis commented #240
  • Sep 18 14:48
    bocklund synchronize #240
  • Sep 18 14:48

    bocklund on ENH-TDB-reference-handling

    Fix for case when refstates are… (compare)

  • Sep 18 14:46
    bocklund review_requested #240
  • Sep 18 14:46
    bocklund opened #240
  • Sep 18 14:45

    bocklund on ENH-TDB-reference-handling

    ENH: Add reference data reading… (compare)

  • Sep 15 19:20
    igorjrd synchronize #239
  • Sep 15 14:06
    igorjrd commented #191
  • Sep 15 14:04
    igorjrd opened #239
  • Sep 14 19:21
    richardotis commented #191
Richard Otis
Yeah, that example is more for custom properties. The use case there is for people who want to define custom parameter types in a TDB to calculate some property
(but it is a great example of what custom models can do, I had forgotten about it)
Igor J Marques
Hi again! I was trying to run the example proposed at issue pycalphad/pycalphad#191 using the development version of pycalphad, but I getting the error:
ModuleNotFoundError: No module named 'pycalphad.core.phase_rec'
I noticed that the file phase_rec is a C++ file. Does someone knows how to fix it?
Brandon Bocklund
How did you install pycalphad?
Igor J Marques
Following the development version installation instructions available on the pycalphad page
Brandon Bocklund
What's the output of conda list?
Igor J Marques
# packages in environment at /home/igor/miniconda3/envs/pycalphad-dev:
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
ampl-mp                   3.1.0             hc99cbb1_1002    conda-forge
astroid                   2.2.5                    pypi_0    pypi
bokeh                     1.3.4                    py37_0    conda-forge
bzip2                     1.0.8                h516909a_0    conda-forge
ca-certificates           2019.6.16            hecc5488_0    conda-forge
certifi                   2019.6.16                py37_1    conda-forge
click                     7.0                        py_0    conda-forge
cloudpickle               1.2.1                      py_0    conda-forge
cycler                    0.10.0                     py_1    conda-forge
cyipopt                   0.1.9           py37h3010b51_1000    conda-forge
cython                    0.29.13          py37he1b5a44_0    conda-forge
cytoolz                   0.10.0           py37h516909a_0    conda-forge
dask                      2.3.0                      py_0    conda-forge
dask-core                 2.3.0                      py_0    conda-forge
dbus                      1.13.6               he372182_0    conda-forge
dill                      0.3.0                    py37_1    conda-forge
distributed               2.3.2                      py_1    conda-forge
expat                     2.2.5             he1b5a44_1003    conda-forge
fastcache                 1.1.0            py37h516909a_0    conda-forge
fontconfig                2.13.1            h86ecdb6_1001    conda-forge
freetype                  2.10.0               he983fc9_1    conda-forge
fsspec                    0.4.4                      py_0    conda-forge
future                    0.17.1                py37_1000    conda-forge
gettext                   hc5be6a0_1002    conda-forge
gf2x                      1.2               ha03fbb7_1003    conda-forge
glib                      2.58.3            h6f030ca_1002    conda-forge
gmp                       6.1.2             hf484d3e_1000    conda-forge
gmpy2                     2.1.0b1          py37h04dde30_0    conda-forge
gst-plugins-base          1.14.5               h0935bb2_0    conda-forge
gstreamer                 1.14.5               h36ae1b5_0    conda-forge
heapdict                  1.0.0                 py37_1000    conda-forge
icu                       64.2                 he1b5a44_1    conda-forge
ipopt                     3.12.12           hc6e8484_1004    conda-forge
isort                     4.3.21                   pypi_0    pypi
jinja2                    2.10.1                     py_0    conda-forge
jpeg                      9c                h14c3975_1001    conda-forge
kiwisolver                1.1.0            py37hc9558a2_0    conda-forge
lazy-object-proxy         1.4.2                    pypi_0    pypi
libblas                   3.8.0               12_openblas    conda-forge
libcblas                  3.8.0               12_openblas    conda-forge
libffi                    3.2.1             he1b5a44_1006    conda-forge
libflint                  2.5.2                heb735ee_2    conda-forge
libgcc-ng                 9.1.0                hdf63c60_0  
libgfortran-ng            7.3.0                hdf63c60_0  
libiconv                  1.15              h516909a_1005    conda-forge
liblapack                 3.8.0               12_openblas    conda-forge
libopenblas               0.3.7                h6e990d7_1    conda-forge
libpng                    1.6.37               hed695b0_0    conda-forge
libstdcxx-ng              9.1.0                hdf63c60_0  
libtiff                   4.0.10            h57b8799_1003    conda-forge
libuuid                   2.32.1            h14c3975_1000    conda-forge
libxcb                    1.13              h14c3975_1002    conda-forge
libxml2                   2.9.9                hee79883_5    conda-forge
locket                    0.2.0                      py_2    conda-forge
Richard Otis
Hi @igorjrd - when you go to the main pycalphad source directory and run python setup.py develop, what happens?
Igor J Marques
running develop
running egg_info
writing pycalphad.egg-info/PKG-INFO
writing dependency_links to pycalphad.egg-info/dependency_links.txt
writing requirements to pycalphad.egg-info/requires.txt
writing top-level names to pycalphad.egg-info/top_level.txt
reading manifest file 'pycalphad.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pycalphad.egg-info/SOURCES.txt'
running build_ext
building 'pycalphad.core.hyperplane' extension
gcc -pthread -B /home/igor/miniconda3/envs/pycalphad-dev/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I. -I/home/igor/miniconda3/envs/pycalphad-dev/lib/python3.7/site-packages/numpy/core/include -I/home/igor/miniconda3/envs/pycalphad-dev/lib/python3.7/site-packages/symengine/lib -I/home/igor/miniconda3/envs/pycalphad-dev/lib/python3.7/site-packages/numpy/core/include -I/home/igor/miniconda3/envs/pycalphad-dev/lib/python3.7/site-packages/symengine/lib -I/home/igor/miniconda3/envs/pycalphad-dev/include -I/home/igor/miniconda3/envs/pycalphad-dev/include/python3.7m -I/home/igor/miniconda3/envs/pycalphad-dev/include/python3.7m -c pycalphad/core/hyperplane.cpp -o build/temp.linux-x86_64-3.7/pycalphad/core/hyperplane.o -std=c++11 -D_hypot=hypot
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/igor/miniconda3/envs/pycalphad-dev/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,
                 from /home/igor/miniconda3/envs/pycalphad-dev/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                 from /home/igor/miniconda3/envs/pycalphad-dev/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from pycalphad/core/hyperplane.cpp:648:
/home/igor/miniconda3/envs/pycalphad-dev/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it with " \
pycalphad/core/hyperplane.cpp:2804:13: warning: ‘void __pyx_f_9pycalphad_4core_10hyperplane_prodsum(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice)’ defined but not used [-Wunused-function]
 static void __pyx_f_9pycalphad_4core_10hyperplane_prodsum(__Pyx_memviewslice __pyx_v_chempots, __Pyx_memviewslice __pyx_v_points, __Pyx_memviewslice __pyx_v_result) {
g++ -pthread -shared -B /home/igor/miniconda3/envs/pycalphad-dev/compiler_compat -L/home/igor/miniconda3/envs/pycalphad-dev/lib -Wl,-rpath=/home/igor/miniconda3/envs/pycalphad-dev/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/pycalphad/core/hyperplane.o -L/home/igor/miniconda3/envs/pycalphad-dev/lib/python3.7/site-packages/symengine/lib -L/home/igor/miniconda3/envs/pycalphad-dev/lib/python3.7/site-packages/symengine/bin -lsymengine -o build/lib.linux-x86_64-3.7/pycalphad/core/hyperplane.cpython-37m-x86_64-linux-gnu.so -std=c++11
/home/igor/miniconda3/envs/pycalphad-dev/compiler_compat/ld: build/temp.linux-x86_64-3.7/pycalphad/core/hyperplane.o: unable to initialize decompress status for section .debug_info
/home/igor/miniconda3/envs/pycalphad-dev/compiler_compat/ld: build/temp.linux-x86_64-3.7/pycalphad/core/hyperplane.o: unable to initialize decompress status for section .debug_info
/home/igor/miniconda3/envs/pycalphad-dev/compiler_compat/ld: build/temp.linux-x86_64-3.7/pycalphad/core/hyperplane.o: unable to initialize decompress status for section .debug_info
/home/igor/miniconda3/envs/pycalphad-dev/compiler_compat/ld: build/temp.linux-x86_64-3.7/pycalphad/core/hyperplane.o: unable to initialize decompress status for section .debug_info
build/temp.linux-x86_64-3.7/pycalphad/core/hyperplane.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1
Richard Otis
I think what's happening is there are some old compiled modules which are confusing the compiler
Try rm -R build and rm pycalphad/core/*.o && rm pycalphad/core/*.so
Then run python setup.py develop again
Also what is the output of git status
You want to be on the branch called "develop"
Igor J Marques
When i try rm pycalphad/core/*.o && rm pycalphad/core/*.so the system returns rm: "is not possible to remove 'pycalphad/core/*.o': file or directory does not exhist" (something like this, my OS language is not setted as english)
about git status, its OK
On branch develop
Your branch is up to date with 'origin/develop'.
Richard Otis
Clearing out the build directory should be sufficient
Try running python setup.py develop
Igor J Marques
The same error persists. I checked the core folder and there is not any .o or .so files
Richard Otis
ok, I think you are running into this upstream issue ContinuumIO/anaconda-issues#11152
The short-term solution is to try running mv /home/igor/miniconda3/envs/pycalphad-dev/compiler_compat/ld /home/igor/miniconda3/envs/pycalphad-dev/compiler_compat/ld_old
Then python setup.py clean and python setup.py develop
Igor J Marques
Its working now! My sincerely thanks @richardotis and @bocklund!
I was thinking to try to solve, the issue pycalphad/pycalphad#191. Is this issue currently unfixed?
Richard Otis
Yes, it is still unfixed and no one else is working on it as far as we know
Daniel Schwen
It look like pycalphad can currently not deal with MatCalc TDB files (https://www.matcalc.at/images/stories/Download/Database/mc_fe_v2.059.tdb for example). There are some easily fixable unicode issues in the reference section of the file, but after fixing those pycalphad runs into a bunch of parse errors.
The most obvious ones are MatCalc-specific commands like "REFERENCE ELEMENT"
But commenting those out will make it choke on
Failed while parsing: PARAMETER HMVA(FCC_A1,*;0) 273.00 +175000; 6000.00 N REF:pov12
Has anyone tried to work around this yet? The open MatCalc TDB files cove a lot of ground that I'm unable to fin using TDBDB
(in case anyone does not know that site, it is a search engine for freely available TDB files: https://avdwgroup.engin.brown.edu/)
Richard Otis
@dschwen https://groups.google.com/forum/#!topic/pycalphad/c8LJV-8JFkc A user manually edited that file last year to make it pycalphad-compatible
I've used it for example calculations a few times but we haven't verified the database's accuracy, or even if pycalphad and MatCalc are getting the same answer consistently
Hi! I created a tdb file, named 'alcr' from COST 507 database and tried to run it on Scheil-Gulliver simulation tool from pycalphad.

ELEMENT /- ELECTRON_GAS 0.0000E+00 0.0000E+00 0.0000E+00!
ELEMENT VA VACUUM 0.0000E+00 0.0000E+00 0.0000E+00!
ELEMENT AL FCC_A1 26.981539 4577.296 28.3215!
ELEMENT CR BCC_A2 55.847 4050 23.56 !

FUNCTION UN_ASS 298.15 0; 300.00 N !
FUNCTION GHSERAL 298.15 -7976.15+137.093038T-24.3671976TLN(T)
T2-8.77664E-07*T3+74092T**(-1); 700 Y
T3+74092*T(-1); 933.47 Y
-11278.378+188.684153T-31.748192TLN(T)-1.230524E+28T**(-9); 2900 N !

3+139250T**(-1); 2180 Y
T-50TLN(T)-2885.26E29T*(-9); 6000 N !

FUNCTION GALBCC 298.15 +10083-4.813T+GHSERAL#; 6000 N !
FUNCTION GBCCAL 298.15 +10083-4.813
T+GHSERAL#; 6000 N !
FUNCTION GALLIQ 298.15 +11005.029-11.841867T+7.934E-20T7
+GHSERAL#; 933.47 Y
(-9)+GHSERAL#; 2900 N !
FUNCTION GCRFCC 298.15 -7284.0+0.163T+GHSERCR#; 6000 N !
FUNCTION GCRLIQ 298.15 +24339.955-11.420225
+2.37615E-21T**7+GHSERCR#; 2180 Y
+2.88526E+32T*(-9)+GHSERCR#; 6000 N !

PHASE LIQUID % 1 1.0 !
PARAMETER G(LIQUID, AL, 0) 298.15 +GALLIQ#; 6000 N !
PARAMETER G(LIQUID, CR, 0) 298.15 +GCRLIQ#; 6000 N !
PARAMETER G(LIQUID, AL, CR; 0) 298.15 -29000.0; 6000 N !
PARAMETER G(LIQUID, AL, CR; 1) 298.15 -11000.0; 6000 N !

PHASE FCC_A1 %/ 2 1 1 !
PARAMETER G(FCC_A1, AL, 0) 298.15 +GHSERAL#; 2900 N !
PARAMETER G(FCC_A1, CR, 0) 298.15 +GCRFCC#; 6000 N !
PARAMETER G(FCC_A1,AL,CR:VA;0) 298.15 -45900+6.0*T; 6000 N !

PHASE BCC_A2 &%- 1 1.0 !
PARAMETER G(BCC_A2, AL, 0) 298.15 +GHSERCR#; 2900 N !
PARAMETER G(BCC_A2, CR, 0) 298.15 +GBCCAL#; 6000 N !
PARAMETER G(BCC_A2,AL,CR:VA;0) 298.15 -54900+10*T; 6000 N !

PHASE ALCR2 % 2 1 2 !
PARAMETER G(ALCR2,AL:CR;0) 298.15 -32700.0-8.79T
GHSERCR#; 6000 N !

PHASE AL4CR % 2 4 1 !
PARAMETER G(AL4CR,AL:CR;0) 298.15 -89025.0+19.05T

PHASE AL8CR5_H % 2 8 5 !
PARAMETER G(AL8CR5_H,AL:CR;0) 298.15 -147732.0-58.5T

PHASE AL8CR5_L % 2 8 5 !
PARAMETER G(AL8CR5_L,AL:CR;0) 298.15 -229515.0
+8.0GHSERAL#+5.0GHSERCR#; 6000 N !

PHASE AL9CR4_L % 2 9 4 !
PARAMETER G(AL9CR4_L,AL:CR;0) 298.15 -230750.0+16.094T
GHSERAL#+4.0*GHSERCR#; 6000 N !

PHASE AL9CR4_H % 2 9 4 !
PARAMETER G(AL9CR4_H,AL:CR;0) 298.15 -134433.0-56.16T
GHSERAL#+4.0*GHSERCR#; 6000 N !

PHASE AL11CR2 % 3 10 1 2 !
PARAMETER G(AL11CR2,AL:AL:CR;0) 298.15 -175500.0+25.805T

but I got Keyerror 'AL' from Spyder. How to fix it?

import matplotlib.pyplot as plt
from pycalphad import Database, variables as v
from scheil import simulate_scheil_solidification

setup the simulation parameters

dbf = Database('alcr.tdb')
comps = ['AL', 'CR', 'VA']
phases = sorted(dbf.phases.keys())

liquid_phase_name = 'LIQUID'
initial_composition = {v.X('CR'): 0.3}
start_temperature = 850

perform the simulation

sol_res = simulate_scheil_solidification(dbf, comps, phases, initial_composition, start_temperature, step_temperature=1.0)

plot the result

for phase_name, amounts in sol_res.phase_amounts.items():
plt.plot(sol_res.temperatures, amounts, label=phase_name)
plt.plot(sol_res.temperatures, sol_res.fraction_liquid, label='LIQUID')
plt.ylabel('Phase Fraction')
plt.xlabel('Temperature (K)')
plt.title('Al-30Cr Scheil simulation, phase fractions')

Brandon Bocklund
Can you share the full error? Note that you can wrap your code in 3 backticks (```) before and after the code and get nice code formatting:
print(“hello world”)
Daniel Schwen
Thanks, @richardotis, I got the steel_database_fix.tdb from the thread you pointed me to and it parses fine!
Brandon Bocklund

I'm trying to install a development version of pycalphad on a new system. I followed the typical instructions on pycalphad.org (conda install -> force remove pycalphad -> pip install pycalphad as editable). Everything compiled correctly (e.g. python setup.py build_ext --inplace works), but whenever I try to import pycalphad, I get the following traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/gibbs/s0/bjb54/projects/pycalphad/pycalphad/__init__.py", line 18, in <module>
    from pycalphad.core.calculate import calculate
  File "/gibbs/s0/bjb54/projects/pycalphad/pycalphad/core/calculate.py", line 7, in <module>
    from pycalphad.codegen.callables import build_phase_records
  File "/gibbs/s0/bjb54/projects/pycalphad/pycalphad/codegen/callables.py", line 5, in <module>
    from pycalphad.core.phase_rec import PhaseRecord
ImportError: /gibbs/s0/bjb54/projects/pycalphad/pycalphad/core/phase_rec.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN9SymEngine11LLVMVisitor5loadsERKSs

I think I found the symbol that's supposed to be loaded in /home/graduate/bjb54/work/software/anaconda3/envs/calphad-dev/lib/python3.6/site-packages/symengine/lib/, but the symbol is slightly different: (here's the output from readelf -Ws /home/graduate/bjb54/work/software/anaconda3/envs/calphad-dev/lib/python3.6/site-packages/symengine/lib/symengine_wrapper.cpython-36m-x86_64-linux-gnu.so | grep loadsER )

   468: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _ZN9SymEngine11LLVMVisitor5loadsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
  8400: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _ZN9SymEngine11LLVMVisitor5loadsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE

Interestingly, I grepped my phase_rec.so for ERKS and only found the following symbols

    30: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _ZN9SymEngine11LLVMVisitor5loadsERKSs
   137: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _ZNSs6assignERKSs@GLIBCXX_3.4 (2)
   727: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _ZN9SymEngine11LLVMVisitor5loadsERKSs
   898: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _ZNSs6assignERKSs@@GLIBCXX_3.4

while OTOH, grepping for ERKNS in my phase_rec.so gives many results (256) similar to:

   363: 0000000000032810     5 FUNC    WEAK   DEFAULT   12 _ZN9SymEngine11BaseVisitorINS_11LLVMVisitorENS_7VisitorEE5visitERKNS_4BetaE
   364: 0000000000032680     5 FUNC    WEAK   DEFAULT   12 _ZN9SymEngine11BaseVisitorINS_11LLVMVisitorENS_7VisitorEE5visitERKNS_5ATan2E

I'm not sure if there's any meaning to the mangled names, but I can't seem to track down how to correctly link to symengine

Brandon Bocklund
I think this was an issue with compiler incompatibility. symengine and other libs are built using conda-forge's compilers, while I was using my system gcc. conda install -c conda-forge c-compiler cxx-compiler so I was using the same compilers as used by conda-forge seemed to solve my issue. After cleaning up the pycalphad shared object build directory and recompiling with these new compilers, things are working now.
Richard Otis
Great advice. This should be incorporated into the install instructions for the development version.
Igor J Marques
@richardotis i saw your change request on pycalphad/pycalphad#239
I have no experience at adding tests cases. Adding the case to test_model.py its sufficient to enable the test case? How can i assert that the DofError was raised?
Brandon Bocklund
@igorjrd yep! We use pytest for testing. Just add a function that starts with test_ is all you need to do for it to be enabled and run. You can see some documentation from pytest on how to write tests that assert errors here. Here's an example in the pycalphad code for a Database test that raises the error
Richard Otis
@igorjrd You're asking all the right questions!
Igor J Marques
thanks @richardotis!!
Igor J Marques
I wrote the test case and it worked well at my system. I just submmited a new commit at my pull request, now i think that the work is done!
Richard Otis
Looks good, I approved the changes, just need the tests to pass and we can merge
Igor J Marques
I think that the tests won't pass at all... The travis keeps giving an error during the requirement installation of OSX Python 3.6 test
Richard Otis
That's ok, we can ignore that
It's a separate issue