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

Extend lobsterenv for coop/cobi #3050

Merged

Conversation

naik-aakash
Copy link
Contributor

@naik-aakash naik-aakash commented Jun 6, 2023

Additions

  • Extended lobsterenv.py module to work for ICOBILIST/ICOOPLIST
  • Added test cases

@naik-aakash
Copy link
Contributor Author

Hi @JaGeo , if you have any more suggestions / changes let me know

@naik-aakash naik-aakash changed the title first commit for extending lobsterenv for coop/cobi [WIP] extending lobsterenv for coop/cobi Jun 6, 2023
adapt_extremum_to_add_cond: should the extrumum be adapted to the additional condition
additional_condition: additional condition to determine which bonds are relevant
Returns: [-100000, min(max_icohp*0.15,-0.1)]
Returns: [-100000, min(max_icohp*0.15,-0.1)] / [max_icohp*0.15,100000]
Copy link
Member

@JaGeo JaGeo Jun 6, 2023

Choose a reason for hiding this comment

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

Could we make this -0.1 hard limit a parameter and allow to turn it off and make it adjustable? This is my fault

Have you added tests that this part is working correctly?

Copy link
Contributor Author

@naik-aakash naik-aakash Jun 6, 2023

Choose a reason for hiding this comment

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

I will be adding more tests soon. At the moment this is not checked. I will remove the hard code for minimum limits

Copy link
Member

@JaGeo JaGeo Jun 6, 2023

Choose a reason for hiding this comment

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

Maybe, we can find a more elegant solution that also works for different units. float('inf') maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now limits returned uses float('inf') instead of hardcoded numbers

extremum_based = max(list_icohps) * percentage

if not self.are_coops and not self.are_cobis:
max_here = min(extremum_based, -0.1)
Copy link
Member

@JaGeo JaGeo Jun 6, 2023

Choose a reason for hiding this comment

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

Same here. It would be good if we could change this parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added noise_cutoff parameter

self.add_additional_data_sg = add_additional_data_sg
self.filename_blist_sg1 = filename_blist_sg1
self.filename_blist_sg2 = filename_blist_sg2
self.noise_cutoff = noise_cutoff
Copy link
Member

@JaGeo JaGeo Jun 7, 2023

Choose a reason for hiding this comment

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

Documentation for the noise_cutoff needs to be added :).

Copy link
Member

Choose a reason for hiding this comment

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

btw, could you add your one example case from the db as a test, where the noise-cutoff really made a different?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah will do add it 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @JaGeo , I have added a test case now, that also checks the impact of the noise_cutoff parameter. The example structure is from our database (mp-632319), but apparently, our ICOHP cutoff of 10 %, actually already does not consider Cs-H bonds. So had to reduce the ICOHP cutoff further in tests, to check if the parameter works as intended.

adapt_extremum_to_add_cond: should the extrumum be adapted to the additional condition
additional_condition: additional condition to determine which bonds are relevant
Returns: [-100000, min(max_icohp*0.15,-0.1)]
Returns: [-inf, min(max_icohp*0.15,noise_cutoff)] / [max(max_icohp*0.15, noise_cutoff),inf]
Copy link
Member

@JaGeo JaGeo Jun 7, 2023

Choose a reason for hiding this comment

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

I think you mixed up plus and minus here. It should be -0.1. Currently, it's +0.1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah , will fix this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed the error in doc-string

Copy link
Member

Choose a reason for hiding this comment

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

Maybe put (ICOHP) and (ICOOP, ICOBI) in brackets? Not sure people will directly get the "/". I would also replace "/" with or.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe, we should also say max_abs_icohp. Otherwise, very good :).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed doc-string to strongest_icohp as per your suggestion 😃

@JaGeo
Copy link
Member

JaGeo commented Jun 30, 2023

@naik-aakash , very nice! I have added my tiny suggestion on the documentation and naming (which was initially, of couse, my fault ;))!

@JaGeo
Copy link
Member

JaGeo commented Jun 30, 2023

Ready to be merged from my side! @naik-aakash

@janosh , this is ready to be reviewed! :)

Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

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

Looking good overall. A few suggestions:

  • Best to remove the [WIP] from PR title when review-ready.
  • Do we really need the new 90 KB test_files/cohp/environments/ICOBILIST.lobster.mp_470.gz? How does it differ from existing test files? Can ICOBILIST.lobster.NaCl.gz not be re-used?

Comment on lines 1181 to 1184
if not self.are_coops and not self.are_cobis:
extremum_based = min(list_icohps) * percentage
else:
extremum_based = max(list_icohps) * percentage
Copy link
Member

Choose a reason for hiding this comment

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

This code is repeated 5 times. Maybe turn into a function. Could definitely be made more concise:

Suggested change
if not self.are_coops and not self.are_cobis:
extremum_based = min(list_icohps) * percentage
else:
extremum_based = max(list_icohps) * percentage
which_extr = min if not self.are_coops and not self.are_cobis else max
extremum_based = which_extr(list_icohps) * percentage

Copy link
Contributor Author

@naik-aakash naik-aakash Jul 12, 2023

Choose a reason for hiding this comment

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

This code is repeated 5 times. Maybe turn into a function. Could definitely be made more concise:

Thanks for this suggestion . I have implemened a method for this based on your suggestion.

@naik-aakash naik-aakash changed the title [WIP] extending lobsterenv for coop/cobi Extend lobsterenv for coop/cobi Jul 12, 2023
@naik-aakash
Copy link
Contributor Author

Looking good overall. A few suggestions:

  • Best to remove the [WIP] from PR title when review-ready.
  • Do we really need the new 90 KB test_files/cohp/environments/ICOBILIST.lobster.mp_470.gz? How does it differ from existing test files? Can ICOBILIST.lobster.NaCl.gz not be re-used?

I included the ICOBILIST.lobster.mp_470.gz as it has a bit different structure type and just wanted to check if it works as intended. I hope this is fine. If not am happy to remove this file and associated tests.

@naik-aakash
Copy link
Contributor Author

naik-aakash commented Jul 12, 2023

Hi @janosh , I think this should be ready to be merged if all seems fine to you.

Also, it would be great, it the contributors list could be updated. I have filled out the form on the website several times, but so far it does not seem to work for me

@naik-aakash naik-aakash requested a review from janosh July 24, 2023 08:19
@janosh janosh merged commit 5bdc1ca into materialsproject:master Jul 24, 2023
@janosh
Copy link
Member

janosh commented Jul 24, 2023

Sorry for the delay @naik-aakash, this seems to have gotten lost in my inbox.

@janosh janosh added enhancement A new feature or improvement to an existing one io Input/output functionality labels Jul 24, 2023
@naik-aakash
Copy link
Contributor Author

Sorry for the delay @naik-aakash, this seems to have gotten lost in my inbox.

No worries. I suspected this happened, as you are working constantly on so many tasks. It is totally fine and thanks again 😃

@naik-aakash naik-aakash deleted the cobi_coop_lobsterenv_extend branch January 10, 2024 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature or improvement to an existing one io Input/output functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants