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

M3SOSCF Implementation #47

Merged
merged 5 commits into from
May 11, 2024
Merged

M3SOSCF Implementation #47

merged 5 commits into from
May 11, 2024

Conversation

LinusBDittmer
Copy link
Contributor

This is an implementation of the Markovian Multiagent Monte-Carlo SOSCF based on CIAH. It is a powerful, albeit slow SCF algorithm that enables near-guaranteed convergence even in extremely difficult systems.

Publication: https://doi.org/10.1063/5.0159737

See also PR#2208 in pyscf/pyscf.

pyscf/scf/hf.py Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

This file is the same as that in the main PySCF repository. You should not copy those files into this repository. Instead, you should import this file using the appropriate method from the main PySCF directory.

Copy link
Contributor Author

@LinusBDittmer LinusBDittmer May 9, 2024

Choose a reason for hiding this comment

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

I added a decorated to the SCF base class in hf.py that allows for the creation of an M3SOSCF object analogously to the CIAH implementation (line 1927 ff). Should I add this differently, and if so, what specifications should I follow?

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe so otherwise there will be import clashes. That is, when someone does

import pyscf.scf.hf

or

from pyscf.scf import hf

It is somewhat undefined which hf.py to import, that from pyscf or from pyscf-forge. I am not sure the best way of doing this to get the desired result. This is because pyscf-forge is built such that it doesn't really modify the internal structure of classes from pyscf. One could get around this by constructing a new SCF object that inherits the SCF object from pyscf/pyscf/scf/hf.py but then adds on the m3soscf method. This would again have to be implemented such that there are no import conflicts from the main repo though.

Copy link
Contributor

Choose a reason for hiding this comment

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

One possibility, but this is more of a general design decision for pyscf-forge, is to place all of your new code in a subfolder m3soscf. This would prevent import clashes as the hf.py would be in pyscf.m3soscf.scf.hf instead. But in general, I am not sure of the correct way of doing this for this project.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suggest that I remove hf.py for now, as there still is a straightforward constructor without it instead. If an M3SOSCF implementation is merged into pyscf proper, the decorator can still be added.

@@ -0,0 +1,128 @@
#!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

Update copyright to 2024

@@ -0,0 +1,13 @@
# Copyright 2014-2018 The PySCF Developers. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

Update Copyright to 2024

@@ -0,0 +1,858 @@
'''
Copy link
Contributor

Choose a reason for hiding this comment

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

Add copyright comment banner.

@@ -0,0 +1,32 @@
'''
Copy link
Contributor

Choose a reason for hiding this comment

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

Add copyright banner

@matthew-hennefarth
Copy link
Contributor

Can you please add an example of this functionality.

@LinusBDittmer
Copy link
Contributor Author

An example has been added in examples/scf. Copyright banners have been updated/added.

Copy link
Contributor

Choose a reason for hiding this comment

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

This file should be deleted since it will cause import clashes later on down the line with that in the main branch.

@LinusBDittmer
Copy link
Contributor Author

soscf/init.py as well as scf/hf.py have been removed. Since there are no other files in scf/, I have removed the directory entirely.

@matthew-hennefarth
Copy link
Contributor

It should be good so long as all tests pass, @sunqm can you please approve for the workflows?

@LinusBDittmer
Copy link
Contributor Author

I still had the old import statements from developing inside a forked repo of pyscf proper, I changed these to work for pyscf-forge.

@sunqm
Copy link
Contributor

sunqm commented May 11, 2024

It should be good so long as all tests pass, @sunqm can you please approve for the workflows?

Thank you for reviewing the PR code!

@sunqm sunqm merged commit c6b8aef into pyscf:master May 11, 2024
2 checks passed
@LinusBDittmer
Copy link
Contributor Author

@matthew-hennefarth Thank you for the review. @sunqm Is there anything I can do, any information I can provide, regarding possible discussion on whether this feature will be merged into the main branch of PySCF?

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.

3 participants