Skip to content

Conversation

@TiborGY
Copy link
Contributor

@TiborGY TiborGY commented Dec 17, 2023

Description

This PR aims to make a lot of tiny improvements to libmoinfo.
While trying to modernize a bit of libmoinfo code to eliminate some (ab)use of the Dimension functions deprecated by PR #2953 I had to try to get at least some grip on what-does-what, but libmoinfo has accumulated some clutter which made that harder than necessary.
One thing led to another, and now this PR is here to hopefully make it easier for the next person.
Docstring addition and more are the subject of a future PR.

User API & Changelog headlines

  • No user-facing changes

Dev notes & details

  • Removed a some unused macro definitions, inlined the single use of #define size_det
  • Removed std::vector<size_t> ioff, its getter function, and initialization from MOInfoBase. It looks like this 5 M element array was getting non-trivially initialized every time an MOInfoBase object (or one derived from it) was constructed. RAM usage of these objects should now be 40 MB lower, and their construction should be faster by an unknown amount.
  • Removed some class declarations, included the appropriate .h instead where required instead of them (Note: some of this was reverted after reviews, see discussion on this PR.)
  • Touched-up what-includes-what, along the lines of removing what is not required, but adding what is
  • Removed declarations for tuning() and read_mo_spaces2(), as they are never defined
  • Removed some getters from MOInfo, either unused or already defined in the base class.
  • Removed unused fn MOInfoBase::get_irr_labs()
  • Renamed MOInfoBase::get_irr_labs(int i) to get_irr_lab, as it only gets one label. Rename propagated to all of its call sites.
  • Removed unused fn MOInfoBase::get_scf_mos(int i)
  • Moved the intvec and boolvec typedefs from global namespace, to namespace psi. Also modernized them to the using syntax.
  • Removed an unused extern ModelSpace* model_space declaration which was cluttering namespace psi
  • Replaced exit(PSI_RETURN_FAILURE) and exit(1) with throw PSIEXCEPTION Obviated by PR Do not call exit #3118

Checklist

  • No new features
  • Tests run by the CI were passing, but now they are failing for unclear reasons

Status

  • Ready for review
  • Ready for merge

@TiborGY TiborGY changed the title Clean up #includes, macros, some error exits, and other miscellaneous things in libmoinfo Clean up #includes, macros, unnecessary array init, error exits, and other miscellaneous things in libmoinfo Dec 20, 2023
@TiborGY TiborGY marked this pull request as ready for review December 21, 2023 16:48
Copy link
Member

@loriab loriab left a comment

Choose a reason for hiding this comment

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

Besides the forward decl issue, this looks reasonable to me. These are FAE modules, though, so will seek input. Thanks for the modernization!

@loriab loriab requested a review from fevangelista March 22, 2024 22:51
@fevangelista
Copy link
Contributor

Thank you for making these improvements! This code was written before C++11 so it's really old style. I've left some comments here and there for things that need to be taken care.


public:
typedef std::bitset<size_det> bitdet;
typedef std::bitset<2048> bitdet; // adjust based on "size det"?
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to double check: was size_det used only here? It might be a good idea to make this a static constant expression in the class SlaterDeterminant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this was the only hit for size_det in the entire repo. I have also searched for 2048 to check for things assuming this size, and found nothing. So having it "inline" like this seems like the most straightforward solution.

@TiborGY TiborGY force-pushed the libmoinfo_preproc branch 4 times, most recently from b0f64ac to 6bd09e7 Compare April 5, 2024 18:24
TiborGY and others added 21 commits April 8, 2024 19:22
(cherry picked from commit c11e558)
(cherry picked from commit 18c3471)
…e defined in the base class

(cherry picked from commit c860f06)
(cherry picked from commit 4762398)
… its keywords do not clutter the entire psi namespace
… so that its keywords do not clutter the entire psi namespace"

This reverts commit 27b9178.
Lori's suggestion

Co-authored-by: Lori A. Burns <[email protected]>
(cherry picked from commit 180b8c4)
…ses instead of including liboptions.h and wavefunction.h
…l_space_build.cc have to include moinfo.h again
@TiborGY TiborGY force-pushed the libmoinfo_preproc branch from bff3d39 to d55aae5 Compare April 8, 2024 17:22
@loriab loriab requested a review from fevangelista April 8, 2024 19:14
@loriab loriab added this to the Psi4 1.10 milestone Apr 8, 2024
@loriab loriab added this pull request to the merge queue Apr 8, 2024
Merged via the queue into psi4:master with commit 884f778 Apr 8, 2024
@TiborGY TiborGY mentioned this pull request Apr 25, 2024
20 tasks
@loriab loriab mentioned this pull request Jan 8, 2025
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