Skip to content

Commit 7b5b5d0

Browse files
committed
Add the default parameter setting and adjust importing following the convention
1 parent 604800f commit 7b5b5d0

File tree

1 file changed

+43
-12
lines changed
  • src/libra_py/workflows/nbra

1 file changed

+43
-12
lines changed

src/libra_py/workflows/nbra/rpi.py

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,37 @@
1-
import libra_py.units as units
2-
from libra_py import data_conv
3-
import libra_py.data_read as data_read
4-
import util.libutil as comn
5-
import matplotlib.pyplot as plt
6-
import sys
7-
import cmath
8-
import math
1+
# *********************************************************************************
2+
# * Copyright (C) 2025 Daeho Han and Alexey V. Akimov
3+
# *
4+
# * This file is distributed under the terms of the GNU General Public License
5+
# * as published by the Free Software Foundation, either version 3 of
6+
# * the License, or (at your option) any later version.
7+
# * See the file LICENSE in the root directory of this distribution
8+
# * or <http://www.gnu.org/licenses/>.
9+
# *
10+
# *********************************************************************************/
11+
12+
"""
13+
.. module:: rpi
14+
:platform: Unix, Windows
15+
:synopsis: this module implements restricted path integral (RPI) calculations
16+
17+
.. moduleauthor:: Daeho Han, Alexey V. Akimov
18+
19+
"""
20+
921
import os
10-
import multiprocessing as mp
11-
import time
22+
import sys
1223
import numpy as np
1324
import h5py
14-
import scipy.sparse as sp
25+
import time
1526
import multiprocessing as mp
16-
1727
if sys.platform == "cygwin":
1828
from cyglibra_core import *
1929
elif sys.platform == "linux" or sys.platform == "linux2":
2030
from liblibra_core import *
31+
import libra_py.units as units
32+
from libra_py import data_conv
33+
import libra_py.data_read as data_read
34+
import util.libutil as comn
2135

2236
def run_patch_rpi(rpi_params):
2337
"""
@@ -61,6 +75,14 @@ def run_patch_rpi(rpi_params):
6175
Return:
6276
None: but performs the action
6377
"""
78+
79+
critical_params = ["path_to_save_Hvibs", "iread", "fread", "nsteps", "npatches", "nstates", "path_to_save_patch"]
80+
default_params = {"run_slurm": False, "submit_template": 'submit_template.slm', "submission_exe": 'sbatch',
81+
"run_python_file": 'run_template.py',
82+
"iconds": [0],
83+
"dt": 1.0*units.fs2au,
84+
}
85+
comn.check_input(rpi_params, default_params, critical_params)
6486

6587
out_dir = rpi_params["path_to_save_patch"]
6688
if not os.path.exists(out_dir):
@@ -197,6 +219,11 @@ def run_sum_rpi(rpi_params):
197219
Return:
198220
None: but performs the action
199221
"""
222+
critical_params = ["nsteps", "npatches", "nstates", "path_to_save_patch"]
223+
default_params = {"nprocs": 1, "prefix": 'out', "dt": 1.0*units.fs2au, "istate": 0, "iconds": [0]}
224+
225+
comn.check_input(rpi_params, default_params, critical_params)
226+
200227
nprocs = rpi_params["nprocs"]
201228

202229
nsteps, dt = rpi_params["nsteps"], rpi_params["dt"]
@@ -248,6 +275,10 @@ def run_sum_rpi_crude(rpi_params):
248275
Return:
249276
None: but performs the action
250277
"""
278+
critical_params = ["nsteps", "npatches", "nstates", "path_to_save_patch"]
279+
default_params = {"prefix": 'out', "dt": 1.0*units.fs2au, "istate": 0, "iconds": [0]}
280+
281+
comn.check_input(rpi_params, default_params, critical_params)
251282

252283
nsteps, dt, istate = rpi_params["nsteps"], rpi_params["dt"], rpi_params["istate"]
253284

0 commit comments

Comments
 (0)