-
Notifications
You must be signed in to change notification settings - Fork 28
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
Spin adapted dsrg #182
Spin adapted dsrg #182
Conversation
Codecov Report
@@ Coverage Diff @@
## master #182 +/- ##
==========================================
+ Coverage 64.1% 66.09% +1.98%
==========================================
Files 171 189 +18
Lines 40573 43638 +3065
==========================================
+ Hits 26010 28841 +2831
- Misses 14563 14797 +234
Continue to review full report at Codecov.
|
@henankf223 @fevangelista This PR is not ready because the actual spin-adapted DSRG is not yet implemented. However, I made changes to ActiveSpaceSolver and RDMs to average spin multiplets. Now, the spin-integrated DSRG code should be able to handle any spin cases by setting |
@lcyyork: thanks! I will download a copy and start to go over it! |
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.
This looks very good. I think that we should have it tested for a bit before adopting it just to make sure all works well together. Any concerns on your part or things that remain to be done?
docs/sphinx/methods/dsrg.rst
Outdated
:: | ||
|
||
correlation_solver sa-mrdsrg # spin-adapted DSRG computation | ||
spin_avg_density true # must use spin-averaged densities |
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.
Could we get rid of the variable spin_avg_density
? At least we should have logic to enforce that when sa-mrdsrg
is set then spin_avg_density = True
.
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.
OK, let me work on it.
@@ -270,7 +274,11 @@ def compute_dsrg_unrelaxed_energy(correlation_solver_type, rdms, scf_info, optio | |||
ints, mo_space_info, Ua, Ub): | |||
Heff_actv_implemented = False | |||
|
|||
if correlation_solver_type == "MRDSRG_SO": | |||
if correlation_solver_type == "SA-MRDSRG": |
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.
Here is a good spot for testing that spin_avg_density
is set to true.
} | ||
print_energies(state_energies_map_); | ||
return state_energies_map_; | ||
} | ||
|
||
void ActiveSpaceSolver::print_energies(std::map<StateInfo, std::vector<double>>& energies) { | ||
print_h2("Energy Summary"); | ||
psi::outfile->Printf("\n Multi. Irrep. No. Energy"); | ||
std::string dash(41, '-'); | ||
psi::outfile->Printf("\n Multi.(ms) Irrep. No. Energy"); |
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 M_S? If yes we can just replace
psi::outfile->Printf("\n Multi.(ms) Irrep. No. Energy"); | |
psi::outfile->Printf("\n M_S Irrep. No. Energy"); |
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.
No, there are two values here. One is for multiplicity (i.e., Multi.) and the other is for MS that is in the parentheses.
std::string dash(ltotal, '-'); | ||
psi::outfile->Printf("\n Irrep. Multi. Nstates"); | ||
psi::outfile->Printf("\n Irrep. Multi.(ms) N"); |
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.
M_S?
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.
Same as the last one.
have_L3bbb_ = true; | ||
} | ||
return L3bbb_; | ||
} | ||
|
||
ambit::Tensor RDMs::SFg2() { |
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.
Can you give the precise definition of what this returns in the header file?
/// @return the beta-beta-beta 3-RDM | ||
ambit::Tensor g3bbb() const { return g3bbb_; } | ||
ambit::Tensor g3bbb(); | ||
|
||
// Spin-free RDMs | ||
|
||
/// @return the spin-free 2-RDM |
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.
Here add definition of what does this return.
}; | ||
|
||
/** |
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.
This is great!
|
||
namespace forte { | ||
|
||
class DSRG_MEM { |
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.
Can this be used for other codes? If it can then let's not be specific (DSRG). It might be nice to start it outside of the DSRG codes. However, this might not play well with python.
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.
This class is just for memory inspection before any actual DSRG computation. So this class might be useful for other dynamical correlation solver.
#include "base_classes/mo_space_info.h" | ||
|
||
namespace forte { | ||
|
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.
What does this class do?
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.
This class is created to check/print the memory usage before any real DSRG computation. Different DSRG levels have different memory requirement and it is useful to terminate the job if it lacks of memory.
Basically the user sets the max memory available and a map of the space character to its size (e.g., 'c': 20, 'a': 4, 'v': 80, 'h': 24, 'p': 84, 'g': 104).
Take LDSRG(2) as an example. It stores F, V, T1, T2, Hbar1, Hbar2, and other intermediates. To compute the memory usage of T1 and T2, the user can add_entry
and pass the name and the labels: add_entry("T1 and T2 amplitudes", {"hp", "hhpp"});
. This will be computed as 8 * (24 * 84 + 24 * 24 * 84 * 84), which will be subtracted from the max available memory.
To indicate two sets of global intermediates used in LDSRG(2) both of sizes g^2 + g^4, the uset can say add_entry("Global intermediates", {"gg", "gggg"}, 2);
.
Besides global memory usage, there are also local usage. In this case, the max local memory usage will be the bottleneck. To add a local memory usage, use add_entry("Local storage for S1 and S2 amplitudes", {"hp", "hhpp"}, 1, false);
The print
function will print all passed-in entries in a table and terminate the job if the global memory plus the max local memory is greater than the max available set by the user.
apply a suggestion from code review Co-Authored-By: fevangelista <francesco.evangelista@gmail.com>
…/forte into spin-adapted-dsrg
the user should specify the following keyword: | ||
:: | ||
|
||
spin_avg_density true # use spin-summed reduced density matrices |
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 obsolete now? If it is, it might still be a good idea to mention it somewhere, either here or in a section on active space solvers.
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.
BTW, how do you feel about moving our manual to jupyter?
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.
No, it is not obsolete. It shows the user should specify this keyword to run jobs with even multiplicities using the spin integrated code. I will emphasize this using bold font.
I am OK to move them to Jupyter but not sure what the benefit is. I assume they will still be markdown in Jupyter.
@lcyyork: can you run the full test suite and make sure everything works? |
@fevangelista All tests pass on my computer. |
Description
Spin-adapted DSRG implementation.
User Notes
ActiveSpaceSolver
.RDMs
andActiveSpaceSolver
classes.The spin-adapted DSRG code is arranged in the following way:
Checklist
mrdsrg-spin-adapted
,mrdsrg-spin-adapted-pt2
, andmrdsrg-spin-adapted-pt3
.TODOs