New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
write_tdb function outputs incorrect tdb due to symengine #420
Comments
Does pycalphad produce the same phase diagram for both TDBs? For example this input:
and this output:
These two should be identical for many significant figures, and I would expect pycalphad to produce identical phase diagrams for both. This is still a bug because most other Calphad implementations will not accept this output, but I want to understand if this is only a compatibility bug or if it's also a correctness bug in pycalphad. |
Related: symengine/symengine#1828 (comment), in particular:
|
The binplot in Pycalphad doesn’t produce a plot for the output tdb but does produce one for the input. It’s specifically the EXP causing the issue, removing those functions will produce a TDB that will plot in pycalphad. |
We have logic in the TDB writer that is supposed to detect this case: Lines 469 to 478 in ebcfbdb
We just need to work out why it isn't being triggered here. |
I believe that part is working as intended, but from my small investigation its the reading of the TDB that might be causing the issue specifically the tdb_grammar() function: Line 207 in ebcfbdb
which then points to: Lines 107 to 116 in ebcfbdb
and then points to the sympify evaluation: Line 62 in ebcfbdb
The logic you referenced doesn't work in this case because the expr has already been evaluated upon creation of a Database object, so the 2.71** is written out according to the else: Lines 473 to 478 in ebcfbdb
|
It doesn't solve the general problem, but can we tweak the writing logic for |
The write_tdb function produces an unreadable tdb due to how symengine evaluates EXP and LN.
symengine.sympify is used here and is where the evaluation takes places:
https://github.com/pycalphad/pycalphad/blob/ebcfbdb4dadfcce98a40db41c444a19842d8849e/pycalphad/io/tdb.py#L62
I have attached a two line script which opens a tdb then writes it out again, as you can see the input (which pycalphad reads and plot correctly ) is very different to the output tdb
According to Brandon the issue may be related to this:
symengine/symengine#1828
test.zip
The text was updated successfully, but these errors were encountered: