Skip to content
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

FIX: Canonicalize coordination number sorting in DAT reader #416

Merged
merged 5 commits into from
May 19, 2022

Conversation

jorgepazsoldanpalma
Copy link
Contributor

@jorgepazsoldanpalma jorgepazsoldanpalma commented May 18, 2022

(This summary added from the comments in the PR)

Previously PyCalphad would alphabetically express the quadruplets and because of this if the coordination numbers of a binary quadruplet in the database were not expressed in alphabetic order in the database parameters, then the coordination numbers would be incorrectly ordered. Sometimes this would trigger a calculation of coordination number, instead of a lookup. A fix has been added to the cs_dat parser to canonically sort coordination numbers when DAT files are read.

The test makes sure that the order in which the species are entered in the DAT file does not affect the calculated energy. In this specific test the Ni is entered before the K species.

@codecov
Copy link

codecov bot commented May 18, 2022

Codecov Report

Merging #416 (54305ec) into develop (f8e3951) will increase coverage by 0.19%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop     #416      +/-   ##
===========================================
+ Coverage    90.67%   90.86%   +0.19%     
===========================================
  Files           45       45              
  Lines         6335     6469     +134     
===========================================
+ Hits          5744     5878     +134     
  Misses         591      591              
Impacted Files Coverage Δ
pycalphad/models/model_mqmqa.py 88.42% <ø> (ø)
pycalphad/io/cs_dat.py 81.28% <100.00%> (+0.15%) ⬆️
pycalphad/tests/test_energy.py 98.88% <100.00%> (+0.03%) ⬆️
pycalphad/codegen/sympydiff_utils.py 98.21% <0.00%> (-1.79%) ⬇️
pycalphad/tests/test_utils.py 100.00% <0.00%> (ø)
pycalphad/tests/test_database.py 100.00% <0.00%> (ø)
pycalphad/tests/test_calculate.py 100.00% <0.00%> (ø)
pycalphad/model.py 91.84% <0.00%> (+0.16%) ⬆️
pycalphad/io/tdb.py 89.70% <0.00%> (+0.35%) ⬆️
pycalphad/io/database.py 87.24% <0.00%> (+0.44%) ⬆️
... and 1 more

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@bocklund bocklund changed the title Z value correction FIX: Canonicalize coordination number sorting in DAT reader May 18, 2022
@bocklund bocklund added this to the 0.10.1 milestone May 18, 2022
@jorgepazsoldanpalma
Copy link
Contributor Author

jorgepazsoldanpalma commented May 18, 2022 via email

@bocklund bocklund self-requested a review May 18, 2022 23:11
@bocklund bocklund merged commit 0586c8d into pycalphad:develop May 19, 2022
@bocklund
Copy link
Collaborator

Thanks for the test and the fix, @jorgepazsoldanpalma! And congratulations on your first PR to PyCalphad!

@jorgepazsoldanpalma
Copy link
Contributor Author

jorgepazsoldanpalma commented May 19, 2022 via email

@jorgepazsoldanpalma
Copy link
Contributor Author

jorgepazsoldanpalma commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants