Skip to content

Index error when using binplot #367

Closed

Description

@wahab2604

When using pycalphad 0.9.1 and the binplot function I get an index error :
Capture

I have attached a tdb that causes the error, I'm using a associates model and this tdb contains a solid solution
I also have another tdb that produces the same error and that tdb contains a Liquid+Liquid gap

Both of these tdb were working in pycalphad 0.9.0
TDB file.zip

I also get the same error when using the espei mcmc when setting approximate_equilibrium: False, however when I set it to True (which I mostly use) the error does not occur and the mcmc runs.

Activity

  1. richardotis commented on Aug 10, 2021

    @richardotis
    Collaborator

    I can reproduce this error with the above database and the following code:

    from pycalphad import Database, binplot, variables as v
    import matplotlib.pyplot as plt
    dbf = Database('A_S_corrected.tdb')
    
    # Define the components
    comps = ['A', 'Q']
    # Get all possible phases programmatically
    phases = dbf.phases.keys()
    
    # Plot the phase diagram, if no axes are supplied, a new figure with axes will be created automatically
    binplot(dbf, comps, phases, {v.N: 1, v.P:101325, v.T: (300, 1000, 10), v.X('Q'):(0, 1, 0.02)})
    
    plt.show()
  2. richardotis commented on Aug 10, 2021

    @richardotis
    Collaborator

    The cause of this error is an index offset being computed based on the number of nonvacant components, instead of the number of nonvacant elements. In general these numbers are not the same, and for associate models they usually are not, which is why you encountered this issue. I have a fix ready, and I'm just going to take a little time to prepare a test before I push the PR.

  3. wahab2604 commented on Aug 10, 2021

    @wahab2604
    Author

    Thank you very much for your help

  4. added a commit that references this issue on Aug 10, 2021
    f9de147
  5. added a commit that references this issue on Aug 11, 2021
    7cc854d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions