Skip to content
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
1ad1292
Fix EnergyAndForces tests (#277)
jeanlucf22 Sep 26, 2024
8ac6cd6
Move factor 4pi out og linear solvers (#278)
jeanlucf22 Sep 30, 2024
a2ece1a
Move some code into PoissonSolverFactory (#279)
jeanlucf22 Sep 30, 2024
8b577ea
Clean up class Potentials (#280)
jeanlucf22 Oct 3, 2024
7ac691c
Clean up class Ions, add test for it (#281)
jeanlucf22 Oct 12, 2024
c05ba7f
Add test MD_MVP (#290)
jeanlucf22 Nov 25, 2024
bb8051d
Clean up code related to DM restart data (#292)
jeanlucf22 Dec 2, 2024
a227c04
Write dm (#291)
jeanlucf22 Dec 2, 2024
b263532
Remove unused function in Control (#294)
jeanlucf22 Dec 23, 2024
3eb52d6
Change symlink to restart in tests (#295)
jeanlucf22 Jan 3, 2025
c1d46bc
Extract number empty orbitals from restart file (#296)
jeanlucf22 Jan 7, 2025
eb53963
Clean up MD_IonicStepper restart data write (#297)
jeanlucf22 Jan 16, 2025
857673f
Clean up code based on compiler warnings (#299)
jeanlucf22 Jan 17, 2025
f294d3c
Add getForces for evaluateDMandEnergyAndForces (#300)
siuwuncheung Jan 23, 2025
98a79de
Add check for compatibility MVP/Mehrstellen (#301)
jeanlucf22 Jan 24, 2025
8eda83e
Add support for Br atom (#302)
jeanlucf22 Feb 3, 2025
f298d43
Clean up some HDFrestart functions (#303)
jeanlucf22 Feb 11, 2025
c690bc5
Fix and test restart single hdf5 file (#305)
jeanlucf22 Feb 17, 2025
9f1fc20
Save Hartree potential for write in restart file (#306)
jeanlucf22 Feb 17, 2025
a697518
Merge branch 'release' into merge_release_20250219
siuwuncheung Feb 19, 2025
518ef00
Add commit number temporarily
siuwuncheung Feb 19, 2025
82abde5
Fix merge
siuwuncheung Feb 19, 2025
8a1cf05
Speed-up recently added tests (#309)
jeanlucf22 Feb 19, 2025
8a26879
Encapsulate some functions in Potentials (#310)
jeanlucf22 Feb 20, 2025
59b79e7
Remove confusing 0 in naming restart files (#308)
jeanlucf22 Feb 20, 2025
1d3a202
Move geometric transforms to tools in library
siuwuncheung Feb 20, 2025
16a818a
Add functionalities for extra info in restart file (#312)
jeanlucf22 Feb 20, 2025
bd8393a
Add ROM MVP solver to MD
siuwuncheung Feb 21, 2025
e4b1aca
Changes to scripts
siuwuncheung Feb 21, 2025
77bd87e
MPI abort (#313)
jeanlucf22 Feb 21, 2025
c03edd7
Merge branch 'ROMFPMD' into PinnedH2O_3DOF_MD
siuwuncheung Feb 21, 2025
bfdc87b
Partial updates
siuwuncheung Feb 21, 2025
8b84de4
Rho and VH restart (#311)
jeanlucf22 Feb 24, 2025
80eb952
Attempt to fix bugs
siuwuncheung Feb 25, 2025
876e71f
Fix config file
siuwuncheung Feb 25, 2025
0ee185a
Debug
siuwuncheung Feb 25, 2025
c56463c
Debug
siuwuncheung Feb 25, 2025
d5588db
Debug
siuwuncheung Feb 25, 2025
f2acc8a
Debug
siuwuncheung Feb 27, 2025
8003d70
Strenghten testIons (#315)
jeanlucf22 Mar 4, 2025
4efb34c
More clean up in class Potentials (#316)
jeanlucf22 Mar 4, 2025
9a4c361
Fix ROM stage
siuwuncheung Mar 10, 2025
32ae101
Debug
siuwuncheung Mar 11, 2025
964139c
Add initialization to evaluateDMandEnergyandForces if it is ROM MVP
siuwuncheung Mar 12, 2025
2f511b7
Misc code fixes (#317)
jeanlucf22 Mar 14, 2025
45a2c80
Use unique restart filenames in test HDF5single (#318)
jeanlucf22 Mar 14, 2025
b6cf162
Swap ions in existing test (#319)
jeanlucf22 Mar 15, 2025
7fbfe13
Code clean up (#320)
jeanlucf22 Mar 17, 2025
6a1d55e
Pass by reference
siuwuncheung Mar 19, 2025
c67e63f
Make global version of setForces
siuwuncheung Mar 20, 2025
14eb43f
Added functionalities to set local forces (#321)
jeanlucf22 Mar 21, 2025
c61b48d
Update mixed precision code (#322)
jeanlucf22 Mar 24, 2025
cd796dd
Merge branch 'release' into merge_release_20250324
siuwuncheung Mar 24, 2025
147b76c
Merge branch 'merge_release_20250324' into PinnedH2O_3DOF_MD
siuwuncheung Mar 25, 2025
7e40f79
Merge branch 'ROMFPMD' into PinnedH2O_3DOF_MD
siuwuncheung Mar 25, 2025
867837a
Use new setLocalForce
siuwuncheung Mar 25, 2025
962297e
Write PinnedH2O into original ordering. This is better for MD
siuwuncheung Mar 25, 2025
5d66969
names should be obtained before rotate
siuwuncheung Mar 25, 2025
9c91516
Fixing ion names
siuwuncheung Mar 25, 2025
e37983b
Clean up and fixes Ions (#326)
jeanlucf22 Mar 26, 2025
5c26c0d
Merge branch 'release' into merge_release_20250326
siuwuncheung Mar 26, 2025
c24bc32
Merge branch 'merge_release_20250326' into PinnedH2O_3DOF_MD
siuwuncheung Mar 26, 2025
89630b3
Fixes for build without HDF5P (#324)
jeanlucf22 Mar 26, 2025
e80193b
Fix testRhoVhRestart (#325)
jeanlucf22 Mar 26, 2025
bcad112
Fix a few more issues with class Ions (#328)
jeanlucf22 Mar 26, 2025
214213e
Merge branch 'release' into merge_release_20250326b
siuwuncheung Mar 26, 2025
f8b230d
Merge branch 'merge_release_20250326b' into PinnedH2O_3DOF_MD
siuwuncheung Mar 26, 2025
f464bab
Debugging
siuwuncheung Mar 26, 2025
a78e260
Introduce new constructor for class Ions (#330)
jeanlucf22 Mar 27, 2025
c4817b8
Add cleanup and MGmolInterface (#331)
siuwuncheung Mar 27, 2025
1af25da
Merge branch 'release' into merge_release_20250327
siuwuncheung Mar 28, 2025
713be2b
Merge branch 'merge_release_20250327' into PinnedH2O_3DOF_MD
siuwuncheung Mar 28, 2025
df7e68f
Using new constructor for ROM ions
siuwuncheung Mar 28, 2025
a5f6f3a
Add function to set local forces (#333)
jeanlucf22 Mar 28, 2025
e19a870
Merge branch 'ROMFPMD' into PinnedH2O_3DOF_MD
siuwuncheung Mar 28, 2025
ac6b4fe
Merge branch 'release' into merge_release_20250328
siuwuncheung Mar 28, 2025
cdd20a2
Merge branch 'merge_release_20250328' into PinnedH2O_3DOF_MD
siuwuncheung Mar 28, 2025
6b2b1bf
Use new setLocalForces with positions instead of names
siuwuncheung Mar 28, 2025
e333d54
Cleanup
siuwuncheung Mar 28, 2025
8aaa604
only pe0 prints bondlengths and bondangle
siuwuncheung Mar 28, 2025
6501278
Fix setLocalForces
siuwuncheung Mar 29, 2025
0a7d07c
Updates
siuwuncheung Apr 2, 2025
76ddcd7
Minor changes
siuwuncheung Apr 5, 2025
ee4de23
Auxiliary scripts
siuwuncheung Apr 7, 2025
79869de
Auxiliary script
siuwuncheung Apr 7, 2025
18762b0
Auxiliary scripts
siuwuncheung Apr 7, 2025
1fb9298
fix job scripts
siuwuncheung Apr 7, 2025
0616000
Renaming and adding new test
siuwuncheung Apr 8, 2025
f9297a2
Rename
siuwuncheung Apr 8, 2025
a14db57
Minor change in auxiliary script
siuwuncheung Apr 8, 2025
bdbd282
config files
siuwuncheung Apr 8, 2025
90cbd47
update tests
siuwuncheung Apr 8, 2025
946556a
Minor changes in names
siuwuncheung Apr 8, 2025
7d75678
Merge branch 'ROMFPMD' into PinnedH2O_3DOF_MD
siuwuncheung Apr 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/PinnedH2O/job.basis_1_50
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ setenv OMP_NUM_THREADS 1

set ncpus = 64

set maindir = /p/lustre2/cheung26/mgmol-20241012
set maindir = /p/lustre2/cheung26/mgmol-20250219

setenv LD_LIBRARY_PATH ${maindir}/build_quartz/libROM/build/lib:$LD_LIBRARY_PATH

Expand Down
2 changes: 1 addition & 1 deletion examples/PinnedH2O/job.offline
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ setenv OMP_NUM_THREADS 1

set ncpus = 64

set maindir = /p/lustre2/cheung26/mgmol-20241012
set maindir = /p/lustre2/cheung26/mgmol-20250219

setenv LD_LIBRARY_PATH ${maindir}/build_quartz/libROM/build/lib:$LD_LIBRARY_PATH

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ setenv OMP_NUM_THREADS 1

set ncpus = 64

set maindir = /p/lustre2/cheung26/mgmol-20241012
set maindir = /p/lustre2/cheung26/mgmol-20250219

setenv LD_LIBRARY_PATH ${maindir}/build_quartz/libROM/build/lib:$LD_LIBRARY_PATH

Expand All @@ -25,9 +25,6 @@ set num_md_steps = 50
set basis_file = PinnedH2O_orbitals_basis_${increment_md_steps}_${num_md_steps}

set cfg_rom = mgmol_rom_${increment_md_steps}_${num_md_steps}.cfg
cp $datadir/$cfg_rom .

cp $datadir/coords.in .

ln -s -f $maindir/potentials/pseudo.O_ONCV_PBE_SG15 .
ln -s -f $maindir/potentials/pseudo.H_ONCV_PBE_SG15 .
Expand Down
36 changes: 36 additions & 0 deletions examples/PinnedH2O/job.rom_3DOF
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/tcsh
#SBATCH -N 2
#SBATCH -t 1:00:00
#SBATCH -p pbatch

date

setenv OMP_NUM_THREADS 1
#setenv KMP_DETERMINISTIC_REDUCTION 1

set ncpus = 64

set maindir = /p/lustre2/cheung26/mgmol-20250219

setenv LD_LIBRARY_PATH ${maindir}/build_quartz/libROM/build/lib:$LD_LIBRARY_PATH

set exe = mgmol-opt

cp $maindir/install_quartz/bin/$exe .

set datadir = $maindir/examples/PinnedH2O

set bondlength_num_increments = 2
set bondangle_num_increments = 2
set num_basis = 34

set cfg_rom = mgmol_rom_3DOF_${bondlength_num_increments}_${bondangle_num_increments}_${num_basis}.cfg

ln -s -f $maindir/potentials/pseudo.O_ONCV_PBE_SG15 .
ln -s -f $maindir/potentials/pseudo.H_ONCV_PBE_SG15 .

source $maindir/scripts/modules.quartz

srun -n $ncpus $exe -c $cfg_rom -i coords.in > PinnedH2O_rom_3DOF_${bondlength_num_increments}_${bondangle_num_increments}_${num_basis}.out

date
4 changes: 3 additions & 1 deletion examples/PinnedH2O/mgmol_rom_1_50.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
verbosity=1
xcFunctional=PBE
FDtype=Mehrstellen
FDtype=4th
[Mesh]
nx=64
ny=64
Expand Down Expand Up @@ -33,6 +33,8 @@ initial_type=Random
initial_width=2.
[Restart]
output_level=4
[ROM]
stage=test_orbital
[ROM.offline]
basis_file=PinnedH2O_orbitals_basis_1_50
[ROM.basis]
Expand Down
46 changes: 46 additions & 0 deletions examples/PinnedH2O/mgmol_rom_3DOF_2_2_34.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
verbosity=1
xcFunctional=PBE
FDtype=4th
[Mesh]
nx=64
ny=64
nz=64
[Domain]
ox=-6.
oy=-6.
oz=-6.
lx=12.
ly=12.
lz=12.
[Potentials]
pseudopotential=pseudo.O_ONCV_PBE_SG15
pseudopotential=pseudo.H_ONCV_PBE_SG15
[Run]
type=MD
[MD]
num_steps=500
dt=40.
thermostat=ON
[Thermostat]
type=Berendsen
temperature=1000.
relax_time=800.
[Quench]
max_steps=100
atol=1.e-8
[Orbitals]
initial_type=Random
initial_width=2.
nempty=68
[Restart]
output_level=4
[DensityMatrix]
solver=MVP
nb_inner_it=100
[ROM]
stage=online_MVP
[ROM.offline]
basis_file=data/PinnedH2O_3DOF_orbitals_basis_2_2
[ROM.basis]
compare_md=false
number_of_orbital_basis=34
4 changes: 4 additions & 0 deletions src/Control.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1953,6 +1953,10 @@ void Control::setROMOptions(const boost::program_options::variables_map& vm)
rom_pri_option.rom_stage = ROMStage::ONLINE;
else if (str.compare("build") == 0)
rom_pri_option.rom_stage = ROMStage::BUILD;
else if (str.compare("online_MVP") == 0)
rom_pri_option.rom_stage = ROMStage::ONLINE_MVP;
else if (str.compare("test_orbital") == 0)
rom_pri_option.rom_stage = ROMStage::TEST_ORBITAL;
else if (str.compare("online_poisson") == 0)
rom_pri_option.rom_stage = ROMStage::ONLINE_POISSON;
else if (str.compare("test_poisson") == 0)
Expand Down
27 changes: 27 additions & 0 deletions src/MGmol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1442,6 +1442,33 @@ void MGmol<OrbitalsType>::getAtomicNumbers(std::vector<short>& an)
ions_->getAtomicNumbers(an);
}

template <class OrbitalsType>
void MGmol<OrbitalsType>::updateDMandEnergy(OrbitalsType& orbitals, Ions ions, double& eks)
{
// initialize electronic density
rho_->update(orbitals);

// initialize potential
update_pot(ions);

// initialize projected matrices
updateHmatrix(orbitals, ions);
proj_matrices_->updateThetaAndHB();

// compute DM
std::shared_ptr<DMStrategy<OrbitalsType>> dm_strategy(
DMStrategyFactory<OrbitalsType,
dist_matrix::DistMatrix<double>>::create(comm_, os_, ions,
rho_.get(), energy_.get(), electrostat_.get(), this,
proj_matrices_.get(), &orbitals));

dm_strategy->update(orbitals);

// evaluate energy and forces
double ts = 0.;
eks = energy_->evaluateTotal(ts, proj_matrices_.get(), orbitals, 2, os_);
}

template <class OrbitalsType>
double MGmol<OrbitalsType>::evaluateEnergyAndForces(
const std::vector<double>& tau, const std::vector<short>& atnumbers,
Expand Down
1 change: 1 addition & 0 deletions src/MGmol.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ class MGmol : public MGmolInterface
int save_orbital_snapshot(std::string file_path, OrbitalsType& orbitals);
void project_orbital(std::string file_path, int rdim, OrbitalsType& orbitals);
#endif
void updateDMandEnergy(OrbitalsType& orbitals, Ions ions, double& eks);
};
// Instantiate static variables here to avoid clang warnings
template <class OrbitalsType>
Expand Down
25 changes: 22 additions & 3 deletions src/md.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
#include "mgmol_Signal.h"
#include "tools.h"

#ifdef MGMOL_HAS_LIBROM
#include "rom_workflows.h"
#include "PinnedH2O.h"
#endif

#include <sstream>
#include <string>
#include <vector>
Expand Down Expand Up @@ -400,7 +405,14 @@ void MGmol<OrbitalsType>::md(OrbitalsType** orbitals, Ions& ions)
if (ct.restart_info < 3)
{
double eks = 0.;
quench(**orbitals, ions, ct.max_electronic_steps, 20, eks);
if (ct.getROMOptions().rom_stage == ROMStage::TEST_ORBITAL)
{
updateDMandEnergy(**orbitals, ions, eks);
}
else
{
quench(**orbitals, ions, ct.max_electronic_steps, 20, eks);
}
}

ct.max_changes_pot = 0;
Expand Down Expand Up @@ -431,7 +443,14 @@ void MGmol<OrbitalsType>::md(OrbitalsType** orbitals, Ions& ions)
bool last_move_is_small = true;
do
{
retval = quench(**orbitals, ions, ct.max_electronic_steps, 0, eks);
if (ct.getROMOptions().rom_stage == ROMStage::TEST_ORBITAL)
{
updateDMandEnergy(**orbitals, ions, eks);
Copy link
Member Author

@siuwuncheung siuwuncheung Feb 21, 2025

Choose a reason for hiding this comment

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

@jeanlucf22 @oseikuffuor1 Do we need a check for retval as in quench? I think this is not supported in the MVP solver yet.

Copy link
Collaborator

Choose a reason for hiding this comment

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

No. updateDMandEnergy() does not return anything.

}
else
{
retval = quench(**orbitals, ions, ct.max_electronic_steps, 0, eks);
}

// update localization regions
if (ct.adaptiveLRs())
Expand Down Expand Up @@ -495,7 +514,7 @@ void MGmol<OrbitalsType>::md(OrbitalsType** orbitals, Ions& ions)
force(**orbitals, ions);

#ifdef MGMOL_HAS_LIBROM
if (ct.getROMOptions().num_orbbasis > 0)
if (ct.getROMOptions().rom_stage == ROMStage::TEST_ORBITAL)
{
if (onpe0)
{
Expand Down
2 changes: 2 additions & 0 deletions src/rom_Control.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ enum class ROMStage
ONLINE,
RESTORE, // TODO(kevin): what stage is this?
BUILD,
ONLINE_MVP,
TEST_ORBITAL,
ONLINE_POISSON,
TEST_POISSON,
TEST_RHO,
Expand Down
1 change: 1 addition & 0 deletions src/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(SOURCES mgmol_mpi_tools.cc
random.cc
coloring.cc
SymmetricMatrix.cc
PinnedH2O.cc
)

add_library(mgmol_tools ${SOURCES})
Expand Down
Loading