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.
Files changed (246) hide show
  1. multioptpy/Calculator/__init__.py +0 -0
  2. multioptpy/Calculator/ase_calculation_tools.py +424 -0
  3. multioptpy/Calculator/ase_tools/__init__.py +0 -0
  4. multioptpy/Calculator/ase_tools/fairchem.py +28 -0
  5. multioptpy/Calculator/ase_tools/gamess.py +19 -0
  6. multioptpy/Calculator/ase_tools/gaussian.py +165 -0
  7. multioptpy/Calculator/ase_tools/mace.py +28 -0
  8. multioptpy/Calculator/ase_tools/mopac.py +19 -0
  9. multioptpy/Calculator/ase_tools/nwchem.py +31 -0
  10. multioptpy/Calculator/ase_tools/orca.py +22 -0
  11. multioptpy/Calculator/ase_tools/pygfn0.py +37 -0
  12. multioptpy/Calculator/dxtb_calculation_tools.py +344 -0
  13. multioptpy/Calculator/emt_calculation_tools.py +458 -0
  14. multioptpy/Calculator/gpaw_calculation_tools.py +183 -0
  15. multioptpy/Calculator/lj_calculation_tools.py +314 -0
  16. multioptpy/Calculator/psi4_calculation_tools.py +334 -0
  17. multioptpy/Calculator/pwscf_calculation_tools.py +189 -0
  18. multioptpy/Calculator/pyscf_calculation_tools.py +327 -0
  19. multioptpy/Calculator/sqm1_calculation_tools.py +611 -0
  20. multioptpy/Calculator/sqm2_calculation_tools.py +376 -0
  21. multioptpy/Calculator/tblite_calculation_tools.py +352 -0
  22. multioptpy/Calculator/tersoff_calculation_tools.py +818 -0
  23. multioptpy/Constraint/__init__.py +0 -0
  24. multioptpy/Constraint/constraint_condition.py +834 -0
  25. multioptpy/Coordinate/__init__.py +0 -0
  26. multioptpy/Coordinate/polar_coordinate.py +199 -0
  27. multioptpy/Coordinate/redundant_coordinate.py +638 -0
  28. multioptpy/IRC/__init__.py +0 -0
  29. multioptpy/IRC/converge_criteria.py +28 -0
  30. multioptpy/IRC/dvv.py +544 -0
  31. multioptpy/IRC/euler.py +439 -0
  32. multioptpy/IRC/hpc.py +564 -0
  33. multioptpy/IRC/lqa.py +540 -0
  34. multioptpy/IRC/modekill.py +662 -0
  35. multioptpy/IRC/rk4.py +579 -0
  36. multioptpy/Interpolation/__init__.py +0 -0
  37. multioptpy/Interpolation/adaptive_interpolation.py +283 -0
  38. multioptpy/Interpolation/binomial_interpolation.py +179 -0
  39. multioptpy/Interpolation/geodesic_interpolation.py +785 -0
  40. multioptpy/Interpolation/interpolation.py +156 -0
  41. multioptpy/Interpolation/linear_interpolation.py +473 -0
  42. multioptpy/Interpolation/savitzky_golay_interpolation.py +252 -0
  43. multioptpy/Interpolation/spline_interpolation.py +353 -0
  44. multioptpy/MD/__init__.py +0 -0
  45. multioptpy/MD/thermostat.py +185 -0
  46. multioptpy/MEP/__init__.py +0 -0
  47. multioptpy/MEP/pathopt_bneb_force.py +443 -0
  48. multioptpy/MEP/pathopt_dmf_force.py +448 -0
  49. multioptpy/MEP/pathopt_dneb_force.py +130 -0
  50. multioptpy/MEP/pathopt_ewbneb_force.py +207 -0
  51. multioptpy/MEP/pathopt_gpneb_force.py +512 -0
  52. multioptpy/MEP/pathopt_lup_force.py +113 -0
  53. multioptpy/MEP/pathopt_neb_force.py +225 -0
  54. multioptpy/MEP/pathopt_nesb_force.py +205 -0
  55. multioptpy/MEP/pathopt_om_force.py +153 -0
  56. multioptpy/MEP/pathopt_qsm_force.py +174 -0
  57. multioptpy/MEP/pathopt_qsmv2_force.py +304 -0
  58. multioptpy/ModelFunction/__init__.py +7 -0
  59. multioptpy/ModelFunction/avoiding_model_function.py +29 -0
  60. multioptpy/ModelFunction/binary_image_ts_search_model_function.py +47 -0
  61. multioptpy/ModelFunction/conical_model_function.py +26 -0
  62. multioptpy/ModelFunction/opt_meci.py +50 -0
  63. multioptpy/ModelFunction/opt_mesx.py +47 -0
  64. multioptpy/ModelFunction/opt_mesx_2.py +49 -0
  65. multioptpy/ModelFunction/seam_model_function.py +27 -0
  66. multioptpy/ModelHessian/__init__.py +0 -0
  67. multioptpy/ModelHessian/approx_hessian.py +147 -0
  68. multioptpy/ModelHessian/calc_params.py +227 -0
  69. multioptpy/ModelHessian/fischer.py +236 -0
  70. multioptpy/ModelHessian/fischerd3.py +360 -0
  71. multioptpy/ModelHessian/fischerd4.py +398 -0
  72. multioptpy/ModelHessian/gfn0xtb.py +633 -0
  73. multioptpy/ModelHessian/gfnff.py +709 -0
  74. multioptpy/ModelHessian/lindh.py +165 -0
  75. multioptpy/ModelHessian/lindh2007d2.py +707 -0
  76. multioptpy/ModelHessian/lindh2007d3.py +822 -0
  77. multioptpy/ModelHessian/lindh2007d4.py +1030 -0
  78. multioptpy/ModelHessian/morse.py +106 -0
  79. multioptpy/ModelHessian/schlegel.py +144 -0
  80. multioptpy/ModelHessian/schlegeld3.py +322 -0
  81. multioptpy/ModelHessian/schlegeld4.py +559 -0
  82. multioptpy/ModelHessian/shortrange.py +346 -0
  83. multioptpy/ModelHessian/swartd2.py +496 -0
  84. multioptpy/ModelHessian/swartd3.py +706 -0
  85. multioptpy/ModelHessian/swartd4.py +918 -0
  86. multioptpy/ModelHessian/tshess.py +40 -0
  87. multioptpy/Optimizer/QHAdam.py +61 -0
  88. multioptpy/Optimizer/__init__.py +0 -0
  89. multioptpy/Optimizer/abc_fire.py +83 -0
  90. multioptpy/Optimizer/adabelief.py +58 -0
  91. multioptpy/Optimizer/adabound.py +68 -0
  92. multioptpy/Optimizer/adadelta.py +65 -0
  93. multioptpy/Optimizer/adaderivative.py +56 -0
  94. multioptpy/Optimizer/adadiff.py +68 -0
  95. multioptpy/Optimizer/adafactor.py +70 -0
  96. multioptpy/Optimizer/adam.py +65 -0
  97. multioptpy/Optimizer/adamax.py +62 -0
  98. multioptpy/Optimizer/adamod.py +83 -0
  99. multioptpy/Optimizer/adamw.py +65 -0
  100. multioptpy/Optimizer/adiis.py +523 -0
  101. multioptpy/Optimizer/afire_neb.py +282 -0
  102. multioptpy/Optimizer/block_hessian_update.py +709 -0
  103. multioptpy/Optimizer/c2diis.py +491 -0
  104. multioptpy/Optimizer/component_wise_scaling.py +405 -0
  105. multioptpy/Optimizer/conjugate_gradient.py +82 -0
  106. multioptpy/Optimizer/conjugate_gradient_neb.py +345 -0
  107. multioptpy/Optimizer/coordinate_locking.py +405 -0
  108. multioptpy/Optimizer/dic_rsirfo.py +1015 -0
  109. multioptpy/Optimizer/ediis.py +417 -0
  110. multioptpy/Optimizer/eve.py +76 -0
  111. multioptpy/Optimizer/fastadabelief.py +61 -0
  112. multioptpy/Optimizer/fire.py +77 -0
  113. multioptpy/Optimizer/fire2.py +249 -0
  114. multioptpy/Optimizer/fire_neb.py +92 -0
  115. multioptpy/Optimizer/gan_step.py +486 -0
  116. multioptpy/Optimizer/gdiis.py +609 -0
  117. multioptpy/Optimizer/gediis.py +203 -0
  118. multioptpy/Optimizer/geodesic_step.py +433 -0
  119. multioptpy/Optimizer/gpmin.py +633 -0
  120. multioptpy/Optimizer/gpr_step.py +364 -0
  121. multioptpy/Optimizer/gradientdescent.py +78 -0
  122. multioptpy/Optimizer/gradientdescent_neb.py +52 -0
  123. multioptpy/Optimizer/hessian_update.py +433 -0
  124. multioptpy/Optimizer/hybrid_rfo.py +998 -0
  125. multioptpy/Optimizer/kdiis.py +625 -0
  126. multioptpy/Optimizer/lars.py +21 -0
  127. multioptpy/Optimizer/lbfgs.py +253 -0
  128. multioptpy/Optimizer/lbfgs_neb.py +355 -0
  129. multioptpy/Optimizer/linesearch.py +236 -0
  130. multioptpy/Optimizer/lookahead.py +40 -0
  131. multioptpy/Optimizer/nadam.py +64 -0
  132. multioptpy/Optimizer/newton.py +200 -0
  133. multioptpy/Optimizer/prodigy.py +70 -0
  134. multioptpy/Optimizer/purtubation.py +16 -0
  135. multioptpy/Optimizer/quickmin_neb.py +245 -0
  136. multioptpy/Optimizer/radam.py +75 -0
  137. multioptpy/Optimizer/rfo_neb.py +302 -0
  138. multioptpy/Optimizer/ric_rfo.py +842 -0
  139. multioptpy/Optimizer/rl_step.py +627 -0
  140. multioptpy/Optimizer/rmspropgrave.py +65 -0
  141. multioptpy/Optimizer/rsirfo.py +1647 -0
  142. multioptpy/Optimizer/rsprfo.py +1056 -0
  143. multioptpy/Optimizer/sadam.py +60 -0
  144. multioptpy/Optimizer/samsgrad.py +63 -0
  145. multioptpy/Optimizer/tr_lbfgs.py +678 -0
  146. multioptpy/Optimizer/trim.py +273 -0
  147. multioptpy/Optimizer/trust_radius.py +207 -0
  148. multioptpy/Optimizer/trust_radius_neb.py +121 -0
  149. multioptpy/Optimizer/yogi.py +60 -0
  150. multioptpy/OtherMethod/__init__.py +0 -0
  151. multioptpy/OtherMethod/addf.py +1150 -0
  152. multioptpy/OtherMethod/dimer.py +895 -0
  153. multioptpy/OtherMethod/elastic_image_pair.py +629 -0
  154. multioptpy/OtherMethod/modelfunction.py +456 -0
  155. multioptpy/OtherMethod/newton_traj.py +454 -0
  156. multioptpy/OtherMethod/twopshs.py +1095 -0
  157. multioptpy/PESAnalyzer/__init__.py +0 -0
  158. multioptpy/PESAnalyzer/calc_irc_curvature.py +125 -0
  159. multioptpy/PESAnalyzer/cmds_analysis.py +152 -0
  160. multioptpy/PESAnalyzer/koopman_analysis.py +268 -0
  161. multioptpy/PESAnalyzer/pca_analysis.py +314 -0
  162. multioptpy/Parameters/__init__.py +0 -0
  163. multioptpy/Parameters/atomic_mass.py +20 -0
  164. multioptpy/Parameters/atomic_number.py +22 -0
  165. multioptpy/Parameters/covalent_radii.py +44 -0
  166. multioptpy/Parameters/d2.py +61 -0
  167. multioptpy/Parameters/d3.py +63 -0
  168. multioptpy/Parameters/d4.py +103 -0
  169. multioptpy/Parameters/dreiding.py +34 -0
  170. multioptpy/Parameters/gfn0xtb_param.py +137 -0
  171. multioptpy/Parameters/gfnff_param.py +315 -0
  172. multioptpy/Parameters/gnb.py +104 -0
  173. multioptpy/Parameters/parameter.py +22 -0
  174. multioptpy/Parameters/uff.py +72 -0
  175. multioptpy/Parameters/unit_values.py +20 -0
  176. multioptpy/Potential/AFIR_potential.py +55 -0
  177. multioptpy/Potential/LJ_repulsive_potential.py +345 -0
  178. multioptpy/Potential/__init__.py +0 -0
  179. multioptpy/Potential/anharmonic_keep_potential.py +28 -0
  180. multioptpy/Potential/asym_elllipsoidal_potential.py +718 -0
  181. multioptpy/Potential/electrostatic_potential.py +69 -0
  182. multioptpy/Potential/flux_potential.py +30 -0
  183. multioptpy/Potential/gaussian_potential.py +101 -0
  184. multioptpy/Potential/idpp.py +516 -0
  185. multioptpy/Potential/keep_angle_potential.py +146 -0
  186. multioptpy/Potential/keep_dihedral_angle_potential.py +105 -0
  187. multioptpy/Potential/keep_outofplain_angle_potential.py +70 -0
  188. multioptpy/Potential/keep_potential.py +99 -0
  189. multioptpy/Potential/mechano_force_potential.py +74 -0
  190. multioptpy/Potential/nanoreactor_potential.py +52 -0
  191. multioptpy/Potential/potential.py +896 -0
  192. multioptpy/Potential/spacer_model_potential.py +221 -0
  193. multioptpy/Potential/switching_potential.py +258 -0
  194. multioptpy/Potential/universal_potential.py +34 -0
  195. multioptpy/Potential/value_range_potential.py +36 -0
  196. multioptpy/Potential/void_point_potential.py +25 -0
  197. multioptpy/SQM/__init__.py +0 -0
  198. multioptpy/SQM/sqm1/__init__.py +0 -0
  199. multioptpy/SQM/sqm1/sqm1_core.py +1792 -0
  200. multioptpy/SQM/sqm2/__init__.py +0 -0
  201. multioptpy/SQM/sqm2/calc_tools.py +95 -0
  202. multioptpy/SQM/sqm2/sqm2_basis.py +850 -0
  203. multioptpy/SQM/sqm2/sqm2_bond.py +119 -0
  204. multioptpy/SQM/sqm2/sqm2_core.py +303 -0
  205. multioptpy/SQM/sqm2/sqm2_data.py +1229 -0
  206. multioptpy/SQM/sqm2/sqm2_disp.py +65 -0
  207. multioptpy/SQM/sqm2/sqm2_eeq.py +243 -0
  208. multioptpy/SQM/sqm2/sqm2_overlapint.py +704 -0
  209. multioptpy/SQM/sqm2/sqm2_qm.py +578 -0
  210. multioptpy/SQM/sqm2/sqm2_rep.py +66 -0
  211. multioptpy/SQM/sqm2/sqm2_srb.py +70 -0
  212. multioptpy/Thermo/__init__.py +0 -0
  213. multioptpy/Thermo/normal_mode_analyzer.py +865 -0
  214. multioptpy/Utils/__init__.py +0 -0
  215. multioptpy/Utils/bond_connectivity.py +264 -0
  216. multioptpy/Utils/calc_tools.py +884 -0
  217. multioptpy/Utils/oniom.py +96 -0
  218. multioptpy/Utils/pbc.py +48 -0
  219. multioptpy/Utils/riemann_curvature.py +208 -0
  220. multioptpy/Utils/symmetry_analyzer.py +482 -0
  221. multioptpy/Visualization/__init__.py +0 -0
  222. multioptpy/Visualization/visualization.py +156 -0
  223. multioptpy/WFAnalyzer/MO_analysis.py +104 -0
  224. multioptpy/WFAnalyzer/__init__.py +0 -0
  225. multioptpy/Wrapper/__init__.py +0 -0
  226. multioptpy/Wrapper/autots.py +1239 -0
  227. multioptpy/Wrapper/ieip_wrapper.py +93 -0
  228. multioptpy/Wrapper/md_wrapper.py +92 -0
  229. multioptpy/Wrapper/neb_wrapper.py +94 -0
  230. multioptpy/Wrapper/optimize_wrapper.py +76 -0
  231. multioptpy/__init__.py +5 -0
  232. multioptpy/entrypoints.py +916 -0
  233. multioptpy/fileio.py +660 -0
  234. multioptpy/ieip.py +340 -0
  235. multioptpy/interface.py +1086 -0
  236. multioptpy/irc.py +529 -0
  237. multioptpy/moleculardynamics.py +432 -0
  238. multioptpy/neb.py +1267 -0
  239. multioptpy/optimization.py +1553 -0
  240. multioptpy/optimizer.py +709 -0
  241. multioptpy-1.20.2.dist-info/METADATA +438 -0
  242. multioptpy-1.20.2.dist-info/RECORD +246 -0
  243. multioptpy-1.20.2.dist-info/WHEEL +5 -0
  244. multioptpy-1.20.2.dist-info/entry_points.txt +9 -0
  245. multioptpy-1.20.2.dist-info/licenses/LICENSE +674 -0
  246. multioptpy-1.20.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,105 @@
1
+
2
+ from multioptpy.Parameters.parameter import UnitValueLib
3
+ from multioptpy.Utils.calc_tools import torch_calc_dihedral_angle_from_vec
4
+ import torch
5
+
6
+ class StructKeepDihedralAnglePotential:
7
+ def __init__(self, **kwarg):
8
+ self.config = kwarg
9
+ UVL = UnitValueLib()
10
+ self.hartree2kcalmol = UVL.hartree2kcalmol
11
+ self.bohr2angstroms = UVL.bohr2angstroms
12
+ self.hartree2kjmol = UVL.hartree2kjmol
13
+ return
14
+ def calc_energy(self, geom_num_list, bias_pot_params=[]):
15
+ """
16
+ # required variables: self.config["keep_dihedral_angle_spring_const"],
17
+ self.config["keep_dihedral_angle_atom_pairs"]
18
+ self.config["keep_dihedral_angle_angle"]
19
+ bias_pot_params[0] : keep_dihedral_angle_spring_const
20
+ bias_pot_params[1] : keep_dihedral_angle_angle
21
+ """
22
+ a1 = geom_num_list[self.config["keep_dihedral_angle_atom_pairs"][1]-1] - geom_num_list[self.config["keep_dihedral_angle_atom_pairs"][0]-1]
23
+ a2 = geom_num_list[self.config["keep_dihedral_angle_atom_pairs"][2]-1] - geom_num_list[self.config["keep_dihedral_angle_atom_pairs"][1]-1]
24
+ a3 = geom_num_list[self.config["keep_dihedral_angle_atom_pairs"][3]-1] - geom_num_list[self.config["keep_dihedral_angle_atom_pairs"][2]-1]
25
+
26
+ angle = torch.abs(torch_calc_dihedral_angle_from_vec(a1, a2, a3))
27
+ if len(bias_pot_params) == 0:
28
+ energy = 0.5 * self.config["keep_dihedral_angle_spring_const"] * (angle - torch.deg2rad(torch.tensor(self.config["keep_dihedral_angle_angle"]))) ** 2
29
+ else:
30
+ energy = 0.5 * bias_pot_params[0] * (angle - torch.deg2rad(bias_pot_params[1])) ** 2
31
+
32
+ return energy #hartree
33
+
34
+
35
+ class StructKeepDihedralAnglePotentialv2:
36
+ def __init__(self, **kwarg):
37
+ self.config = kwarg
38
+ UVL = UnitValueLib()
39
+ self.hartree2kcalmol = UVL.hartree2kcalmol
40
+ self.bohr2angstroms = UVL.bohr2angstroms
41
+ self.hartree2kjmol = UVL.hartree2kjmol
42
+ return
43
+ def calc_energy(self, geom_num_list, bias_pot_params=[]):
44
+ """
45
+ # required variables: self.config["keep_dihedral_angle_v2_spring_const"],
46
+ self.config["keep_dihedral_angle_v2_angle"],
47
+ self.config["keep_dihedral_angle_v2_fragm1"],
48
+ self.config["keep_dihedral_angle_v2_fragm2"],
49
+ self.config["keep_dihedral_angle_v2_fragm3"],
50
+ self.config["keep_dihedral_angle_v2_fragm4"],
51
+ bias_pot_params[0] : keep_dihedral_angle_v2_spring_const
52
+ bias_pot_params[1] : keep_dihedral_angle_v2_angle
53
+ """
54
+ fragm_1_center = torch.mean(geom_num_list[torch.tensor(self.config["keep_dihedral_angle_v2_fragm1"]) - 1], dim=0)
55
+ fragm_2_center = torch.mean(geom_num_list[torch.tensor(self.config["keep_dihedral_angle_v2_fragm2"]) - 1], dim=0)
56
+ fragm_3_center = torch.mean(geom_num_list[torch.tensor(self.config["keep_dihedral_angle_v2_fragm3"]) - 1], dim=0)
57
+ fragm_4_center = torch.mean(geom_num_list[torch.tensor(self.config["keep_dihedral_angle_v2_fragm4"]) - 1], dim=0)
58
+
59
+ a1 = fragm_2_center - fragm_1_center
60
+ a2 = fragm_3_center - fragm_2_center
61
+ a3 = fragm_4_center - fragm_3_center
62
+
63
+ angle = torch.abs(torch_calc_dihedral_angle_from_vec(a1, a2, a3))
64
+ if len(bias_pot_params) == 0:
65
+ energy = 0.5 * self.config["keep_dihedral_angle_v2_spring_const"] * (angle - torch.deg2rad(torch.tensor(self.config["keep_dihedral_angle_v2_angle"]))) ** 2
66
+ else:
67
+ energy = 0.5 * bias_pot_params[0] * (angle - torch.deg2rad(bias_pot_params[1])) ** 2
68
+ return energy #hartree
69
+
70
+ class StructKeepDihedralAnglePotentialCos:
71
+ def __init__(self, **kwarg):
72
+ self.config = kwarg
73
+ UVL = UnitValueLib()
74
+ self.hartree2kcalmol = UVL.hartree2kcalmol
75
+ self.bohr2angstroms = UVL.bohr2angstroms
76
+ self.hartree2kjmol = UVL.hartree2kjmol
77
+ return
78
+ def calc_energy(self, geom_num_list, bias_pot_params=[]):
79
+ """
80
+ # required variables: self.config["keep_dihedral_angle_cos_potential_const"],
81
+ self.config["keep_dihedral_angle_cos_angle_const"],
82
+ self.config["keep_dihedral_angle_cos_angle"],
83
+ self.config["keep_dihedral_angle_cos_fragm1"],
84
+ self.config["keep_dihedral_angle_cos_fragm2"],
85
+ self.config["keep_dihedral_angle_cos_fragm3"],
86
+ self.config["keep_dihedral_angle_cos_fragm4"],
87
+
88
+ """
89
+ potential_const = float(self.config["keep_dihedral_angle_cos_potential_const"])
90
+ angle_const = float(self.config["keep_dihedral_angle_cos_angle_const"])
91
+
92
+
93
+ fragm_1_center = torch.mean(geom_num_list[torch.tensor(self.config["keep_dihedral_angle_cos_fragm1"]) - 1], dim=0)
94
+ fragm_2_center = torch.mean(geom_num_list[torch.tensor(self.config["keep_dihedral_angle_cos_fragm2"]) - 1], dim=0)
95
+ fragm_3_center = torch.mean(geom_num_list[torch.tensor(self.config["keep_dihedral_angle_cos_fragm3"]) - 1], dim=0)
96
+ fragm_4_center = torch.mean(geom_num_list[torch.tensor(self.config["keep_dihedral_angle_cos_fragm4"]) - 1], dim=0)
97
+
98
+ a1 = fragm_2_center - fragm_1_center
99
+ a2 = fragm_3_center - fragm_2_center
100
+ a3 = fragm_4_center - fragm_3_center
101
+
102
+ angle = torch_calc_dihedral_angle_from_vec(a1, a2, a3)
103
+ energy = 0.5 * potential_const * (1.0 -1* torch.cos(angle_const * angle - (torch.deg2rad(torch.tensor(self.config["keep_dihedral_angle_cos_angle"])))))
104
+
105
+ return energy #hartree
@@ -0,0 +1,70 @@
1
+
2
+ from multioptpy.Parameters.parameter import UnitValueLib
3
+ from multioptpy.Utils.calc_tools import torch_calc_outofplain_angle_from_vec
4
+ import torch
5
+
6
+
7
+ class StructKeepOutofPlainAnglePotential:
8
+ def __init__(self, **kwarg):
9
+ self.config = kwarg
10
+ UVL = UnitValueLib()
11
+ self.hartree2kcalmol = UVL.hartree2kcalmol
12
+ self.bohr2angstroms = UVL.bohr2angstroms
13
+ self.hartree2kjmol = UVL.hartree2kjmol
14
+ return
15
+ def calc_energy(self, geom_num_list, bias_pot_params=[]):
16
+ """
17
+ # required variables: self.config["keep_out_of_plain_angle_spring_const"],
18
+ self.config["keep_out_of_plain_angle_atom_pairs"]
19
+ self.config["keep_out_of_plain_angle_angle"]
20
+ bias_pot_params[0] : keep_out_of_plain_angle_spring_const
21
+ bias_pot_params[1] : keep_out_of_plain_angle_angle
22
+
23
+ """
24
+ a1 = geom_num_list[self.config["keep_out_of_plain_angle_atom_pairs"][1]-1] - geom_num_list[self.config["keep_out_of_plain_angle_atom_pairs"][0]-1]
25
+ a2 = geom_num_list[self.config["keep_out_of_plain_angle_atom_pairs"][2]-1] - geom_num_list[self.config["keep_out_of_plain_angle_atom_pairs"][0]-1]
26
+ a3 = geom_num_list[self.config["keep_out_of_plain_angle_atom_pairs"][3]-1] - geom_num_list[self.config["keep_out_of_plain_angle_atom_pairs"][0]-1]
27
+
28
+ angle = torch_calc_outofplain_angle_from_vec(a1, a2, a3)
29
+ if len(bias_pot_params) == 0:
30
+ energy = 0.5 * self.config["keep_out_of_plain_angle_spring_const"] * (angle - torch.deg2rad(torch.tensor(self.config["keep_out_of_plain_angle_angle"]))) ** 2
31
+ else:
32
+ energy = 0.5 * bias_pot_params[0] * (angle - torch.deg2rad(bias_pot_params[1])) ** 2
33
+ return energy #hartree
34
+
35
+ class StructKeepOutofPlainAnglePotentialv2:
36
+ def __init__(self, **kwarg):
37
+ self.config = kwarg
38
+ UVL = UnitValueLib()
39
+ self.hartree2kcalmol = UVL.hartree2kcalmol
40
+ self.bohr2angstroms = UVL.bohr2angstroms
41
+ self.hartree2kjmol = UVL.hartree2kjmol
42
+ return
43
+
44
+ def calc_energy(self, geom_num_list, bias_pot_params=[]):
45
+ """
46
+ # required variables: self.config["keep_out_of_plain_angle_v2_spring_const"],
47
+ self.config["keep_out_of_plain_angle_v2_angle"],
48
+ self.config["keep_out_of_plain_angle_v2_fragm1"],
49
+ self.config["keep_out_of_plain_angle_v2_fragm2"],
50
+ self.config["keep_out_of_plain_angle_v2_fragm3"],
51
+ self.config["keep_out_of_plain_angle_v2_fragm4"],
52
+
53
+ """
54
+ fragm_1_center = torch.mean(geom_num_list[torch.tensor(self.config["keep_out_of_plain_angle_v2_fragm1"]) - 1], dim=0)
55
+ fragm_2_center = torch.mean(geom_num_list[torch.tensor(self.config["keep_out_of_plain_angle_v2_fragm2"]) - 1], dim=0)
56
+ fragm_3_center = torch.mean(geom_num_list[torch.tensor(self.config["keep_out_of_plain_angle_v2_fragm3"]) - 1], dim=0)
57
+ fragm_4_center = torch.mean(geom_num_list[torch.tensor(self.config["keep_out_of_plain_angle_v2_fragm4"]) - 1], dim=0)
58
+
59
+
60
+ a1 = fragm_2_center - fragm_1_center
61
+ a2 = fragm_3_center - fragm_1_center
62
+ a3 = fragm_4_center - fragm_1_center
63
+
64
+ angle = torch_calc_outofplain_angle_from_vec(a1, a2, a3)
65
+ if len(bias_pot_params) == 0:
66
+ energy = 0.5 * self.config["keep_out_of_plain_angle_v2_spring_const"] * (angle - torch.deg2rad(torch.tensor(self.config["keep_out_of_plain_angle_v2_angle"]))) ** 2
67
+ else:
68
+ energy = 0.5 * bias_pot_params[0] * (angle - torch.deg2rad(bias_pot_params[1])) ** 2
69
+ return energy #hartree
70
+
@@ -0,0 +1,99 @@
1
+
2
+ from multioptpy.Parameters.parameter import UnitValueLib
3
+ import torch
4
+
5
+ class StructKeepPotential:
6
+ def __init__(self, **kwarg):
7
+ self.config = kwarg
8
+ UVL = UnitValueLib()
9
+ self.hartree2kcalmol = UVL.hartree2kcalmol
10
+ self.bohr2angstroms = UVL.bohr2angstroms
11
+ self.hartree2kjmol = UVL.hartree2kjmol
12
+ return
13
+
14
+ def calc_energy(self, geom_num_list, bias_pot_params=[]):
15
+ """
16
+ # required variables: self.config["keep_pot_spring_const"],
17
+ self.config["keep_pot_distance"],
18
+ self.config["keep_pot_atom_pairs"],
19
+ bias_pot_params[0] : keep_pot_spring_const
20
+ bias_pot_params[1] : keep_pot_distance
21
+ """
22
+ vector = torch.linalg.norm((geom_num_list[self.config["keep_pot_atom_pairs"][0]-1] - geom_num_list[self.config["keep_pot_atom_pairs"][1]-1]), ord=2)
23
+ if len(bias_pot_params) == 0:
24
+ energy = 0.5 * self.config["keep_pot_spring_const"] * (vector - self.config["keep_pot_distance"]/self.bohr2angstroms) ** 2
25
+ else:
26
+ energy = 0.5 * bias_pot_params[0] * (vector - bias_pot_params[1]/self.bohr2angstroms) ** 2
27
+ return energy #hartree
28
+
29
+ class StructKeepPotentialv2:
30
+ def __init__(self, **kwarg):
31
+ self.config = kwarg
32
+ UVL = UnitValueLib()
33
+ self.hartree2kcalmol = UVL.hartree2kcalmol
34
+ self.bohr2angstroms = UVL.bohr2angstroms
35
+ self.hartree2kjmol = UVL.hartree2kjmol
36
+ return
37
+ def calc_energy(self, geom_num_list, bias_pot_params=[]):
38
+ """
39
+ # required variables: self.config["keep_pot_v2_spring_const"],
40
+ self.config["keep_pot_v2_distance"],
41
+ self.config["keep_pot_v2_fragm1"],
42
+ self.config["keep_pot_v2_fragm2"],
43
+ bias_pot_params[0] : keep_pot_v2_spring_const
44
+ bias_pot_params[1] : keep_pot_v2_distance
45
+ """
46
+ fragm_1_indices = torch.tensor(self.config["keep_pot_v2_fragm1"]) - 1
47
+ fragm_2_indices = torch.tensor(self.config["keep_pot_v2_fragm2"]) - 1
48
+
49
+ fragm_1_center = torch.mean(geom_num_list[fragm_1_indices], dim=0)
50
+ fragm_2_center = torch.mean(geom_num_list[fragm_2_indices], dim=0)
51
+
52
+ distance = torch.linalg.norm(fragm_1_center - fragm_2_center, ord=2)
53
+ if len(bias_pot_params) == 0:
54
+ energy = 0.5 * self.config["keep_pot_v2_spring_const"] * (distance - self.config["keep_pot_v2_distance"]/self.bohr2angstroms) ** 2
55
+
56
+ else:
57
+ energy = 0.5 * bias_pot_params[0] * (distance - bias_pot_params[1]/self.bohr2angstroms) ** 2
58
+
59
+ return energy #hartree
60
+
61
+ class StructKeepPotentialAniso:
62
+ def __init__(self, **kwarg):
63
+ self.config = kwarg
64
+ UVL = UnitValueLib()
65
+ self.hartree2kcalmol = UVL.hartree2kcalmol
66
+ self.bohr2angstroms = UVL.bohr2angstroms
67
+ self.hartree2kjmol = UVL.hartree2kjmol
68
+ return
69
+ def calc_energy(self, geom_num_list, bias_pot_params=[]):
70
+ """
71
+ # required variables: self.config["aniso_keep_pot_v2_spring_const_mat"]
72
+ self.config["aniso_keep_pot_v2_dist"]
73
+ self.config["aniso_keep_pot_v2_fragm1"]
74
+ self.config["aniso_keep_pot_v2_fragm2"]
75
+
76
+ """
77
+ fragm_1_center = torch.tensor([0.0, 0.0, 0.0], dtype=torch.float64, requires_grad=True)
78
+ for i in self.config["aniso_keep_pot_v2_fragm1"]:
79
+ fragm_1_center = fragm_1_center + geom_num_list[i-1]
80
+
81
+ fragm_1_center = fragm_1_center / len(self.config["aniso_keep_pot_v2_fragm1"])
82
+
83
+ fragm_2_center = torch.tensor([0.0, 0.0, 0.0], dtype=torch.float64, requires_grad=True)
84
+ for i in self.config["aniso_keep_pot_v2_fragm2"]:
85
+ fragm_2_center = fragm_2_center + geom_num_list[i-1]
86
+
87
+ fragm_2_center = fragm_2_center / len(self.config["aniso_keep_pot_v2_fragm2"])
88
+ x_dist = torch.abs(fragm_1_center[0] - fragm_2_center[0])
89
+ y_dist = torch.abs(fragm_1_center[1] - fragm_2_center[1])
90
+ z_dist = torch.abs(fragm_1_center[2] - fragm_2_center[2])
91
+ eq_dist = self.config["aniso_keep_pot_v2_dist"] / (3 ** 0.5) / self.bohr2angstroms
92
+ dist_vec = torch.stack([(x_dist - eq_dist) ** 2,(y_dist - eq_dist) ** 2,(z_dist - eq_dist) ** 2])
93
+ dist_vec = torch.reshape(dist_vec, (3, 1))
94
+ vec_pot = torch.matmul(torch.tensor(self.config["aniso_keep_pot_v2_spring_const_mat"], dtype=torch.float32), dist_vec)
95
+
96
+ energy = torch.sum(vec_pot)
97
+
98
+
99
+ return energy #hartree
@@ -0,0 +1,74 @@
1
+ from multioptpy.Parameters.parameter import UnitValueLib
2
+
3
+ import torch
4
+
5
+ class LinearMechanoForcePotential:
6
+ def __init__(self, **kwarg):
7
+ #ref: J. Am. Chem. Soc. 2009, 131, 18, 6377–6379
8
+ #https://doi.org/10.1021/ja8095834
9
+ #FMPES
10
+ # This implementation is not tested yet.
11
+ self.config = kwarg
12
+ UVL = UnitValueLib()
13
+ self.hartree2kcalmol = UVL.hartree2kcalmol
14
+ self.bohr2angstroms = UVL.bohr2angstroms
15
+ self.hartree2kjmol = UVL.hartree2kjmol
16
+ self.pN2au = 1.213 * 10 ** (-5)
17
+ return
18
+
19
+ def calc_energy(self, geom_num_list, bias_pot_params=[]):
20
+ """
21
+ # required variables: self.config["linear_mechano_force"],
22
+ self.config["linear_mechano_force_atoms_1"],
23
+ self.config["linear_mechano_force_atoms_2"],
24
+ bias_pot_params[0] : linear_mechano_force
25
+ """
26
+ direction_1 = geom_num_list[self.config["linear_mechano_force_atoms_1"][1] - 1] - geom_num_list[self.config["linear_mechano_force_atoms_1"][0] - 1]
27
+ direction_2 = geom_num_list[self.config["linear_mechano_force_atoms_2"][1] - 1] - geom_num_list[self.config["linear_mechano_force_atoms_2"][0] - 1]
28
+ norm_direction_1 = torch.linalg.norm(direction_1)
29
+ norm_direction_2 = torch.linalg.norm(direction_2)
30
+ unit_direction_1 = direction_1 / norm_direction_1
31
+ unit_direction_2 = direction_2 / norm_direction_2
32
+
33
+ if len(bias_pot_params) == 0:
34
+ force_magnitude = 0.5 * self.config["linear_mechano_force"] * self.pN2au
35
+ energy = force_magnitude * torch.sum(unit_direction_1) + force_magnitude * torch.sum(unit_direction_2)
36
+ else:
37
+ force_magnitude = 0.5 * self.pN2au * bias_pot_params[0]
38
+ energy = force_magnitude * torch.sum(unit_direction_1) + force_magnitude * torch.sum(unit_direction_2)
39
+ return energy #hartree
40
+
41
+
42
+ class LinearMechanoForcePotentialv2:
43
+ def __init__(self, **kwarg):
44
+ #ref: J. Am. Chem. Soc. 2009, 131, 18, 6377–6379
45
+ #https://doi.org/10.1021/ja8095834
46
+ #FMPES
47
+ # This implementation is not tested yet.
48
+ self.config = kwarg
49
+ UVL = UnitValueLib()
50
+ self.hartree2kcalmol = UVL.hartree2kcalmol
51
+ self.bohr2angstroms = UVL.bohr2angstroms
52
+ self.hartree2kjmol = UVL.hartree2kjmol
53
+ self.pN2au = 1.213 * 10 ** (-5)
54
+ return
55
+
56
+ def calc_energy(self, geom_num_list, bias_pot_params=[]):
57
+ """
58
+ # required variables: self.config["linear_mechano_force_v2"],
59
+ self.config["linear_mechano_force_atom_v2"],
60
+ bias_pot_params[0] : linear_mechano_force_v2
61
+ """
62
+
63
+ direction = geom_num_list[self.config["linear_mechano_force_atom_v2"][0] - 1] - geom_num_list[self.config["linear_mechano_force_atom_v2"][1] - 1]
64
+ norm_direction = torch.linalg.norm(direction)
65
+
66
+ if len(bias_pot_params) == 0:
67
+ force_magnitude = self.config["linear_mechano_force"] * self.pN2au
68
+ energy = -1 * force_magnitude * norm_direction
69
+ else:
70
+ force_magnitude = self.pN2au * bias_pot_params[0]
71
+ energy = -1 * force_magnitude * norm_direction
72
+
73
+ return energy #hartree
74
+
@@ -0,0 +1,52 @@
1
+
2
+ from multioptpy.Parameters.parameter import UnitValueLib, atomic_mass
3
+
4
+ import torch
5
+
6
+
7
+
8
+ class NanoReactorPotential:
9
+ def __init__(self, **kwarg):
10
+ # ref.:https://doi.org/10.1038/nchem.2099, https://doi.org/10.1021/acs.jctc.4c00826
11
+ self.config = kwarg
12
+ UVL = UnitValueLib()
13
+ self.hartree2kcalmol = UVL.hartree2kcalmol
14
+ self.bohr2angstroms = UVL.bohr2angstroms
15
+ self.hartree2kjmol = UVL.hartree2kjmol
16
+ self.au2sec = UVL.au2sec
17
+ self.inner_wall = torch.tensor(self.config["inner_wall"] / self.bohr2angstroms, dtype=torch.float64)
18
+ self.outer_wall = torch.tensor(self.config["outer_wall"] / self.bohr2angstroms, dtype=torch.float64)
19
+ self.contraction_time = torch.tensor(self.config["contraction_time"] * 10 ** -12 / self.au2sec, dtype=torch.float64) #pico-sec to au
20
+ self.expansion_time = torch.tensor(self.config["expansion_time"] * 10 ** -12 / self.au2sec, dtype=torch.float64) #pico-sec to au
21
+
22
+ self.contraction_force_const = self.config["contraction_force_const"] / self.hartree2kcalmol * self.bohr2angstroms ** 2 # kcal/mol/A^2 to hartree/bohr^2
23
+ self.expansion_force_const = self.config["expansion_force_const"] / self.hartree2kcalmol * self.bohr2angstroms ** 2 # kcal/mol/A^2 to hartree/bohr^2
24
+ self.element_list = self.config["element_list"]
25
+ self.atom_mass_list = torch.tensor([[atomic_mass(element)] for element in self.element_list], dtype=torch.float64)
26
+
27
+ return
28
+
29
+ def calc_energy(self, geom_num_list, time):#geom_num_list: (n_atoms, 3), bohr time: au
30
+ """
31
+ # required variables: self.inner_wall,
32
+ self.outer_wall,
33
+ self.contraction_time,
34
+ self.expansion_time,
35
+ self.contraction_force_const,
36
+ self.expansion_force_const,
37
+ self.element_list
38
+ """
39
+ distance_list = torch.linalg.norm(geom_num_list, ord=2, dim=1).reshape(-1, 1)
40
+ distance_inner = distance_list - self.inner_wall
41
+ distance_outer = distance_list - self.outer_wall
42
+
43
+ f_t = torch.heaviside(torch.floor(time / (self.contraction_time + self.expansion_time)) - (time / (self.contraction_time + self.expansion_time)) + (self.contraction_time / (self.contraction_time + self.expansion_time)), torch.tensor(0.5, dtype=torch.float64))
44
+
45
+
46
+ U_c = torch.where(distance_list < self.inner_wall, self.atom_mass_list * 0.5 * self.contraction_force_const * distance_inner ** 2, torch.zeros_like(distance_inner))
47
+
48
+ U_e = torch.where(distance_list > self.outer_wall, self.atom_mass_list * 0.5 * self.contraction_force_const * distance_outer ** 2,
49
+ torch.where(distance_list < self.inner_wall, self.atom_mass_list * 0.5 * self.expansion_force_const * distance_inner ** 2, torch.zeros_like(distance_list)))
50
+ energy = torch.sum(f_t * U_c + (1.0 - f_t) * U_e)
51
+ return energy #hartree
52
+