Skip to content

Commit

Permalink
add mp_id to generate_frequency_eigenvector function
Browse files Browse the repository at this point in the history
  • Loading branch information
leslie-zheng committed Jul 1, 2024
1 parent a0ba097 commit 4a1daae
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/atomate2/common/flows/phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ class BasePhononMaker(Maker, ABC):
generate_frequencies_eigenvectors_kwargs: dict = field(default_factory=dict)
kpath_scheme: str = "seekpath"
code: str = None

mp_id: str = None
store_force_constants: bool = True
# if True, use the socket for the paralleled calculation of the phonon displacements,
# however, currently the true parallelization is still under experimental testing
Expand Down Expand Up @@ -340,6 +342,7 @@ def make(
use_symmetrized_structure=self.use_symmetrized_structure,
kpath_scheme=self.kpath_scheme,
code=self.code,
mp_id=self.mp_id,
structure=structure,
displacement_data=displacement_calcs.output,
epsilon_static=epsilon_static,
Expand Down
2 changes: 2 additions & 0 deletions src/atomate2/common/jobs/phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ def generate_frequencies_eigenvectors(
use_symmetrized_structure: str | None,
kpath_scheme: str,
code: str,
mp_id: str,
displacement_data: dict[str, list],
total_dft_energy: float,
epsilon_static: Matrix3D = None,
Expand Down Expand Up @@ -308,6 +309,7 @@ def generate_frequencies_eigenvectors(
use_symmetrized_structure=use_symmetrized_structure,
kpath_scheme=kpath_scheme,
code=code,
mp_id=mp_id,
displacement_data=displacement_data,
total_dft_energy=total_dft_energy,
epsilon_static=epsilon_static,
Expand Down
2 changes: 2 additions & 0 deletions src/atomate2/common/schemas/phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ def from_forces_born(
use_symmetrized_structure: Union[str, None],
kpath_scheme: str,
code: str,
mp_id: str,
displacement_data: dict[str, list],
total_dft_energy: float,
epsilon_static: Matrix3D = None,
Expand Down Expand Up @@ -746,6 +747,7 @@ def from_forces_born(
supercell_matrix=phonon.supercell_matrix.tolist(),
primitive_matrix=phonon.primitive_matrix.tolist(),
code=code,
mp_id=mp_id,
thermal_displacement_data={
"temperatures_thermal_displacements": temperature_range_thermal_displacements.tolist(), # noqa: E501
"thermal_displacement_matrix_cif": tdisp_mat_cif,
Expand Down

6 comments on commit 4a1daae

@leslie-zheng
Copy link
Owner Author

Choose a reason for hiding this comment

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

Hi @JaGeo and @naik-aakash I use this way to insert mp_id into the final doc of generate_frequency_eigenvector function, maybe this is not the best solution. but it works.

@JaGeo
Copy link

@JaGeo JaGeo commented on 4a1daae Jul 1, 2024

Choose a reason for hiding this comment

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

Thanks! Yeah, @naik-aakash will update the doc on how to do it with the current code. (Maybe, you can post it here as well, @naik-aakash)

@leslie-zheng
Copy link
Owner Author

Choose a reason for hiding this comment

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

Hi Janine @JaGeo , i am curious what is the difference between the first tight relax and second tight relax? Because the phonon calculation needs a very strict converged criteria of force, how can i set the force convergence to -1e-3 and the second force convergence criteria to -1e-5? thanks.

@JaGeo
Copy link

@JaGeo JaGeo commented on 4a1daae Jul 2, 2024

Choose a reason for hiding this comment

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

The same purpose as any DoubleRelaxMaker has in atomate2.

@naik-aakash
Copy link

Choose a reason for hiding this comment

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

Hi @leslie-zheng , I have raised a PR now for adding metadata to the output task doc,

materialsproject#910

to add mp_id to the taskdoc, once the PR is merged you can simply pass in a dict in generate_frequencies_eigenvectors_kwargs={"additional_fields": {"mp_id": "mp-xxx"}}, when you initialize the PhononMaker.

@leslie-zheng
Copy link
Owner Author

Choose a reason for hiding this comment

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

Thanks aaksh @naik-aakash , I will try it.

Please sign in to comment.