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

Anharmonicity Quantification workflow #901

Merged
merged 70 commits into from
Aug 24, 2024

Conversation

4kevinbeck5
Copy link
Contributor

@4kevinbeck5 4kevinbeck5 commented Jun 25, 2024

Summary

Creates a workflow for anharmonicity quantification as defined in Knoop 2020

  • Workflow and schema for anharmonicity quantification
  • Implementation in FHI-aims

Additional dependencies introduced (if any)

  • None

TODO (if any)

Larger scale testing in progress

Checklist

Work-in-progress pull requests are encouraged, but please put [WIP] in the pull request
title.

Before a pull request can be merged, the following items must be checked:

  • Code is in the standard Python style.
    The easiest way to handle this is to run the following in the correct sequence on
    your local machine. Start with running ruff and ruff format on your new code. This will
    automatically reformat your code to PEP8 conventions and fix many linting issues.
  • Doc strings have been added in the Numpy docstring format.
    Run ruff on your code.
  • Type annotations are highly encouraged. Run mypy to
    type check your code.
  • Tests have been added for any new functionality or bug fixes.
  • All linting and tests pass.

Note that the CI system will run all the above checks. But it will be much more
efficient if you already fix most errors prior to submitting the PR. It is highly
recommended that you use the pre-commit hook provided in the repository. Simply run
pre-commit install and a check will be run prior to allowing commits.

4kevinbeck5 and others added 30 commits March 21, 2024 09:14
o
Debug sigma^A calculations

1) Temperature needs to be in eV (kB / e)
2) Consistent supercells: phonopy and pymatgen use different standards
3) Use a BasePhononMaker instead of copy/paste
remove hard-coded constants
If relaxation changes structure it must be read from phonon doc
Tests should now work outside of socket calcs
similar to what is done with the phonon workflow
Default is still to start from phonons for consistency between anharmonic and phonon calcs
Copy link
Member

@JaGeo JaGeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added some smaller comments for now. Will think more carefully about it next week as well.

src/atomate2/aims/flows/anharmonicity.py Outdated Show resolved Hide resolved
src/atomate2/common/flows/anharmonicity.py Show resolved Hide resolved
src/atomate2/common/jobs/anharmonicity.py Outdated Show resolved Hide resolved
src/atomate2/common/jobs/anharmonicity.py Outdated Show resolved Hide resolved
src/atomate2/common/jobs/anharmonicity.py Show resolved Hide resolved
src/atomate2/common/jobs/anharmonicity.py Outdated Show resolved Hide resolved
tests/aims/test_flows/test_anharmonic_quantification.py Outdated Show resolved Hide resolved
@JaGeo
Copy link
Member

JaGeo commented Aug 6, 2024

Tests are failing here. I think you have to fix the torchdata version similar to #940 .

@JaGeo
Copy link
Member

JaGeo commented Aug 21, 2024

Let me know if I should do another review round. Currently, there are some conflicts

@4kevinbeck5
Copy link
Contributor Author

@JaGeo I just pushed a version that implemented the mode resolved sigma^A and fixed all the things you brought up previously

]


def get_sigma_per_element(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@4kevinbeck5 this looks very good.

The only comment that I have is that some of these are functions and are not really jobs. @utf should we move those somewhere else? common/utils would be a possibility but it might get messy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rationale for making those functions rather than jobs was just to reduce the number of jobs per flow on the HPC

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is completely fine and desired. I am just wondering if functions should be in the jobs folder/file.

@4kevinbeck5
Copy link
Contributor Author

I just committed a version that passes the linting this time. There was a small mistake I made before in the conftest.py file

@JaGeo
Copy link
Member

JaGeo commented Aug 23, 2024

@4kevinbeck5 I will check! Thanks!

Could you also add yourself to the list of contributors 😃?

@4kevinbeck5
Copy link
Contributor Author

@JaGeo I just pushed the contributors.md file with my info added!

)
jobs.append(force_calcs)

sigma_a_vals = {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed.

@JaGeo JaGeo enabled auto-merge (squash) August 24, 2024 13:13
@JaGeo
Copy link
Member

JaGeo commented Aug 24, 2024

@4kevinbeck5 I removed one dict initialization and checked if the torchdata pin is still needed. I am now happy with the changes. I am enabling auto merge! Thank you for your contribution!

If I have some time, I might implement a VASP interface. It might, however, be that this will be next year ;).

@JaGeo JaGeo merged commit 49d1c1d into materialsproject:main Aug 24, 2024
6 checks passed
@utf utf added the feature A new feature being added label Sep 26, 2024
hrushikesh-s pushed a commit to hrushikesh-s/atomate2 that referenced this pull request Nov 16, 2024
* Generated displaced structures

* Implemented sigma_A oneshot calculations

* Added some needed object attributes

* Added some object attributes

* Added pieces to flow to utilize PhononBSDOSDoc

* Added a prefactor method to find dynamical matrix

* Fixed issue with prefactor method

* Made creation of dynamical matrix indep of phonon

* Added helper function to make Phonopy objects

* Finished writing flow

* Made all functions independent of passing Phonopy

* Code for anharmonicity code and starter for test

* o
Debug sigma^A calculations

1) Temperature needs to be in eV (kB / e)
2) Consistent supercells: phonopy and pymatgen use different standards
3) Use a BasePhononMaker instead of copy/paste

* Update anharmonicity tests

* Use pymatgen.core.units.kb

remove hard-coded constants

* Fixed assert statement

* The phonon supercell now determined to from phonon document

If relaxation changes structure it must be read from phonon doc

* Modification for mock_aims to work

* Add the test data for mock aims

Tests should now work outside of socket calcs

* Add an aims only workflow and generalize the common one

similar to what is done with the phonon workflow

* Add functionality to create an anharmonicity flow from a PhononBSDOSDoc

Default is still to start from phonons for consistency between anharmonic and phonon calcs

* Actually add Aims workflow for anharm

* Made to work with anharmonicity schema doc

* Added function to make anharmonicity doc

* Cleaned up anharmonicity flow test

* Wrote tests for anharm schema

* Added fields to anharm schema

* Added flag and function for full sigma^A

* Added files for mock_aims

* Added test for full sigma A with mock_aims

* Added capability to pass a seed for rng

* Added files for mock aims

* Added pytest fixture for NaCl structure

* Added atom-resolved sigma A calculation and test

* Fixed bug when atom_resolved was False

* Added mock_aims files for mode_resolved sigma^A

* Added mode resolved sigma^A test w/ mock_aims

* Implemented mode resolved sigma^A calcs

* Made tests work with sigma_dict

* Returns a dictionary with computed sigma values

* Cleaned up code with pre-commit

* Fixed bug in test_anharmonicity.py

* Fixed anharm quant one-shot socket test

* Fixed typo in docstring

* Added return info to docstrings

* Refactored code to make cleaner

* Fix lint errors in tests

* Remove typing.Self call

Tested on python 3.11

* Fixed lint and typing errors.

* Fixed tests to pass on github.

* Update src/atomate2/aims/flows/anharmonicity.py

Co-authored-by: J. George <JaGeo@users.noreply.github.com>

* Changed omega_to_THz to be imported from atomate2

* Made separate eigenvec/val solver for dynamical matrix and added clean_dir to tests

* Fixed torchdata version

* Re-implemented get_phonon_supercell

* Added mode-resolved sigma^A calculation

* Fixed linting issues

* Add @4kevinbeck5 to contributors.md file

* remove dict initalisation

* test if pip on torch data is really needed

---------

Co-authored-by: Tom Purcell <purcellt@arizona.edu>
Co-authored-by: J. George <JaGeo@users.noreply.github.com>
Co-authored-by: JaGeo <janinegeorge.ulfen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature being added
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants