Skip to content

Commit

Permalink
Merge branch 'ROMFPMD' into rho-rom
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamer2368 committed Sep 6, 2024
2 parents 018d64d + 1140370 commit 6896149
Show file tree
Hide file tree
Showing 47 changed files with 3,373 additions and 157 deletions.
26 changes: 7 additions & 19 deletions examples/2-pyridone/2-pyridone.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
verbosity=1
xcFunctional=PBE
FDtype=4th
[Mesh]
nx=128
ny=128
Expand All @@ -12,30 +13,17 @@ lx=24.
ly=24.
lz=12.
[Potentials]
pseudopotential=pseudo.N_soft_pbe
pseudopotential=pseudo.O_pbe
pseudopotential=pseudo.C_pbe
pseudopotential=pseudo.H_pbe
[Poisson]
solver=MG
max_steps_initial=10
max_steps=10
bcx=periodic
bcy=periodic
bcz=periodic
pseudopotential=pseudo.N_ONCV_PBE_SG15
pseudopotential=pseudo.O_ONCV_PBE_SG15
pseudopotential=pseudo.C_ONCV_PBE_SG15
pseudopotential=pseudo.H_ONCV_PBE_SG15
[Run]
type=QUENCH
[Quench]
step_length=1.5
max_steps=200
atol=1.e-7
num_lin_iterations=2
ortho_freq=20
interval_print_residual=10
[Orbitals]
initial_type=Gaussian
initial_width=1.5
[ProjectedMatrices]
solver=exact
[Restart]
output_type=single_file
[Poisson]
FDtype=4th
10 changes: 5 additions & 5 deletions examples/2-pyridone/README
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ln -s ../../potentials/pseudo.N_soft_pbe
ln -s ../../potentials/pseudo.O_pbe
ln -s ../../potentials/pseudo.C_pbe
ln -s ../../potentials/pseudo.H_pbe
ln -s ../../potentials/pseudo.N_ONCV_PBE_SG15
ln -s ../../potentials/pseudo.O_ONCV_PBE_SG15
ln -s ../../potentials/pseudo.C_ONCV_PBE_SG15
ln -s ../../potentials/pseudo.H_ONCV_PBE_SG15

srun -ppdebug -n32 /nfs/tmp2/jeanluc/SVN/MGmol/mgmol/branches/bin/mgmol-pel -c 2-pyridone.cfg -l lrs.in -i coords.in
srun -ppdebug -n32 mgmol-opt -c 2-pyridone.cfg -l lrs.in -i coords.in
25 changes: 12 additions & 13 deletions examples/2-pyridone/coords.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
N1 1 10.0818 7.9149 6. 1
O1 2 14.2787 7.9126 6. 1
C1 3 7.9625 9.1867 6. 0
C2 3 7.8388 11.8070 6. 0
C3 3 10.1050 13.1610 6. 0
C4 3 12.3830 11.8680 6. 0
C5 3 12.2810 9.2255 6. 0
H1 4 6.2219 8.0878 6. 1
H2 4 6.0028 12.7142 6. 1
H3 4 10.0754 15.2192 6. 1
H4 4 14.2295 12.7482 6. 1
H5 4 10.2332 6.0038 6. 1

N1 1 10.0818 7.9149 6.
O1 2 14.2787 7.9126 6.
C1 3 7.9625 9.1867 6.
C2 3 7.8388 11.8070 6.
C3 3 10.1050 13.1610 6.
C4 3 12.3830 11.8680 6.
C5 3 12.2810 9.2255 6.
H1 4 6.2219 8.0878 6.
H2 4 6.0028 12.7142 6.
H3 4 10.0754 15.2192 6.
H4 4 14.2295 12.7482 6.
H5 4 10.2332 6.0038 6.
11 changes: 11 additions & 0 deletions examples/Li2GTH/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#Run MGmol
mpirun -np 4 mgmol-opt -c davidson.cfg -i li2.xyz > davidson.out

#extract visit files from HDF5 file
python read_hdf5.py -bov li2.h5 Vtotal

python read_hdf5.py -bov li2.h50 Function0002

Note: the eigenfunctions corresponding to the 3 occupied states are stored
in functions 2, 3 and 4 because they are the result of diagonalizing the DM
in Davidson algorithm, not H.
46 changes: 46 additions & 0 deletions examples/Li2GTH/davidson.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
verbosity=2
xcFunctional=PBE
FDtype=4th
[Mesh]
nx=96
ny=96
nz=96
[Domain]
ox=-9.
oy=-9.
oz=-9.
lx=18.
ly=18.
lz=18.
[Potentials]
pseudopotential=pseudo.Li_GTH_PBE
[Poisson]
solver=CG
bcx=0
bcy=0
bcz=0
[Run]
type=QUENCH
[Quench]
solver=Davidson
max_steps=200
atol=1.e-8
preconditioner_num_levels=3
[Orbitals]
nempty=2
initial_type=random
temperature=300.
bcx=0
bcy=0
bcz=0
[ProjectedMatrices]
solver=exact
[DensityMatrix]
nb_inner_it=1
mixing=1.
[Restart]
output_level=3
output_filename=li2.h5
output_type=single_file
[Coloring]
scope=global
4 changes: 4 additions & 0 deletions examples/Li2GTH/li2.xyz
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
2
Experimental geometry (Menconi and Tozer, Chem. Phys. Lett. 2002)
Li 1.3365 0.0 0.0
Li -1.3365 0.0 0.0
3 changes: 3 additions & 0 deletions examples/PinnedH2O/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Single water molecule MD, with Oxigen atom pinned to (0,0,0) coordinate:

mpirun -np 4 mgmol-opt -c mgmol.cfg -i coords.in
3 changes: 3 additions & 0 deletions examples/PinnedH2O/coords.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
O1 1 0.00 0.00 0.00 0
H1 2 -0.45 1.42 -1.07 1
H2 2 -0.45 -1.48 -0.97 1
32 changes: 32 additions & 0 deletions examples/PinnedH2O/job.basis
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/tcsh
#SBATCH -N 2
#SBATCH -t 0:10:00
#SBATCH -p pdebug

date

setenv OMP_NUM_THREADS 1
#setenv KMP_DETERMINISTIC_REDUCTION 1

set ncpus = 64

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

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

set exe = ${maindir}/build_quartz/libROM/build/examples/misc/combine_samples

set snapshot_files = ""
set increment_md_steps = 1
set num_md_steps = 500

foreach k (`seq $increment_md_steps $increment_md_steps $num_md_steps`)
set snapshot_files = "$snapshot_files MD_mdstep${k}_snapshot"
end
echo "Snapshot files: $snapshot_files"

set basis_file = "PinnedH2O_orbitals_basis"

srun -n $ncpus $exe -f $basis_file $snapshot_files > basis_${increment_md_steps}_${num_md_steps}_Pinned_H2O.out

date
35 changes: 35 additions & 0 deletions examples/PinnedH2O/job.rom
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/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-20240815

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 cfg_rom = mgmol_rom.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 .

source $maindir/scripts/modules.quartz

srun -n $ncpus $exe -c $cfg_rom -i coords.in > rom_PinnedH2O.out

date
35 changes: 35 additions & 0 deletions examples/PinnedH2O/mgmol.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
verbosity=1
xcFunctional=PBE
FDtype=Mehrstellen
[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=50
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.
[Restart]
output_level=0
38 changes: 38 additions & 0 deletions examples/PinnedH2O/mgmol_rom.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
verbosity=1
xcFunctional=PBE
FDtype=Mehrstellen
[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.
[Restart]
output_level=4
[ROM.offline]
save_librom_snapshot=true
librom_snapshot_freq=1
27 changes: 27 additions & 0 deletions examples/PinnedH2O/postprocess_PinnedH2O.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import subprocess
import re

print("\\begin{tabular}{|c||c|c|c|c|c|c|c|}")
print("\\hline")
print("$k$ & $\\varepsilon = 10^{-1}$ & $\\varepsilon = 10^{-2}$ & $\\varepsilon = 10^{-3}$ & $\\varepsilon = 10^{-4}$ & $\\varepsilon = 10^{-5}$ & Snapshots \\\\")
print("\\hline")

pattern = r"For energy fraction: \d+\.\d+, take first (\d+) of \d+ basis vectors"
for t in range(10):
k = 50*(t+1)
snapshots = 4*k
grep_command = f"grep 'take first' basis_1_{k}_Pinned_H2O.out"
result = subprocess.run(grep_command, shell=True, capture_output=True, text=True)
matches = re.findall(pattern, result.stdout)
energy_fractions = {
"0.9": matches[0],
"0.99": matches[1],
"0.999": matches[2],
"0.9999": matches[3],
"0.99999": matches[4],
}
line = f"{k} & {energy_fractions['0.9']} & {energy_fractions['0.99']} & {energy_fractions['0.999']} & {energy_fractions['0.9999']} & {energy_fractions['0.99999']} & {snapshots} \\\\"
print(line)

print("\\hline")
print("\\end{tabular}")
Loading

0 comments on commit 6896149

Please sign in to comment.