Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 14 13:34

    bocklund on master

    CI: Install pycalphad developme… (compare)

  • Jun 14 13:34
    bocklund closed #204
  • Jun 14 13:29
    bocklund opened #204
  • Jun 13 20:23

    bocklund on master

    MAINT: Use pyproject.toml (#203… (compare)

  • Jun 13 20:23
    bocklund closed #203
  • Jun 13 20:15
    bocklund synchronize #203
  • Jun 13 16:19
    bocklund opened #203
  • Jun 09 16:09

    bocklund on master

    ENH: Enable custom Model classe… (compare)

  • Jun 09 16:09
    bocklund closed #202
  • Jun 09 16:02
    bocklund edited #202
  • Jun 09 01:15
    bocklund synchronize #202
  • Jun 08 22:18
    bocklund edited #202
  • Jun 08 22:18
    bocklund edited #202
  • Jun 08 22:16
    bocklund opened #202
  • Jun 08 21:36

    bocklund on master

    MAINT: Use new pycalphad solver… (compare)

  • Jun 08 21:36
    bocklund closed #201
  • Jun 08 21:34
    bocklund commented #201
  • Jun 08 21:22
    bocklund synchronize #201
  • Jun 08 21:20
    bocklund opened #201
  • Jun 07 03:38

    bocklund on master

    DOC: Update readthedocs.yml for… (compare)

Brandon Bocklund
@bocklund
The ones with pure Al reference state all seem okay, but some other pure Si ones you may want to check into, includuing Si-acr-75cha_2.json and Si-acr-75cha_3.json (maybe the activites are just out of order in this one?)
Semen Kuzovchikov
@spike_k_gitlab
Ok, my bad. Thank you, I should plot and double-check all the input data now, there may be other kind of errors. I'll reply if I encounter this problem after data checks.
Brandon Bocklund
@bocklund
My current hypothesis is that some of the inconsistent data may be contributing to an unrealistically large log-likelihood and that these non-physical data are dominating the likelihood. If that's true, then some of your parameters (like the second one above) may be able to wander parameters space until they find some sets of values that drastically reduce the log-likelihood for the non-physical values of activity, but these are just unlucky guesses and that causes the chains to get stuck there.
I have some alternate hypotheses we can explore if the bad data hypothesis turns out to be wrong or not fix the issue
bcmiles
@bcmiles
image.png
Hey, I'm currently trying to run MCMC optimization on a system and hit an error relating to the symengine_wrapper and lambdify. It appears that the issue is related to lambdify not accepting the piecewise function but from what I've seen that should have been resolved already. I'm attaching the error message I get below, any help is much appreciated.
Richard Otis
@richardotis
@bcmiles Does the solution in this issue happen to fix things for you? https://github.com/pycalphad/pycalphad/issues/277#issuecomment-681197147
bcmiles
@bcmiles
No, that gives me a new error since python says that pycalphad 0.8.3 requires symengine == 0.6 and 0.6.1 is incompatible
Richard Otis
@richardotis
It doesn't work if you install it with pip?
You aren't supposed to mix conda and pip packages in the same environment, but that's why this is a workaround
bcmiles
@bcmiles
When I installed with pip it gave me the warning about incompatability
So I need to create a new environment and try again?
Brandon Bocklund
@bocklund
@bcmiles This is the same error that I get when I run your files, if you're still using those. I don't think it's related to a set of packages or an environment. It might be related to the something in the ionic liquid model that's being used here. I still haven't tracked it down.
bcmiles
@bcmiles
@bocklund thanks, I'll keep trying things on my end and see what works
Brandon Bocklund
@bocklund
I'm still investigating on my end as well, I'll keep you updated!
bcmiles
@bcmiles
@bocklund Looks like lambdify didn't like the naming done to the liquid in the TDB. I originally had it to match the thermoCalc version of using :Y after the phase name to denote it as an ionic liquid but removing it allows the mcmc to start running
bcmiles
@bcmiles
I'm currently trying to reproduce the Cu-Mg example, specifically plotting the data but I'm running into the following error when my code hits the multiplot() line "Process finished with exit code -1073741819 (0xC0000005)" I can plot ZPF data just fine using dataplot but multiplot is giving me errors, anyone know what could cause this?
juejing-liu
@juejing-liu

@bocklund
Hi Brandon,

I would like to know can ESPEI generate TDB files for the metal-gas binary systems (e.g. Fe-O, U-O)?

Best,

Juejing

Brandon Bocklund
@bocklund
Welcome, @juejing-liu! There are no limitations on which elements/species you use for parameter generation. You are only limited by your choice of model, i.e. for parameter generation, only Redlich-Kister polynomial solution model parameters can be generated (associate, ionic liquid, and quasichemical models are not supported)
juejing-liu
@juejing-liu
Ok, I am mostly working on the ionic liquid model (like U-O). Is there any plan to support this model?
Brandon Bocklund
@bocklund

For the direct parameter generation, it's unlikely that it will be supported because the ionic liquid requires doing the energy minimization step to determine the site ratios of the cation and anion sublattices which allow the liquid to charge balance.

On the other hand, because the ionic liquid model is supported by pycalphad, you can use ESPEI to try to optimize the parameter values via MCMC if you supply a parameterized model with reasonable starting values

juejing-liu
@juejing-liu
Oops I made a mistake. I am working on the ionic solid instead of the ionic liquid. Could ESPEI handle this model?
Brandon Bocklund
@bocklund

pycalphad doesn't support the ionic solid model yet (we had a closed PR that attempted to address it here: pycalphad/pycalphad#222). We have some solver changes upcoming that might make it worth addressing again.

I think that it would be possible to support parameter generation for ionic soilds, but that's not a high priority on our current roadmap for ESPEI and it would be pending support for ionic solids from pycalphad.

Pcascone
@Pcascone
I am trying to install espei via anaconda prompt as per the installation instructions on Windows 10 32bit but I get a version incompatibility error. "Output in format: requested package -> Available versions." pycalphad is the most recent build 0.8.4.
David Kleiven
@davidkleiven_gitlab

When I try to fit using MCMC I get some error. Here is how I started (datasets are stored in a folder called datasets):

  1. espei --check-datasets datasets: Finishes with no errors
  2. espei --input espei-in.yml: Finishes with no errors

where espei-in.yml looks like this:
system:
phase_models: mgsnX_input.json
datasets: datasets
generate_parameters:
excess_model: linear
ref_state: SGTE91
output:
output_db: mgsn.tdb

  1. espei --input mcmc.yml: This command causes errors

where mcmc.yml looks like this
system:
phase_models: mgsnX_input.json
datasets: datasets
mcmc:
iterations: 1000
input_db: mgsn.tdb
output:
output_db: mgsn_mcmc.tdb

I get the following error:

/home/davidkleiven/.local/lib/python3.7/site-packages/pycalphad/codegen/callables.py:97: UserWarning: State variables in build_callables are not {N, P, T}, but {T, P}. This can lead to incorrectly calculated values if the state variables used to call the generated functions do not match the state variables used to create them. State variables can be added with the additional_statevars argument.
"additional_statevars argument.".format(state_variables))
Traceback (most recent call last):
File "/home/davidkleiven/.local/bin/espei", line 11, in <module>
load_entry_point('espei', 'console_scripts', 'espei')()
File "/home/davidkleiven/Documents/ESPEI/espei/espei_script.py", line 311, in main
run_espei(input_settings)
File "/home/davidkleiven/Documents/ESPEI/espei/espei_script.py", line 260, in run_espei
approximate_equilibrium=approximate_equilibrium,
File "/home/davidkleiven/Documents/ESPEI/espei/optimizers/opt_base.py", line 36, in fit
node = self._fit(symbols, datasets, args, kwargs)
File "/home/davidkleiven/Documents/ESPEI/espei/optimizers/opt_mcmc.py", line 238, in _fit
self.predict(initial_guess,
ctx)
File "/home/davidkleiven/Documents/ESPEI/espei/optimizers/opt_mcmc.py", line 305, in predict
non_eq_thermochemical_prob = calculate_non_equilibrium_thermochemical_probability(parameters=np.array(params), *
non_equilibrium_thermochemical_kwargs)
File "/home/davidkleiven/Documents/ESPEI/espei/error_functions/non_equilibrium_thermochemical_error.py", line 271, in calculate_non_equilibrium_thermochemical_probability
points=data['calculate_dict']['points'])[output]
File "/home/davidkleiven/Documents/ESPEI/espei/shadowfunctions.py", line 55, in calculate
largest_energy=float(1e10), fake_points=fp)
File "/home/davidkleiven/.local/lib/python3.7/site-packages/pycalphad/core/calculate.py", line 190, in _compute_phase_values
param_symbols, parameter_array = extract_parameters(parameters)
File "/home/davidkleiven/.local/lib/python3.7/site-packages/pycalphad/core/utils.py", line 361, in extract_parameters
parameter_array_lengths = set(np.atleast_1d(val).size for val in parameters.values())
AttributeError: 'NoneType' object has no attribute 'values

has anyone seen this before or have can point me in the right direction? Thanks in advance for your help.

Brandon Bocklund
@bocklund
Hey @davidkleiven_gitlab, thanks for checking in here. This should be fixed by PhasesResearchLab/ESPEI#133 and a new release should be coming to conda-forge today
David Kleiven
@davidkleiven_gitlab
thanks, it worked now.
zhanghaihui
@zhanghaihui_gitlab
@bocklund Hi Brandon, would you mind explaining the definition and usage of data_weights for me in detail? The description in the manual is too short, I can’t understand how to use this key. Thanks.
Brandon Bocklund
@bocklund

@zhanghaihui_gitlab ESPEI computes the log-likelihood for every type of data by finding value of the log probability density function of a normal distribution centered at zero with a standard deviation of σ, i.e. norm(loc=0, scale=σ).logpdf(error) where error is the difference between the expected and calculated value for a particular set of parameters.

Since we have multiple types of data, a default value of the σ_initial exists for all supported data types to handle the different scales of error and to make the likelihoods comparable even though the errors are not. The data_weights modifies the σ used in the normal distribution by making σ = σ_initial/data_weight[data_type] for each data_type like ZPF or HM. By default, all data_weight values are 1.0, i.e. σ = σ_initial.

For example: consider that we have two experiments: one for enthalpy of formation data and one for entropy of formation data. If we calculate the error as the difference between the expected enthalpy of formation and the calculated enthalpy of formation, we might find the difference is 10 J/mol. If we do the same for the entropy of formation, we might find that the error is 5 J/K-mol.

Now we need to determine the likelihood for these two errors, one with a difference between the expected/calculated value of 10 and another of 5. Using our existing knowledge about the relative magnitudes of formation enthalpy vs. entropy, we know that an error of 10 J/mol in the enthalpy of formation is very close to the solution (i.e. high likelihood), while an error of 5 J/K-mol in the enthalpy of formation is probably not that close to the solution (i.e. low likelihood). The σ_initial are set so that the likelihoods of these two cases are comparable, but you might not agree with my choice of σ_initial or you might want to value a particular type of data more heavily than I do. data_weights lets you do that.

Let me know if this helps to clarify data_weights. I can update the docs with an edited version of this to help answer this question in the future
zhanghaihui
@zhanghaihui_gitlab
@bocklund Thank you very much for your answer, although I did not understand it before. Recently, I got it after learning some theoretical knowledge of statistics, but it was still very difficult before.
zhanghaihui
@zhanghaihui_gitlab
@bocklund Another question is how to determine the likelihood for difference errors and how to using existing knowledge about the relative magnitudes to judge it is available in detail?
zhanghaihui
@zhanghaihui_gitlab
I found it could judge some through log but I'm not sure. For example, when I change the data_weights of ZPF to 20, I found the likelihood of ZPF increase from -3000 to -800, and total likelihood also increase from -5000 to -1800. But the likelihood of Non-equilibrium thermochemical increase from -1300 to -800 although I did not change that parameter. I think the increase is too much. Is that normal? Is the reasonable likelihood higher than -2000?
bocklund
@bocklund:matrix.org
[m]
Test from Matrix
wahab2604
@wahab2604
image.png
Hi, I started adding activity data for my system for the MCMC , and realised it's lnprob doesn't move from iteration to iteration and it stays the same as the initial (i've changed how i've written the data i.e different references but its still the same), I can run the example and it works there. What could I be doing wrong ?
3 replies
hjy4090
@hjy4090
Is it possible by using ESPEI to produce ternary tdb file from the given binary tdb files or unary data out of the literature?
4 replies
Semen Kuzovchikov
@spike_k_gitlab
Hi there. Are there any arguments for using emcee? As I can see from examples most of the parameters in all of the chains remain stuck for 10 to 20 iterations despite being continually distributed.
5 replies
Semen Kuzovchikov
@spike_k_gitlab
Oh, that may be very useful for writing models for NUTS. Thanks for replying.
1 reply
Semen Kuzovchikov
@spike_k_gitlab
Okay, now i've got where it goes. The next step is implementing hierarchical bayesian models for higher than 3 components tdb databases.
Richard Otis
@rotis:matrix.org
[m]
@spike_k_gitlab: Like Brandon, I am also very interested in NUTS and other HMC-based approaches for thermodynamic optimization. In the JMR paper linked above, we showed that under mild (and common) assumptions, the likelihood gradient for thermodynamic parameter optimization is well-behaved. I have preliminary unpublished work suggesting that the use of likelihood gradients is likely to significantly accelerate convergence, especially for multi-component and multi-sublattice systems
I am not currently working the issue though. I'd be happy to hand over my materials and learnings to date to someone motivated to carry out the work to completion
Semen Kuzovchikov
@spike_k_gitlab
We are going with my student to try stan or pymc on espei as part of his master thesis. Paper mentioned above will sure save us a lot of work.
wahab2604
@wahab2604
Hi, I was looking for a way to quantify the results of the ESPEI fit against the experimental points i.e the deviation between the fit and the experimental points. I was thinking of using the pycalphad equilibrium function to calculate this. Is there a better way to do this ?
Brandon Bocklund
@bocklund:matrix.org
[m]
For what kind of data?
wahab2604
@wahab2604
ZPF data
Brandon Bocklund
@bocklund:matrix.org
[m]
If you want to be quantitative, probably the best place to start is by looking at driving forces. If you're willing to use my bocklund/zpf-misicbility-gap branch that's open in ESPEI#151, Tobias Spitaler and I just recently put together a new script that uses some refactoring to get at these driving forces a little easier. Here's the code example with some images: https://github.com/PhasesResearchLab/ESPEI/pull/151/#issuecomment-817177546
Of course, you don't have to plot the data on the diagram and you can compute whatever metrics you like once you have the driving forces
Brandon Bocklund
@bocklund:matrix.org
[m]
If you just want to get a feel for which data may be behaving poorly, the logs with output.verbosity: 3 can be insightful too, but there's a significant amount of output
wahab2604
@wahab2604
Thanks, having a look at it now, I like the plots of the driving force and yeh I was previously using the verbosity 3 and it got a bit overwhelming with the amount of data to look at