-
-
Notifications
You must be signed in to change notification settings - Fork 645
fixing frozen for FNO #2021
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
base: master
Are you sure you want to change the base?
fixing frozen for FNO #2021
Conversation
nvir_act=nvir_act) | ||
if len(frozen) == 0: frozen = None | ||
pt_no = mp.MP2(mf, frozen=frozen, mo_coeff=no_coeff).set(verbose=0).run() | ||
pt_no = mp.MP2(mf, frozen=frozen, mo_coeff=no_coeff).set(verbose=2).run() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should verbosity level be taken from mol/cell instance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Hong-Zhou! I have only added some high level comments. I have not tested this or more carefully read through.
pct_occ : float | ||
Percentage of total occupation number. Default is None. If present, overrides `thresh`. | ||
pvir_act : float | ||
Percentage of total number of virtuals (ceiling is taken to get an integer number). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this "Percentage of number of virtual NOs to keep" or something else? (I'm comparing this to the comment below "nvir_act").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "Percentage of total occupation number" is called pct_occ
. pvir_act
doesn't use that naming convention (no "pct") but follows nvir_act
(which makes sense but might be a little bit inconsistent) <- minor comment.
Percentage of total number of virtuals (ceiling is taken to get an integer number). | ||
Default is None. If present, overrides `thresh` and `pct_occ`. | ||
nvir_act : int | ||
Number of virtual NOs to keep. Default is None. If present, overrides `thresh` and `pct_occ`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does nvir_act
override pvir_act
, too? It starts getting a little bit tricky to distinguish the keywords here and what takes priority. Some sort of overview sentence comparing them might be helpful.
from pyscf import mp | ||
pt = mp.MP2(mf).set(verbose=0).run() | ||
frozen, no_coeff = pt.make_fno(thresh=thresh, pct_occ=pct_occ, nvir_act=nvir_act) | ||
frozen = numpy.hstack([numpy.arange(frozenocc),frozen]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a comment in the docstring how frozen
passed by the user is being used?
|
||
def make_fno(mp, thresh=1e-6, pct_occ=None, nvir_act=None, t2=None): | ||
def make_fno(mp, thresh=1e-6, pct_occ=None, pvir_act=None, nvir_act=None, t2=None): | ||
r''' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous review comments
idx = numpy.argsort(n)[::-1] | ||
n,v = n[idx], v[:,idx] | ||
pct_occ_sum = numpy.cumsum(n/numpy.sum(n)) | ||
numpy.set_printoptions(threshold=nmo) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be added as an option to log
since this is about how the logging should be done and might apply to other parts of pyscf? Or is this a special case?
@verena-neufeld Thanks for the comments! There are things in the MP2 module that I need to fix first (mostly handle user input mean-field through |
In a previous PR (#1893), the
frozen
variable in FNOCCSD was not used in the full-system MP2 calculation. As a result,Both problems are fixed in this PR. The
make_fno
function in MP2/UMP2 now supports generalfrozen
pattern. The unit tests are updated for frozen-core tests. New tests for a UHF reference are added.A new input argument
pvir_act
is added to select active NOs by the percentage of total number of virtuals (which is used in literature, see e.g., J. Chem. Phys. 128, 164101, 2008). New tests are added for all strategies of choosing active NOs.@sunqm The reason why previous tests not passing is likely because the reference values were generated using all-e potential while the tests themselves used a pseudopotential (likely a copy-paste error when I wrote the test file). Once I turned off the pseudopotential, all tests that do not use
frozen
(thus not affecting by this PR) can pass.