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

Restart file collection + POD training #216

Closed
wants to merge 30 commits into from
Closed

Conversation

siuwuncheung
Copy link
Member

@siuwuncheung siuwuncheung commented Dec 5, 2023

This PR implements the restart file collection for libROM snapshot/POD matrix generation. This PR also includes some groundworks for overall ROM workflow.

libROM snapshot generation at FOM simulation

If ROM.offline.save_librom_snapshot is set true, then the offline FOM simulation will generate libROM snapshot matrix files with ct.md_print_filename + "_mdstep" + std::to_string(mdstep) + "_orbital" + "." + std::to_string(rank), e.g.,
MD_mdstep1_snapshot.000000.

The libROM snapshot files will be generated at (md_iteration_ % ct.checkpoint) == 0.

ROM workflow main driver rom_main.cc and ROM workflow routines

  • rom_main.cc will handle the entire workflow of ROM. Currently, only the restart file collection + POD training is implemented.
  • The ROM workflow routines will be implemented in src/rom_workflows.h and src/rom_workflows.cc.
    • The restart file collection + POD training is implemented as readRestartFiles.
    • This does not require saving libROM snapshot file at offline FOM simulation. The standard mgmol restart files can be used for POD basis generation.

MGmol<OrbitalsType>::loadOrbitalFromRestartFile

MGmol<OrbitalsType>::loadOrbitalFromRestartFile reads the data from a restart file and generates a new OrbitalsType class.

  • Currently in the main workflow, the loading process of a restart file is spread out throughout the entire workflow, not in a single routine.
  • While OrbitalsType::read_func_hdf5 reads the wavefunction from the restart file, further manipulation is required with additional routines, at least the extrapolation if used.
  • For the sake of safety, loadOrbitalFromRestartFile used most routines that are used if (ct.restart_info > 2).

Option description separated

  • all the options described in src/main.cc are now moved into a separate header tools/OptionDescription.h. The ROM driver src/rom_main.cc shares the same option parsing routines.

ROM-related options/controls

  • Control class has the ROM-related options all packed into one member variable ROMPrivateOption rom_pri_options. This member variable is private in order to prevent changes from outside.
  • src/rom_Control.h will contain all enumeration/options related to ROM workflow.

Pointer initialization

Minor changes

  • Carbyne example is added.
  • potential file is cherry-picked from the PR Add pseudo.C_ONCV_PBE_SG15 #222 .
  • src/mgmol_config.h.in generates a compile-time header file, which has the libROM flag MGMOL_HAS_LIBROM. mgmol can be installed with/without libROM.
  • src/tools/Signal_mgmol.h -> src/tools/mgmol_Signal.h

siuwuncheung and others added 2 commits November 7, 2023 16:08
* add libROM to CMakelists.txt

* Add shell_script

* Minor changes

* Add module file
* Update script to analyze forces on constraints

* initial ci workflow files.

* default branch name release.

* create build directory for compilation.

* minor fix

---------

Co-authored-by: Jean-Luc Fattebert <[email protected]>
@siuwuncheung siuwuncheung marked this pull request as draft April 5, 2024 16:50
@siuwuncheung siuwuncheung self-assigned this Apr 9, 2024
dreamer2368 and others added 11 commits April 9, 2024 08:40
* changed the Signal.h header file name.

* additional routine to find scalapack library, if nothing is found.

* ci workflow with test and format

* changed branch name

* ctest verbose

* added --oversubscribe to cmake MPIEXEC_PREFLAGS variable.

* parallel hdf5 package fix. also librom is included.

* ci workflow only checks the first 20 tests.

* minor fix

* rom-fpmd driver and librom dependency in cmake. librom must be compiled before mgmol cmake.

* cmake fix and toolchain file for LC quartz.

* bug fix on FindSCALAPACK.cmake

* librom-mgmol installation script for LC quartz.
@dreamer2368
Copy link
Collaborator

dreamer2368 commented Apr 19, 2024

@jeanlucf22 , this PR is still work-in-progress, but I'd like to ask you to review one function I drafted: MGmol<OrbitalsType>::loadOrbitalFromRestartFile. The function is defined in line 689 of src/md.cc.

The main intention with this function is to load wavefunctions from an existing restart file. Once the wavefunction data is loaded, we could convert/store the data into libROM matrix. This function will be called at least after MGmol<OrbitalsType>::setup.

Although, I'm not confident whether I put all the necessary routines in this function. Ultimately I should set up a unit test for this, but I just wanted to check with you if I missed something important or did not use some routines properly.

@jeanlucf22
Copy link
Collaborator

@jeanlucf22 , this PR is still work-in-progress, but I'd like to ask you to review one function I drafted: MGmol<OrbitalsType>::loadOrbitalFromRestartFile. The function is defined in line 689 of src/md.cc.

The main intention with this function is to load wavefunctions from an existing restart file. Once the wavefunction data is loaded, we could convert/store the data into libROM matrix. This function will be called at least after MGmol<OrbitalsType>::setup.

Although, I'm not confident whether I put all the necessary routines in this function. Ultimately I should set up a unit test for this, but I just wanted to check with you if I missed something important or did not use some routines properly.

Look at

int ExtendedGridOrbitals::read_func_hdf5(

This function loads the wavefunctions from an HDF5 file for the case OrbitalsType=ExtendedGridOrbitals. Would that fill your needs?

@dreamer2368 dreamer2368 changed the title Writing wavefunction snapshots Restart file collection + POD training Apr 20, 2024
@dreamer2368 dreamer2368 marked this pull request as ready for review April 20, 2024 00:47
@dreamer2368 dreamer2368 marked this pull request as draft April 20, 2024 00:49
@dreamer2368 dreamer2368 marked this pull request as ready for review April 22, 2024 20:38
@dreamer2368
Copy link
Collaborator

This PR is rebased and replaced by a series of PRs #226, #228, #229 and #230.

@dreamer2368 dreamer2368 closed this May 2, 2024
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