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

[WIP] Multi step lattice dynamics workflow using hiPhive #559

Open
wants to merge 223 commits into
base: main
Choose a base branch
from

Conversation

hrushikesh-s
Copy link
Collaborator

Summary

Include a summary of major changes in bullet points:

  • Workflow for calculating harmonic & anharmonic properties of phonons using hiPhive.

Additional dependencies introduced (if any)

  • hiPhive -- note that the renormalization & fixed_rattling features are currently not available in the [master branch of hiphive] . These features are currently in @jsyony37's fork under the branch named personal. The original hiPhive code as well as @jsyony37's fork are hosted on gitlab
  • ShengBTE

TODO (if any)

  • migrate the workflow to pydanticV2
  • write unit tests

Checklist

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 black on your new code. This will
    automatically reformat your code to PEP8 conventions and removes most issues. Then run
    ruff.
  • Docstrings 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.

@codecov
Copy link

codecov bot commented Oct 10, 2023

Codecov Report

Attention: Patch coverage is 0.34682% with 862 lines in your changes missing coverage. Please review.

Project coverage is 66.81%. Comparing base (29a5731) to head (1421e04).
Report is 36 commits behind head on main.

Current head 1421e04 differs from pull request most recent head bbebbd4

Please upload reports for the commit bbebbd4 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #559      +/-   ##
==========================================
- Coverage   74.94%   66.81%   -8.14%     
==========================================
  Files         136       79      -57     
  Lines       10513     7539    -2974     
  Branches     1643     1101     -542     
==========================================
- Hits         7879     5037    -2842     
- Misses       2143     2197      +54     
+ Partials      491      305     -186     
Files Coverage Δ
src/atomate2/vasp/files.py 70.27% <16.66%> (-15.70%) ⬇️
src/atomate2/vasp/flows/hiphive.py 0.00% <0.00%> (ø)
src/atomate2/vasp/jobs/hiphive.py 0.00% <0.00%> (ø)

... and 119 files with indirect coverage changes

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 seen this by chance. As I have worked on the phonon workflow, I wanted to leave some comments. And also ask about how easily it could be extended towards other codes than VASP and/or potentially "forcefields".

Thanks!


# 2. Generates supercell, performs fixed displ rattling and
# runs static calculations
vasp_static_calcs = run_static_calculations(
Copy link
Member

Choose a reason for hiding this comment

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

Might be interesting to converge this implementation and the one in the phonon workflow with Phonopy at some point.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In this workflow, we are perturbing all the atoms of the supercell with a Gaussian distribution with a user defined mean and a fixed standard deviation of 1. The implementation can be found here.

Might be interesting to converge this implementation and the one in the phonon workflow with Phonopy at some point.

As far as I know, Phonopy's generate_displacement function doesn't perturb all the atoms in the supercell, and hence we had to implement our generate_displaced_structures function.
Maybe, I'm missing out on something here?

Copy link
Member

Choose a reason for hiding this comment

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

I was referring to this part but maybe not worth spending the time unifying it

def run_phonon_displacements(

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ohh I see. Yes, unifying hiphive workflow with run_phonon_displacements does make sense!
Thanks, I'll try to unify my workflow with this!

def run_phonon_displacements(

Copy link
Member

Choose a reason for hiding this comment

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

The only drawback that I see: you probably need to put the structures in a datastore. Thus, having it in one job might be better. In any case, we could at least think about unifying it

Copy link
Contributor

Choose a reason for hiding this comment

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

@hrushikesh-s I think our most recent discussion is using a fixed set of displacement rather than MCRattle, right? Check PerturbStructureTransformation in pymatgen (https://github.com/materialsproject/pymatgen/blob/1a277687f31d63d1011d59a8a529f194486265ce/pymatgen/transformations/standard_transformations.py#L743), we have deprecated the tag of disp_cut after previous discussion, right?

default is "srun -n 32 ./ShengBTE 2>BTE.err >BTE.out".
PHONO3PY_CMD (str):
Command for executing Phono3py, default is
"phono3py --mesh 19 19 19 --fc3 --fc2 --br --dim 5 5 5".
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to use the API of phono3py here instead? I feel one cannot easily switch to another code otherwise.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not using phono3py for calculating lattice thermal conductivity. Thanks for catching up this error, I'll remove the PHONO3PY_CMD argument.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, using phono3py api instead, we need to provide thermal conductivity calculation option using phono3py because there might be some bugs for the FORCE_CONSTANTS_3RD generation step in HiPhive and it is not solved in their side yet.

)

# ##### 8. Lattice thermal conductivity calculation using phono3py
# if calculate_lattice_thermal_conductivity:
Copy link
Member

Choose a reason for hiding this comment

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

Ah, okay, it's not included. Then, maybe, the command should be removed. Otherwise, I would recommend using the API of phono3py.

@@ -246,7 +246,8 @@ def generate_frequencies_eigenvectors(
)


@job(data=["forces", "displaced_structures"])
# @job(data=["forces", "displaced_structures"])
Copy link
Member

Choose a reason for hiding this comment

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

Just a reminder: this is really important for large structures. Just saw this change by chance.

dependabot bot and others added 30 commits June 27, 2024 18:25
Bumps [pydantic-settings](https://github.com/pydantic/pydantic-settings) from 2.3.1 to 2.3.3.
- [Release notes](https://github.com/pydantic/pydantic-settings/releases)
- [Commits](pydantic/pydantic-settings@v2.3.1...v2.3.3)

---
updated-dependencies:
- dependency-name: pydantic-settings
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [python-ulid](https://github.com/mdomke/python-ulid) from 2.6.0 to 2.7.0.
- [Release notes](https://github.com/mdomke/python-ulid/releases)
- [Changelog](https://github.com/mdomke/python-ulid/blob/main/CHANGELOG.rst)
- [Commits](mdomke/python-ulid@2.6.0...2.7.0)

---
updated-dependencies:
- dependency-name: python-ulid
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [phonopy](https://phonopy.github.io/phonopy/) from 2.24.2 to 2.24.3.

---
updated-dependencies:
- dependency-name: phonopy
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
temporarily commenting out quality control job
1. using replace instead of add in hiphive_static_calcs job
2. ensuring that the given structure. in primitive, if not then converting to prim structure.
3. updated logic to write the FC_3rd order file
4. ruff fixes
5. added support of amabte, shengbte, and phono3py in LTC calculation
6. updated logic to only use lambda=0 for TI, when imag_modes_bool = False
1. ruff fixes
2. updated class attributes
3. added bulk modulus to the metadata
4. #TODO: Implement Quality Control Job
5. updated fireworks config for each job
6. updated definition to extract phonon dispersion
7. updated definition to extract LTC, depending upon whether or not renormalization was performed.
8. updated name of the flow
using tags in accordance with atomate LD workflow
1. supports shengBTE, almaBTE & phono3py as of now.
2. before running any of these calculators, make sure to successfully compile them as explained on their respective websites.
3.Also, remember to put the execution command for each of these calculators in atomate2.yaml file
the decision is now made based on whether n_imaginary > 0 from the fitting_data.json @ 0K
1. largest displacement is based on the avg row (periodic table) number of the compound.
2. displacements are skewed towards the large displacement
3. # of displaced structures to generate depends on the n_structures, which depends upon the symmetry of the primitive structure
4. smallest displacement is fixed at 0.01 Å
1. added a job that creates multiples sub jobs for each hiphive fitting and then collects the fitting data & the fcs. fcp, cluster space and other properties corresponding to the best cutoff!
2. setting the min # of displ to 4 & max # of displ to 60
Trying different strategies for perturbing the atoms in the supercell --
1. Fixed displacement
2. MC Rattle
3. MD informed displacements

Adding a penalty to the displacements that are generated out of the distribution.
1. selects cutoffs based on target DOFs for 2nd, 3rd and 4th order.
2. all the functions have doctrings.
3. modified the function that generates perturbed structures
4. updated def get_cutoffs -- generates a grid of cutoffs that satisfy the given # of required DOFs for 2nd, 3rd and 4th order interaction.
5. sequentially performs the linear regression for each cutoff.
6. modified the files that are saved during the execution of workflow
2. removed files that are not required to be saved during the workflow execution.
2. adding the use of MACE's RelaxMaker & StaticMaker
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.