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

Refactoring by p #72

Merged
merged 20 commits into from
Apr 3, 2024
Merged

Refactoring by p #72

merged 20 commits into from
Apr 3, 2024

Conversation

prtos
Copy link
Contributor

@prtos prtos commented Mar 29, 2024

Fixes #65.

Checklist:

  • Was this PR discussed in a issue? It is recommended to first discuss a new feature into a GitHub issue before opening a PR.
  • Add tests to cover the fixed bug(s) or the new introduced feature(s) (if appropriate).
  • Update the API documentation is a new function is added or an existing one is deleted.

@prtos prtos changed the base branch from main to develop March 29, 2024 18:52
@prtos prtos requested review from FNTwin and shenoynikhil and removed request for FNTwin and shenoynikhil March 29, 2024 18:52
Copy link
Collaborator

@FNTwin FNTwin left a comment

Choose a reason for hiding this comment

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

There is a missing file.
I really like the Enum adaptation of the level of theory.
Currently the branch doesn't pass most of the actions so it need some fixes.

@@ -61,7 +48,7 @@ def data_types(self):
}

def __getitem__(self, idx: int):
shift = IsolatedAtomEnergyFactory.max_charge
shift = MAX_CHARGE
Copy link
Collaborator

Choose a reason for hiding this comment

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

For the interaction dataset we don't really need the Isolated Atom Energies so we can rework the getitem method in case

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 code just give zeros isolated atom energies for all the interaction methods

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think all the Enums should be in a standalone python file enums.py



class PotentialMethod(QmMethod): #SPLIT FOR INTERACTIO ENERGIES AND FIX MD17
B1LYP_VWN5_DZP = Functional.B1LYP_VWN5, BasisSet.DZP, 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

While we can do more analysis on the cost of the methods, we can just have already a scale of cost with 0 being a SE, 1 DFT, 2 CCSD etc

B3LYP_VWN5 = "b3lyp(vwn5)"
B3LYP_S_VWN5 = "b3lyp*(vwn5)"
B3LYPD = "b3lyp-d"
B3LYP_D3_BJ = "b3lyp-d3(bj)"
Copy link
Collaborator

Choose a reason for hiding this comment

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

As we are adding more structure I think we should separate the corrections from the functionals?

Example:
B3LYP_D3_BJ is a B3LYP functional with a dispersion correction (d3) + Becke Johnson damping (bj) correction

Comment on lines 12 to 14
with open(os.path.join(os.path.dirname(__file__), "atom_energies.txt")) as fd:
atom_energy_collection = ast.literal_eval(fd.read())
atom_energy_collection = {k.lower():v for k, v in atom_energy_collection.items()}
Copy link
Collaborator

Choose a reason for hiding this comment

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

"atom_energies.txt" file is currently missing.
Also, maybe json is easier to extend with new values?

Comment on lines +12 to +17
# def test_is_at_factory():
# res = IsolatedAtomEnergyFactory.get("mp2/cc-pvdz")
# assert len(res) == len(ISOLATED_ATOM_ENERGIES["mp2"]["cc-pvdz"])
# res = IsolatedAtomEnergyFactory.get("PM6")
# assert len(res) == len(ISOLATED_ATOM_ENERGIES["pm6"])
# assert isinstance(res[("H", 0)], float)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The tests shouldn't be disabled but adapted

from openqdc.methods.atom_energies import atom_energy_collection, to_e_matrix


class QmType(StrEnum):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where are we planning to use this Enum?



class QmType(StrEnum):
FF = "Empirical Force Field"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just Force Field is enough

@shenoynikhil
Copy link
Collaborator

Just ran the pre-commit in my previous commit. @prtos If you push the atomic_energies.txt, the tests should run ideally.

Comment on lines +46 to +65
# "sapt0/jun-cc-pV(D+d)Z_unscaled", #TODO: we need to pick the unscaled version only here
# "sapt0/jun-cc-pV(D+d)Z_es_unscaled",
# "sapt0/jun-cc-pV(D+d)Z_ex_unscaled",
# "sapt0/jun-cc-pV(D+d)Z_ind_unscaled",
# "sapt0/jun-cc-pV(D+d)Z_disp_unscaled",
# "sapt0/jun-cc-pV(D+d)Z_scaled",
# "sapt0/jun-cc-pV(D+d)Z_es_scaled",
# "sapt0/jun-cc-pV(D+d)Z_ex_scaled",
# "sapt0/jun-cc-pV(D+d)Z_ind_scaled",
# "sapt0/jun-cc-pV(D+d)Z_disp_scaled",
# "sapt0/aug-cc-pV(D+d)Z_unscaled",
# "sapt0/aug-cc-pV(D+d)Z_es_unscaled",
# "sapt0/aug-cc-pV(D+d)Z_ex_unscaled",
# "sapt0/aug-cc-pV(D+d)Z_ind_unscaled",
# "sapt0/aug-cc-pV(D+d)Z_disp_unscaled",
# "sapt0/aug-cc-pV(D+d)Z_scaled",
# "sapt0/aug-cc-pV(D+d)Z_es_scaled",
# "sapt0/aug-cc-pV(D+d)Z_ex_scaled",
# "sapt0/aug-cc-pV(D+d)Z_ind_scaled",
# "sapt0/aug-cc-pV(D+d)Z_disp_scaled",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we get rid of these comments if there energy values aren't being used.

from openqdc.methods.atom_energies import atom_energy_collection, to_e_matrix


class QmType(StrEnum):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is QmType the right word for this Enum? Given that there are Force Fields, Semi-Empirical keys under this.

Comment on lines 482 to 484
if __name__ == "__main__":
for method in PotentialMethod:
(str(method), len(method.atom_energies_dict))
Copy link
Collaborator

@shenoynikhil shenoynikhil Apr 1, 2024

Choose a reason for hiding this comment

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

I would suggest not having this __main__ code here, maybe you added this for testing. We can have a separate test for iterating through potential method?

Copy link
Collaborator

@shenoynikhil shenoynikhil left a comment

Choose a reason for hiding this comment

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

Minor comments, should be go to go if (necessary) tests are added and all tests pass. Just make sure to run pre-commit before you commit.

Just a 1 time cost,

  • pre-commit install (to setup)
  • pre-commit run --all-files

The next time you add and try to commit, this will automatically run.

@FNTwin FNTwin changed the base branch from develop to release April 2, 2024 16:48
FNTwin and others added 3 commits April 3, 2024 13:16
py3.8 compatibility, manual fixes to atom energies, pkgutils + fixes on gh action tests
This was linked to issues Apr 3, 2024
@FNTwin FNTwin merged commit 9574974 into release Apr 3, 2024
5 checks passed
@FNTwin FNTwin deleted the refactoring_by_P branch April 23, 2024 12:12
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.

Standardize Level of Theory Optimize Atomization Energies
3 participants