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

Created a new unified flow module for RSS. #203

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

Conversation

YuanbinLiu
Copy link
Collaborator

No description provided.

@JaGeo
Copy link
Collaborator

JaGeo commented Nov 7, 2024

@YuanbinLiu thank you.

'MLIP_PHONON_DEFAULTS_FILE_PATH' is not defined. This is why all workflows are failing. Could you please check this?


Keyword Arguments
-----------------
Tunable hyperparameters
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not recognized as a valid header in automatic doc generation, can you please revert it back as it was before?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, do you mean we need to capitalise each word in the header?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you mean that we need to capatalise each word in the header? Or only "Keyword Arguments" is accepted?

Copy link
Collaborator

Choose a reason for hiding this comment

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

only "Keyword Arguments" is accepted. There are ways to make other Headers to be recognized as well. It should be defined with napoleon_custom_sections in this file
https://github.com/autoatml/autoplex/blob/main/docs/conf.py

I do not have time to look into this, so if we want to have this name as header, one needs to check if this works out as intended by building docs locally with required changes in the conf.py file.

Posting here a list of recognized headers https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html#docstring-sections for your reference.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good to know! I have changed back to the previous version.


Keyword Arguments
-----------------
Tunable hyperparameters
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as before

config_file: str | None
Path to the configuration file that defines the setup parameters for the whole RSS workflow.
If not provided, the default file 'rss_default_configuration.yaml' will be used.
**kwargs: dict, optional
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can go under the header of Keyword Arguments in doc-strings, will make it consistent to other parts of code. See here , this is how it will be then rendered in API reference. Now I am not sure it will even get rendered properly.

https://autoatml.github.io/autoplex/reference/autoplex.fitting.common.utils.jace_fitting.html#autoplex.fitting.common.utils.jace_fitting

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good!

@@ -76,9 +81,6 @@ def rms_dict(x_ref: np.ndarray | list, x_pred: np.ndarray | list) -> dict:

x_ref and x_pred should be of same shape.

Adapted and adjusted from libatoms GAP tutorial page
https://libatoms.github.io/GAP/gap_fitting_tutorial.html#make-simple-plots-of-the-energies-and-forces-on-the-EMT-and-GAP-datas

Parameters
----------
----------1·
Copy link
Collaborator

@naik-aakash naik-aakash Nov 7, 2024

Choose a reason for hiding this comment

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

accidental typo? Seems not a part of this PR, but could be nice to be fixed it here itself.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for spotting this. Fixed now!

@@ -92,15 +115,12 @@ class HookeanRepulsion(FixConstraint):
that the constraint will be either soft enough (e.g. non-exploding in MD) or
strong enough (to avoid overlaps) for all spring constants and distances.
Adapted from:
Copy link
Collaborator

Choose a reason for hiding this comment

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

A general comment: We need to think of an alternative way to document this; the current method does not seem to render correctly in API documentation.

https://autoatml.github.io/autoplex/reference/autoplex.data.rss.utils.HookeanRepulsion.html#autoplex.data.rss.utils.HookeanRepulsion

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@MorrowChem, do you have any ideas for this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I just saw, References can be section header, that could be used for such cases I think.

Maybe have a look at possible header options here and see what you seem is the best fit https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html#docstring-sections


Keyword Arguments
-----------------
Tunable hyperparameters
Copy link
Collaborator

@naik-aakash naik-aakash Nov 7, 2024

Choose a reason for hiding this comment

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

Should be either named as Keyword Arguments, or one needs to define a custom list of acceptable headers to have documentation properly rendered if we want to stick with Tunable hyperparameters

path_to_job_files = list(dir.glob("job*"))
for path in path_to_job_files:
shutil.rmtree(path)


# def test_jace_rss(test_dir, memory_jobstore):
Copy link
Collaborator

@naik-aakash naik-aakash Nov 7, 2024

Choose a reason for hiding this comment

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

Why is this test commented out? (Again not part of this PR; just wondering now why it cannot be enabled)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This test requires the python-lammps interface, meaning that we need to have LAMMPS installed to test this module. The current setup does not include LAMMPS. Although I have successfully tested it on our cluster, I am considering waiting to test it together once we introduce the MD module. Do you have any better suggestions?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is open source right? Then we can include it in our CI setup as well. Just let us know the version you have it tested on. I see there is option to install via conda as well. Did you use the one from Conda?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it is. But I use the standard compilation method by cmake (see https://docs.lammps.org/Build_cmake.html). I am not sure if we can use conda to install lammps and related packages (i.e., pace and python here).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is the Conda option: https://docs.lammps.org/Install_conda.html. However, we need to ensure that it includes the PACE package (see https://docs.lammps.org/Build_extras.html#ml-pace).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks, building with cmake should also be possible. I Will try to add it in another PR today or in next days in our docker image here and then this test could also be enabled. Just let me know the version you have on your systems.

@@ -237,7 +237,7 @@ def static_run_and_convert(


@dataclass
class DFTStaticMaker(Maker):
class DFTStaticLabelling(Maker):
Copy link
Collaborator

Choose a reason for hiding this comment

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

As this maker is now renamed to DFTStaticLabelling, we would also need to rename it here on this line https://github.com/YuanbinLiu/autoplex_pub/blob/52731b1cbefd8a4546ee2b769430ff80ffb00868/autoplex/data/common/flows.py#L46

@@ -358,13 +370,16 @@ def make(
run_vasp_kwargs={"handlers": custom_handlers},
)

if self.custom_potcar is not None:
st_m = update_user_potcar_settings(st_m, potcar_updates=self.custom_potcar)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this import is missing as well in this module

to 'bulk'. Default is None.
"""
job_list = []

if isinstance(structures[0], list):
structures = flatten(structures, recursive=False)
Copy link
Collaborator

Choose a reason for hiding this comment

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

flatten is not imported

@naik-aakash
Copy link
Collaborator

Hi @YuanbinLiu, I have left some minor comments. I have not looked into the code in detail (I will need more time to properly look in there; it seems quite a lot, and thanks for this PR ). These are mainly concerning issues with docstrings. Some could be addressed in this PR, mainly the header names; the rest could be addressed in another.

The rest of the comments at the end may help at least fix the failing workflows here.

@@ -52,14 +52,14 @@
)

current_dir = Path(__file__).absolute().parent
MLIP_PHONON_DEFAULTS_FILE_PATH = current_dir / "mlip-phonon-defaults.json"
MLIP_RSS_DEFAULTS_FILE_PATH = current_dir / "mlip-rss-defaults.json"
GAP_DEFAULTS_FILE_PATH = current_dir / "gap-defaults.json"
Copy link
Collaborator

Choose a reason for hiding this comment

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

as MLIP_PHONON_DEFAULTS_FILE_PATH has been renamed now to GAP_DEFAULTS_FILE_PATH in this module, other modules where this is called also need to be changed. I found one place where it needs to be changed.

https://github.com/YuanbinLiu/autoplex_pub/blob/52731b1cbefd8a4546ee2b769430ff80ffb00868/autoplex/auto/phonons/flows.py#L10

Please also check if there are any other places where this is called.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@QuantumChemist could you help us tomorrow to figure out how we should name this in the future. Especially because of your phonon workflow. Thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I've reverted the name back to the original, as I believe for potential fitting purposes, it shouldn't differentiate between RSS and phonon. The default settings for parameters should be consistent across modules. Since we plan to introduce new modules in the future, making the name more general seems appropriate. Of course, if @QuantumChemist has a better suggestion, I'd be happy to discuss more.

Copy link
Collaborator

Choose a reason for hiding this comment

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

See #149 for further discussion

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would like to ask you to keep both files for now. The phonon workflow is finally running smoothly and I also think we might want different default settings in the future.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Based on @vlderinger 's reply here: #149 (comment), I would advocate having two separate sets of MLIP parameter files. The user is able to adjust it to their needs anyway, but as per internal default settings, we should keep it separated.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, I think we reached consensus here :).

Copy link
Collaborator

Choose a reason for hiding this comment

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

So you mean having mlip-phonon-defaults.json and mlip-rss-defaults.json? That sounds good to me for now

Copy link
Collaborator

Choose a reason for hiding this comment

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

sorry, was late to the party 🙈

@YuanbinLiu
Copy link
Collaborator Author

@YuanbinLiu thank you.

'MLIP_PHONON_DEFAULTS_FILE_PATH' is not defined. This is why all workflows are failing. Could you please check this?

It is fixed now. I think it may be better to integrate the parameters of GAP and the other potentials here; otherwise, it currently looks a bit isolated. I'll set aside some time to fix this.

@JaGeo
Copy link
Collaborator

JaGeo commented Nov 8, 2024

@YuanbinLiu Thanks. Yes, we would, however, need to check carefully that this doesn't change the defaults of the phonon workflow.

@JaGeo
Copy link
Collaborator

JaGeo commented Nov 8, 2024

@YuanbinLiu You did not push the changes yet, btw.

@YuanbinLiu
Copy link
Collaborator Author

Hi @YuanbinLiu, I have left some minor comments. I have not looked into the code in detail (I will need more time to properly look in there; it seems quite a lot, and thanks for this PR ). These are mainly concerning issues with docstrings. Some could be addressed in this PR, mainly the header names; the rest could be addressed in another.

The rest of the comments at the end may help at least fix the failing workflows here.

Thank you for this. Many issues arise due to rapid updates in the code version; I'll check it again.

@YuanbinLiu
Copy link
Collaborator Author

@YuanbinLiu You did not push the changes yet, btw.

just pushed

@YuanbinLiu
Copy link
Collaborator Author

I noticed that some of my changes caused a few bugs in phonon, and I am now working to fix them.

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.

5 participants