MultiOptPy 1.20.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- multioptpy/Calculator/__init__.py +0 -0
- multioptpy/Calculator/ase_calculation_tools.py +424 -0
- multioptpy/Calculator/ase_tools/__init__.py +0 -0
- multioptpy/Calculator/ase_tools/fairchem.py +28 -0
- multioptpy/Calculator/ase_tools/gamess.py +19 -0
- multioptpy/Calculator/ase_tools/gaussian.py +165 -0
- multioptpy/Calculator/ase_tools/mace.py +28 -0
- multioptpy/Calculator/ase_tools/mopac.py +19 -0
- multioptpy/Calculator/ase_tools/nwchem.py +31 -0
- multioptpy/Calculator/ase_tools/orca.py +22 -0
- multioptpy/Calculator/ase_tools/pygfn0.py +37 -0
- multioptpy/Calculator/dxtb_calculation_tools.py +344 -0
- multioptpy/Calculator/emt_calculation_tools.py +458 -0
- multioptpy/Calculator/gpaw_calculation_tools.py +183 -0
- multioptpy/Calculator/lj_calculation_tools.py +314 -0
- multioptpy/Calculator/psi4_calculation_tools.py +334 -0
- multioptpy/Calculator/pwscf_calculation_tools.py +189 -0
- multioptpy/Calculator/pyscf_calculation_tools.py +327 -0
- multioptpy/Calculator/sqm1_calculation_tools.py +611 -0
- multioptpy/Calculator/sqm2_calculation_tools.py +376 -0
- multioptpy/Calculator/tblite_calculation_tools.py +352 -0
- multioptpy/Calculator/tersoff_calculation_tools.py +818 -0
- multioptpy/Constraint/__init__.py +0 -0
- multioptpy/Constraint/constraint_condition.py +834 -0
- multioptpy/Coordinate/__init__.py +0 -0
- multioptpy/Coordinate/polar_coordinate.py +199 -0
- multioptpy/Coordinate/redundant_coordinate.py +638 -0
- multioptpy/IRC/__init__.py +0 -0
- multioptpy/IRC/converge_criteria.py +28 -0
- multioptpy/IRC/dvv.py +544 -0
- multioptpy/IRC/euler.py +439 -0
- multioptpy/IRC/hpc.py +564 -0
- multioptpy/IRC/lqa.py +540 -0
- multioptpy/IRC/modekill.py +662 -0
- multioptpy/IRC/rk4.py +579 -0
- multioptpy/Interpolation/__init__.py +0 -0
- multioptpy/Interpolation/adaptive_interpolation.py +283 -0
- multioptpy/Interpolation/binomial_interpolation.py +179 -0
- multioptpy/Interpolation/geodesic_interpolation.py +785 -0
- multioptpy/Interpolation/interpolation.py +156 -0
- multioptpy/Interpolation/linear_interpolation.py +473 -0
- multioptpy/Interpolation/savitzky_golay_interpolation.py +252 -0
- multioptpy/Interpolation/spline_interpolation.py +353 -0
- multioptpy/MD/__init__.py +0 -0
- multioptpy/MD/thermostat.py +185 -0
- multioptpy/MEP/__init__.py +0 -0
- multioptpy/MEP/pathopt_bneb_force.py +443 -0
- multioptpy/MEP/pathopt_dmf_force.py +448 -0
- multioptpy/MEP/pathopt_dneb_force.py +130 -0
- multioptpy/MEP/pathopt_ewbneb_force.py +207 -0
- multioptpy/MEP/pathopt_gpneb_force.py +512 -0
- multioptpy/MEP/pathopt_lup_force.py +113 -0
- multioptpy/MEP/pathopt_neb_force.py +225 -0
- multioptpy/MEP/pathopt_nesb_force.py +205 -0
- multioptpy/MEP/pathopt_om_force.py +153 -0
- multioptpy/MEP/pathopt_qsm_force.py +174 -0
- multioptpy/MEP/pathopt_qsmv2_force.py +304 -0
- multioptpy/ModelFunction/__init__.py +7 -0
- multioptpy/ModelFunction/avoiding_model_function.py +29 -0
- multioptpy/ModelFunction/binary_image_ts_search_model_function.py +47 -0
- multioptpy/ModelFunction/conical_model_function.py +26 -0
- multioptpy/ModelFunction/opt_meci.py +50 -0
- multioptpy/ModelFunction/opt_mesx.py +47 -0
- multioptpy/ModelFunction/opt_mesx_2.py +49 -0
- multioptpy/ModelFunction/seam_model_function.py +27 -0
- multioptpy/ModelHessian/__init__.py +0 -0
- multioptpy/ModelHessian/approx_hessian.py +147 -0
- multioptpy/ModelHessian/calc_params.py +227 -0
- multioptpy/ModelHessian/fischer.py +236 -0
- multioptpy/ModelHessian/fischerd3.py +360 -0
- multioptpy/ModelHessian/fischerd4.py +398 -0
- multioptpy/ModelHessian/gfn0xtb.py +633 -0
- multioptpy/ModelHessian/gfnff.py +709 -0
- multioptpy/ModelHessian/lindh.py +165 -0
- multioptpy/ModelHessian/lindh2007d2.py +707 -0
- multioptpy/ModelHessian/lindh2007d3.py +822 -0
- multioptpy/ModelHessian/lindh2007d4.py +1030 -0
- multioptpy/ModelHessian/morse.py +106 -0
- multioptpy/ModelHessian/schlegel.py +144 -0
- multioptpy/ModelHessian/schlegeld3.py +322 -0
- multioptpy/ModelHessian/schlegeld4.py +559 -0
- multioptpy/ModelHessian/shortrange.py +346 -0
- multioptpy/ModelHessian/swartd2.py +496 -0
- multioptpy/ModelHessian/swartd3.py +706 -0
- multioptpy/ModelHessian/swartd4.py +918 -0
- multioptpy/ModelHessian/tshess.py +40 -0
- multioptpy/Optimizer/QHAdam.py +61 -0
- multioptpy/Optimizer/__init__.py +0 -0
- multioptpy/Optimizer/abc_fire.py +83 -0
- multioptpy/Optimizer/adabelief.py +58 -0
- multioptpy/Optimizer/adabound.py +68 -0
- multioptpy/Optimizer/adadelta.py +65 -0
- multioptpy/Optimizer/adaderivative.py +56 -0
- multioptpy/Optimizer/adadiff.py +68 -0
- multioptpy/Optimizer/adafactor.py +70 -0
- multioptpy/Optimizer/adam.py +65 -0
- multioptpy/Optimizer/adamax.py +62 -0
- multioptpy/Optimizer/adamod.py +83 -0
- multioptpy/Optimizer/adamw.py +65 -0
- multioptpy/Optimizer/adiis.py +523 -0
- multioptpy/Optimizer/afire_neb.py +282 -0
- multioptpy/Optimizer/block_hessian_update.py +709 -0
- multioptpy/Optimizer/c2diis.py +491 -0
- multioptpy/Optimizer/component_wise_scaling.py +405 -0
- multioptpy/Optimizer/conjugate_gradient.py +82 -0
- multioptpy/Optimizer/conjugate_gradient_neb.py +345 -0
- multioptpy/Optimizer/coordinate_locking.py +405 -0
- multioptpy/Optimizer/dic_rsirfo.py +1015 -0
- multioptpy/Optimizer/ediis.py +417 -0
- multioptpy/Optimizer/eve.py +76 -0
- multioptpy/Optimizer/fastadabelief.py +61 -0
- multioptpy/Optimizer/fire.py +77 -0
- multioptpy/Optimizer/fire2.py +249 -0
- multioptpy/Optimizer/fire_neb.py +92 -0
- multioptpy/Optimizer/gan_step.py +486 -0
- multioptpy/Optimizer/gdiis.py +609 -0
- multioptpy/Optimizer/gediis.py +203 -0
- multioptpy/Optimizer/geodesic_step.py +433 -0
- multioptpy/Optimizer/gpmin.py +633 -0
- multioptpy/Optimizer/gpr_step.py +364 -0
- multioptpy/Optimizer/gradientdescent.py +78 -0
- multioptpy/Optimizer/gradientdescent_neb.py +52 -0
- multioptpy/Optimizer/hessian_update.py +433 -0
- multioptpy/Optimizer/hybrid_rfo.py +998 -0
- multioptpy/Optimizer/kdiis.py +625 -0
- multioptpy/Optimizer/lars.py +21 -0
- multioptpy/Optimizer/lbfgs.py +253 -0
- multioptpy/Optimizer/lbfgs_neb.py +355 -0
- multioptpy/Optimizer/linesearch.py +236 -0
- multioptpy/Optimizer/lookahead.py +40 -0
- multioptpy/Optimizer/nadam.py +64 -0
- multioptpy/Optimizer/newton.py +200 -0
- multioptpy/Optimizer/prodigy.py +70 -0
- multioptpy/Optimizer/purtubation.py +16 -0
- multioptpy/Optimizer/quickmin_neb.py +245 -0
- multioptpy/Optimizer/radam.py +75 -0
- multioptpy/Optimizer/rfo_neb.py +302 -0
- multioptpy/Optimizer/ric_rfo.py +842 -0
- multioptpy/Optimizer/rl_step.py +627 -0
- multioptpy/Optimizer/rmspropgrave.py +65 -0
- multioptpy/Optimizer/rsirfo.py +1647 -0
- multioptpy/Optimizer/rsprfo.py +1056 -0
- multioptpy/Optimizer/sadam.py +60 -0
- multioptpy/Optimizer/samsgrad.py +63 -0
- multioptpy/Optimizer/tr_lbfgs.py +678 -0
- multioptpy/Optimizer/trim.py +273 -0
- multioptpy/Optimizer/trust_radius.py +207 -0
- multioptpy/Optimizer/trust_radius_neb.py +121 -0
- multioptpy/Optimizer/yogi.py +60 -0
- multioptpy/OtherMethod/__init__.py +0 -0
- multioptpy/OtherMethod/addf.py +1150 -0
- multioptpy/OtherMethod/dimer.py +895 -0
- multioptpy/OtherMethod/elastic_image_pair.py +629 -0
- multioptpy/OtherMethod/modelfunction.py +456 -0
- multioptpy/OtherMethod/newton_traj.py +454 -0
- multioptpy/OtherMethod/twopshs.py +1095 -0
- multioptpy/PESAnalyzer/__init__.py +0 -0
- multioptpy/PESAnalyzer/calc_irc_curvature.py +125 -0
- multioptpy/PESAnalyzer/cmds_analysis.py +152 -0
- multioptpy/PESAnalyzer/koopman_analysis.py +268 -0
- multioptpy/PESAnalyzer/pca_analysis.py +314 -0
- multioptpy/Parameters/__init__.py +0 -0
- multioptpy/Parameters/atomic_mass.py +20 -0
- multioptpy/Parameters/atomic_number.py +22 -0
- multioptpy/Parameters/covalent_radii.py +44 -0
- multioptpy/Parameters/d2.py +61 -0
- multioptpy/Parameters/d3.py +63 -0
- multioptpy/Parameters/d4.py +103 -0
- multioptpy/Parameters/dreiding.py +34 -0
- multioptpy/Parameters/gfn0xtb_param.py +137 -0
- multioptpy/Parameters/gfnff_param.py +315 -0
- multioptpy/Parameters/gnb.py +104 -0
- multioptpy/Parameters/parameter.py +22 -0
- multioptpy/Parameters/uff.py +72 -0
- multioptpy/Parameters/unit_values.py +20 -0
- multioptpy/Potential/AFIR_potential.py +55 -0
- multioptpy/Potential/LJ_repulsive_potential.py +345 -0
- multioptpy/Potential/__init__.py +0 -0
- multioptpy/Potential/anharmonic_keep_potential.py +28 -0
- multioptpy/Potential/asym_elllipsoidal_potential.py +718 -0
- multioptpy/Potential/electrostatic_potential.py +69 -0
- multioptpy/Potential/flux_potential.py +30 -0
- multioptpy/Potential/gaussian_potential.py +101 -0
- multioptpy/Potential/idpp.py +516 -0
- multioptpy/Potential/keep_angle_potential.py +146 -0
- multioptpy/Potential/keep_dihedral_angle_potential.py +105 -0
- multioptpy/Potential/keep_outofplain_angle_potential.py +70 -0
- multioptpy/Potential/keep_potential.py +99 -0
- multioptpy/Potential/mechano_force_potential.py +74 -0
- multioptpy/Potential/nanoreactor_potential.py +52 -0
- multioptpy/Potential/potential.py +896 -0
- multioptpy/Potential/spacer_model_potential.py +221 -0
- multioptpy/Potential/switching_potential.py +258 -0
- multioptpy/Potential/universal_potential.py +34 -0
- multioptpy/Potential/value_range_potential.py +36 -0
- multioptpy/Potential/void_point_potential.py +25 -0
- multioptpy/SQM/__init__.py +0 -0
- multioptpy/SQM/sqm1/__init__.py +0 -0
- multioptpy/SQM/sqm1/sqm1_core.py +1792 -0
- multioptpy/SQM/sqm2/__init__.py +0 -0
- multioptpy/SQM/sqm2/calc_tools.py +95 -0
- multioptpy/SQM/sqm2/sqm2_basis.py +850 -0
- multioptpy/SQM/sqm2/sqm2_bond.py +119 -0
- multioptpy/SQM/sqm2/sqm2_core.py +303 -0
- multioptpy/SQM/sqm2/sqm2_data.py +1229 -0
- multioptpy/SQM/sqm2/sqm2_disp.py +65 -0
- multioptpy/SQM/sqm2/sqm2_eeq.py +243 -0
- multioptpy/SQM/sqm2/sqm2_overlapint.py +704 -0
- multioptpy/SQM/sqm2/sqm2_qm.py +578 -0
- multioptpy/SQM/sqm2/sqm2_rep.py +66 -0
- multioptpy/SQM/sqm2/sqm2_srb.py +70 -0
- multioptpy/Thermo/__init__.py +0 -0
- multioptpy/Thermo/normal_mode_analyzer.py +865 -0
- multioptpy/Utils/__init__.py +0 -0
- multioptpy/Utils/bond_connectivity.py +264 -0
- multioptpy/Utils/calc_tools.py +884 -0
- multioptpy/Utils/oniom.py +96 -0
- multioptpy/Utils/pbc.py +48 -0
- multioptpy/Utils/riemann_curvature.py +208 -0
- multioptpy/Utils/symmetry_analyzer.py +482 -0
- multioptpy/Visualization/__init__.py +0 -0
- multioptpy/Visualization/visualization.py +156 -0
- multioptpy/WFAnalyzer/MO_analysis.py +104 -0
- multioptpy/WFAnalyzer/__init__.py +0 -0
- multioptpy/Wrapper/__init__.py +0 -0
- multioptpy/Wrapper/autots.py +1239 -0
- multioptpy/Wrapper/ieip_wrapper.py +93 -0
- multioptpy/Wrapper/md_wrapper.py +92 -0
- multioptpy/Wrapper/neb_wrapper.py +94 -0
- multioptpy/Wrapper/optimize_wrapper.py +76 -0
- multioptpy/__init__.py +5 -0
- multioptpy/entrypoints.py +916 -0
- multioptpy/fileio.py +660 -0
- multioptpy/ieip.py +340 -0
- multioptpy/interface.py +1086 -0
- multioptpy/irc.py +529 -0
- multioptpy/moleculardynamics.py +432 -0
- multioptpy/neb.py +1267 -0
- multioptpy/optimization.py +1553 -0
- multioptpy/optimizer.py +709 -0
- multioptpy-1.20.2.dist-info/METADATA +438 -0
- multioptpy-1.20.2.dist-info/RECORD +246 -0
- multioptpy-1.20.2.dist-info/WHEEL +5 -0
- multioptpy-1.20.2.dist-info/entry_points.txt +9 -0
- multioptpy-1.20.2.dist-info/licenses/LICENSE +674 -0
- multioptpy-1.20.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import multioptpy.interface
|
|
4
|
+
import multioptpy.ieip
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class IEIPJob:
|
|
8
|
+
"""
|
|
9
|
+
Wrapper class to define and run an iEIP (reaction path search) job
|
|
10
|
+
from a Python script. This replaces ieipmain.py.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
def __init__(self, input_folder):
|
|
14
|
+
"""
|
|
15
|
+
Initializes the iEIP job settings.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
input_folder (str): The input folder path.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
if not isinstance(input_folder, str):
|
|
22
|
+
raise TypeError("input_folder must be a string.")
|
|
23
|
+
|
|
24
|
+
self.input_args = [input_folder]
|
|
25
|
+
|
|
26
|
+
# Get default args using the modified ieipparser
|
|
27
|
+
parser = multioptpy.interface.init_parser()
|
|
28
|
+
self.args = multioptpy.interface.ieipparser(parser, self.input_args)
|
|
29
|
+
|
|
30
|
+
self._ieip_instance = None
|
|
31
|
+
|
|
32
|
+
def set_option(self, key, value):
|
|
33
|
+
"""Sets a single iEIP job option."""
|
|
34
|
+
if not hasattr(self.args, key):
|
|
35
|
+
print(f"Warning: Option '{key}' is not a default argparse argument.")
|
|
36
|
+
setattr(self.args, key, value)
|
|
37
|
+
print(f"Set option: {key} = {value}")
|
|
38
|
+
|
|
39
|
+
def set_options(self, **kwargs):
|
|
40
|
+
"""Sets multiple iEIP job options using keyword arguments."""
|
|
41
|
+
print("Setting multiple job options...")
|
|
42
|
+
for key, value in kwargs.items():
|
|
43
|
+
self.set_option(key, value)
|
|
44
|
+
|
|
45
|
+
def run(self):
|
|
46
|
+
"""Executes the iEIP job."""
|
|
47
|
+
print("\n--- Starting MultiOptPy iEIP Job ---")
|
|
48
|
+
print("Final Settings (args):")
|
|
49
|
+
for key, value in vars(self.args).items():
|
|
50
|
+
print(f" {key}: {value}")
|
|
51
|
+
print("--------------------------------------")
|
|
52
|
+
|
|
53
|
+
try:
|
|
54
|
+
self._ieip_instance = multioptpy.ieip.iEIP(self.args)
|
|
55
|
+
self._ieip_instance.run()
|
|
56
|
+
print("--- MultiOptPy Job Finished Successfully ---")
|
|
57
|
+
except Exception as e:
|
|
58
|
+
print(f"--- MultiOptPy Job FAILED ---")
|
|
59
|
+
print(f"An error occurred: {e}")
|
|
60
|
+
raise
|
|
61
|
+
|
|
62
|
+
def get_results(self):
|
|
63
|
+
"""Retrieves the iEIP instance after the job has been run."""
|
|
64
|
+
if not self._ieip_instance:
|
|
65
|
+
print("Error: .run() must be called before get_results().")
|
|
66
|
+
return None
|
|
67
|
+
return self._ieip_instance
|
|
68
|
+
|
|
69
|
+
# --- Example Usage ---
|
|
70
|
+
if __name__ == "__main__":
|
|
71
|
+
print("=== Example: Defining an iEIP Job ===")
|
|
72
|
+
|
|
73
|
+
# 1. Define the job
|
|
74
|
+
ieip_job = IEIPJob(input_folder="path/to/my_ieip_input")
|
|
75
|
+
|
|
76
|
+
# 2. Configure the job
|
|
77
|
+
ieip_job.set_options(
|
|
78
|
+
usextb="GFN2-xTB",
|
|
79
|
+
NSTEP=50,
|
|
80
|
+
opt_method=["FIRE"]
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
print("\n--- Job Configuration Complete ---")
|
|
84
|
+
print(f"Input folder: {ieip_job.args.INPUT}")
|
|
85
|
+
print(f"Method: {ieip_job.args.usextb}")
|
|
86
|
+
|
|
87
|
+
# 3. To run, uncomment:
|
|
88
|
+
# try:
|
|
89
|
+
# ieip_job.run()
|
|
90
|
+
# except FileNotFoundError:
|
|
91
|
+
# print("\nError: Input folder not found. Job skipped.")
|
|
92
|
+
# except Exception as e:
|
|
93
|
+
# print(f"\nAn error occurred during job execution: {e}")
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
|
|
2
|
+
import multioptpy.interface
|
|
3
|
+
import multioptpy.moleculardynamics
|
|
4
|
+
|
|
5
|
+
class MDJob:
|
|
6
|
+
"""
|
|
7
|
+
Wrapper class to define and run a Molecular Dynamics (MD) job
|
|
8
|
+
from a Python script. This replaces mdmain.py.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
def __init__(self, input_file):
|
|
12
|
+
"""
|
|
13
|
+
Initializes the MD job settings.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
input_file (str): The input psi4 file path.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
if not isinstance(input_file, str):
|
|
20
|
+
raise TypeError("input_file must be a string.")
|
|
21
|
+
|
|
22
|
+
self.input_args = [input_file]
|
|
23
|
+
|
|
24
|
+
# Get default args using the modified mdparser
|
|
25
|
+
parser = multioptpy.interface.init_parser()
|
|
26
|
+
self.args = multioptpy.interface.mdparser(parser, self.input_args)
|
|
27
|
+
|
|
28
|
+
self._md_instance = None
|
|
29
|
+
|
|
30
|
+
def set_option(self, key, value):
|
|
31
|
+
"""Sets a single MD job option."""
|
|
32
|
+
if not hasattr(self.args, key):
|
|
33
|
+
print(f"Warning: Option '{key}' is not a default argparse argument.")
|
|
34
|
+
setattr(self.args, key, value)
|
|
35
|
+
print(f"Set option: {key} = {value}")
|
|
36
|
+
|
|
37
|
+
def set_options(self, **kwargs):
|
|
38
|
+
"""Sets multiple MD job options using keyword arguments."""
|
|
39
|
+
print("Setting multiple job options...")
|
|
40
|
+
for key, value in kwargs.items():
|
|
41
|
+
self.set_option(key, value)
|
|
42
|
+
|
|
43
|
+
def run(self):
|
|
44
|
+
"""Executes the MD job."""
|
|
45
|
+
print("\n--- Starting MultiOptPy MD Job ---")
|
|
46
|
+
print("Final Settings (args):")
|
|
47
|
+
for key, value in vars(self.args).items():
|
|
48
|
+
print(f" {key}: {value}")
|
|
49
|
+
print("----------------------------------")
|
|
50
|
+
|
|
51
|
+
try:
|
|
52
|
+
self._md_instance = multioptpy.moleculardynamics.MD(self.args)
|
|
53
|
+
self._md_instance.run()
|
|
54
|
+
print("--- MultiOptPy Job Finished Successfully ---")
|
|
55
|
+
except Exception as e:
|
|
56
|
+
print(f"--- MultiOptPy Job FAILED ---")
|
|
57
|
+
print(f"An error occurred: {e}")
|
|
58
|
+
raise
|
|
59
|
+
|
|
60
|
+
def get_results(self):
|
|
61
|
+
"""RetrieVes the MD instance after the job has been run."""
|
|
62
|
+
if not self._md_instance:
|
|
63
|
+
print("Error: .run() must be called before get_results().")
|
|
64
|
+
return None
|
|
65
|
+
return self._md_instance
|
|
66
|
+
|
|
67
|
+
# --- Example Usage ---
|
|
68
|
+
if __name__ == "__main__":
|
|
69
|
+
print("=== Example: Defining an MD Job ===")
|
|
70
|
+
|
|
71
|
+
# 1. Define the job
|
|
72
|
+
md_job = MDJob(input_file="my_md_input.psi4")
|
|
73
|
+
|
|
74
|
+
# 2. Configure the job
|
|
75
|
+
md_job.set_options(
|
|
76
|
+
usextb="GFN2-xTB",
|
|
77
|
+
NSTEP=1000, # 1000 fs
|
|
78
|
+
temperature=300.0,
|
|
79
|
+
timestep=0.5 # 0.5 au
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
print("\n--- Job Configuration Complete ---")
|
|
83
|
+
print(f"Input file: {md_job.args.INPUT}")
|
|
84
|
+
print(f"Timesteps: {md_job.args.NSTEP}")
|
|
85
|
+
|
|
86
|
+
# 3. To run, uncomment:
|
|
87
|
+
# try:
|
|
88
|
+
# md_job.run()
|
|
89
|
+
# except FileNotFoundError:
|
|
90
|
+
# print("\nError: Input file not found. Job skipped.")
|
|
91
|
+
# except Exception as e:
|
|
92
|
+
# print(f"\nAn error occurred during job execution: {e}")
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
|
|
2
|
+
import multioptpy.interface
|
|
3
|
+
import multioptpy.neb
|
|
4
|
+
|
|
5
|
+
class NEBJob:
|
|
6
|
+
"""
|
|
7
|
+
Wrapper class to define and run a Nudged Elastic Band (NEB) job
|
|
8
|
+
from a Python script. This replaces nebmain.py.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
def __init__(self, input_files):
|
|
12
|
+
"""
|
|
13
|
+
Initializes the NEB job settings.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
input_files (list):
|
|
17
|
+
A list of input file paths (e.g., ["reactant.xyz", "product.xyz"]
|
|
18
|
+
or ["img1.xyz", "img2.xyz", ...]).
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
if not isinstance(input_files, list) or len(input_files) == 0:
|
|
22
|
+
raise TypeError("input_files must be a non-empty list of strings.")
|
|
23
|
+
|
|
24
|
+
self.input_args = input_files
|
|
25
|
+
|
|
26
|
+
# Get default args using the modified nebparser
|
|
27
|
+
parser = multioptpy.interface.init_parser()
|
|
28
|
+
self.args = multioptpy.interface.nebparser(parser, self.input_args)
|
|
29
|
+
|
|
30
|
+
self._neb_instance = None
|
|
31
|
+
|
|
32
|
+
def set_option(self, key, value):
|
|
33
|
+
"""Sets a single NEB job option."""
|
|
34
|
+
if not hasattr(self.args, key):
|
|
35
|
+
print(f"Warning: Option '{key}' is not a default argparse argument.")
|
|
36
|
+
setattr(self.args, key, value)
|
|
37
|
+
print(f"Set option: {key} = {value}")
|
|
38
|
+
|
|
39
|
+
def set_options(self, **kwargs):
|
|
40
|
+
"""Sets multiple NEB job options using keyword arguments."""
|
|
41
|
+
print("Setting multiple job options...")
|
|
42
|
+
for key, value in kwargs.items():
|
|
43
|
+
self.set_option(key, value)
|
|
44
|
+
|
|
45
|
+
def run(self):
|
|
46
|
+
"""Executes the NEB job."""
|
|
47
|
+
print("\n--- Starting MultiOptPy NEB Job ---")
|
|
48
|
+
print("Final Settings (args):")
|
|
49
|
+
for key, value in vars(self.args).items():
|
|
50
|
+
print(f" {key}: {value}")
|
|
51
|
+
print("-----------------------------------")
|
|
52
|
+
|
|
53
|
+
try:
|
|
54
|
+
self._neb_instance = multioptpy.neb.NEB(self.args)
|
|
55
|
+
self._neb_instance.run()
|
|
56
|
+
print("--- MultiOptPy Job Finished Successfully ---")
|
|
57
|
+
except Exception as e:
|
|
58
|
+
print(f"--- MultiOptPy Job FAILED ---")
|
|
59
|
+
print(f"An error occurred: {e}")
|
|
60
|
+
raise
|
|
61
|
+
|
|
62
|
+
def get_results(self):
|
|
63
|
+
"""Retrieves the NEB instance after the job has been run."""
|
|
64
|
+
if not self._neb_instance:
|
|
65
|
+
print("Error: .run() must be called before get_results().")
|
|
66
|
+
return None
|
|
67
|
+
return self._neb_instance
|
|
68
|
+
|
|
69
|
+
# --- Example Usage ---
|
|
70
|
+
if __name__ == "__main__":
|
|
71
|
+
print("=== Example: Defining a NEB Job ===")
|
|
72
|
+
|
|
73
|
+
# 1. Define the job
|
|
74
|
+
neb_job = NEBJob(input_files=["reactant.xyz", "product.xyz"])
|
|
75
|
+
|
|
76
|
+
# 2. Configure the job
|
|
77
|
+
neb_job.set_options(
|
|
78
|
+
usextb="GFN2-xTB",
|
|
79
|
+
NSTEP=100,
|
|
80
|
+
partition=8, # 8 intermediate images
|
|
81
|
+
apply_CI_NEB=5 # Apply CI-NEB after 5 steps
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
print("\n--- Job Configuration Complete ---")
|
|
85
|
+
print(f"Input files: {neb_job.args.INPUT}")
|
|
86
|
+
print(f"Images: {neb_job.args.partition}")
|
|
87
|
+
|
|
88
|
+
# 3. To run, uncomment:
|
|
89
|
+
# try:
|
|
90
|
+
# neb_job.run()
|
|
91
|
+
# except FileNotFoundError:
|
|
92
|
+
# print("\nError: Input file(s) not found. Job skipped.")
|
|
93
|
+
# except Exception as e:
|
|
94
|
+
# print(f"\nAn error occurred during job execution: {e}")
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
|
|
2
|
+
import multioptpy.interface
|
|
3
|
+
import multioptpy.optimization
|
|
4
|
+
|
|
5
|
+
class OptimizationJob:
|
|
6
|
+
"""
|
|
7
|
+
A wrapper class to define and run a multioptpy optimization job
|
|
8
|
+
from a Python script. This replaces optmain.py.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
def __init__(self, input_file):
|
|
12
|
+
"""
|
|
13
|
+
Initializes the optimization job settings.
|
|
14
|
+
(Omitted for brevity...)
|
|
15
|
+
"""
|
|
16
|
+
if isinstance(input_file, str):
|
|
17
|
+
self.input_args = [input_file]
|
|
18
|
+
elif isinstance(input_file, list):
|
|
19
|
+
self.input_args = input_file
|
|
20
|
+
else:
|
|
21
|
+
raise TypeError("input_file must be a string or a list of strings.")
|
|
22
|
+
parser = multioptpy.interface.init_parser()
|
|
23
|
+
self.args = multioptpy.interface.optimizeparser(parser, self.input_args)
|
|
24
|
+
self._optimizer = None
|
|
25
|
+
|
|
26
|
+
def set_option(self, key, value):
|
|
27
|
+
"""
|
|
28
|
+
Sets a single optimization job option.
|
|
29
|
+
(Omitted for brevity...)
|
|
30
|
+
"""
|
|
31
|
+
if not hasattr(self.args, key):
|
|
32
|
+
print(f"Warning: Option '{key}' is not a default argparse argument.")
|
|
33
|
+
setattr(self.args, key, value)
|
|
34
|
+
print(f"Set option: {key} = {value}")
|
|
35
|
+
|
|
36
|
+
def set_options(self, **kwargs):
|
|
37
|
+
"""
|
|
38
|
+
Sets multiple optimization job options using keyword arguments.
|
|
39
|
+
(Omitted for brevity...)
|
|
40
|
+
"""
|
|
41
|
+
print("Setting multiple job options...")
|
|
42
|
+
for key, value in kwargs.items():
|
|
43
|
+
self.set_option(key, value)
|
|
44
|
+
|
|
45
|
+
def run(self):
|
|
46
|
+
"""
|
|
47
|
+
Executes the optimization job.
|
|
48
|
+
(Omitted for brevity...)
|
|
49
|
+
"""
|
|
50
|
+
print("\n--- Starting MultiOptPy Optimization Job ---")
|
|
51
|
+
print("Final Settings (args):")
|
|
52
|
+
for key, value in vars(self.args).items():
|
|
53
|
+
print(f" {key}: {value}")
|
|
54
|
+
print("--------------------------------------------")
|
|
55
|
+
try:
|
|
56
|
+
self._optimizer = multioptpy.optimization.Optimize(self.args)
|
|
57
|
+
self._optimizer.run()
|
|
58
|
+
print("--- MultiOptPy Job Finished Successfully ---")
|
|
59
|
+
except Exception as e:
|
|
60
|
+
print(f"--- MultiOptPy Job FAILED ---")
|
|
61
|
+
print(f"An error occurred: {e}")
|
|
62
|
+
raise
|
|
63
|
+
|
|
64
|
+
def get_results(self):
|
|
65
|
+
"""
|
|
66
|
+
Returns the internal optimizer instance after the job has run.
|
|
67
|
+
This instance contains the new file path methods.
|
|
68
|
+
"""
|
|
69
|
+
if not self._optimizer:
|
|
70
|
+
print("Error: .run() must be called before get_results().")
|
|
71
|
+
return None
|
|
72
|
+
|
|
73
|
+
# Return the instance itself, so we can call
|
|
74
|
+
# .get_result_file_path() on it
|
|
75
|
+
return self._optimizer
|
|
76
|
+
|