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,314 @@
|
|
|
1
|
+
import glob
|
|
2
|
+
import matplotlib.pyplot as plt
|
|
3
|
+
import itertools
|
|
4
|
+
import numpy as np
|
|
5
|
+
import copy
|
|
6
|
+
|
|
7
|
+
from multioptpy.Utils.calc_tools import Calculationtools
|
|
8
|
+
from multioptpy.Parameters.parameter import atomic_mass
|
|
9
|
+
from multioptpy.Coordinate.redundant_coordinate import cartesian_to_z_matrix
|
|
10
|
+
|
|
11
|
+
### These are toy functions. ###
|
|
12
|
+
class PCAPathAnalysis:
|
|
13
|
+
def __init__(self, directory, energy_list, bias_energy_list):
|
|
14
|
+
self.directory = directory
|
|
15
|
+
energy_list = np.array(energy_list)
|
|
16
|
+
self.energy_list = energy_list - energy_list[0]
|
|
17
|
+
bias_energy_list = np.array(bias_energy_list)
|
|
18
|
+
self.bias_energy_list = bias_energy_list - bias_energy_list[0]
|
|
19
|
+
self.modredundant = True
|
|
20
|
+
|
|
21
|
+
return
|
|
22
|
+
|
|
23
|
+
def read_xyz_file(self, struct_path_1, struct_path_2):
|
|
24
|
+
|
|
25
|
+
with open(struct_path_1, "r") as f:
|
|
26
|
+
words_1 = f.read().splitlines()
|
|
27
|
+
|
|
28
|
+
with open(struct_path_2, "r") as f:
|
|
29
|
+
words_2 = f.read().splitlines()
|
|
30
|
+
|
|
31
|
+
mass_weight_coord_1 = []
|
|
32
|
+
element_list = []
|
|
33
|
+
for word in words_1:
|
|
34
|
+
splited_word = word.split()
|
|
35
|
+
if len(splited_word) != 4:
|
|
36
|
+
continue
|
|
37
|
+
tmp = np.sqrt(atomic_mass(splited_word[0])) * np.array(splited_word[1:4], dtype="float64")
|
|
38
|
+
mass_weight_coord_1.append(tmp)
|
|
39
|
+
element_list.append(splited_word[0])
|
|
40
|
+
mass_weight_coord_2 = []
|
|
41
|
+
for word in words_2:
|
|
42
|
+
splited_word = word.split()
|
|
43
|
+
if len(splited_word) != 4:
|
|
44
|
+
continue
|
|
45
|
+
tmp = np.sqrt(atomic_mass(splited_word[0])) * np.array(splited_word[1:4], dtype="float64")
|
|
46
|
+
mass_weight_coord_2.append(tmp)
|
|
47
|
+
|
|
48
|
+
mass_weight_coord_1 = np.array(mass_weight_coord_1, dtype="float64")
|
|
49
|
+
mass_weight_coord_2 = np.array(mass_weight_coord_2, dtype="float64")
|
|
50
|
+
|
|
51
|
+
return mass_weight_coord_1, mass_weight_coord_2, element_list
|
|
52
|
+
|
|
53
|
+
def pca_visualization(self, result_list, energy_list, name=""):
|
|
54
|
+
plt.xlabel("PC1 (ang. / amu^0.5)")
|
|
55
|
+
plt.ylabel("PC2 (ang. / amu^0.5)")
|
|
56
|
+
plt.title("PCA result ("+name+")")
|
|
57
|
+
|
|
58
|
+
x_array = np.array(result_list[0])
|
|
59
|
+
y_array = np.array(result_list[1])
|
|
60
|
+
xmin = min(x_array)
|
|
61
|
+
xmax = max(x_array)
|
|
62
|
+
ymin = min(y_array)
|
|
63
|
+
ymax = max(y_array)
|
|
64
|
+
delta_x = xmax - xmin
|
|
65
|
+
delta_y = ymax - ymin
|
|
66
|
+
plt.xlim(xmin-(delta_x/5), xmax+(delta_x/5))
|
|
67
|
+
plt.ylim(ymin-(delta_y/5), ymax+(delta_y/5))
|
|
68
|
+
for i in range(len(energy_list[:-1])):
|
|
69
|
+
data = plt.scatter(x_array[i], y_array[i], c=energy_list[i], vmin=min(energy_list), vmax=max(energy_list), cmap='jet', s=25, marker="o", linewidths=0.1, edgecolors="black")
|
|
70
|
+
plt.colorbar(data, label=name+" (kcal/mol)")
|
|
71
|
+
plt.savefig(self.directory+"pca_result_visualization_"+str(name)+".png" ,dpi=300,format="png")
|
|
72
|
+
plt.close()
|
|
73
|
+
return
|
|
74
|
+
|
|
75
|
+
def main(self):
|
|
76
|
+
print("processing PCA analysis to aprrox. reaction path ...")
|
|
77
|
+
file_list = sorted(glob.glob(self.directory+"samples_*_[0-9]/*.xyz")) + sorted(glob.glob(self.directory+"samples_*_[0-9][0-9]/*.xyz")) + sorted(glob.glob(self.directory+"samples_*_[0-9][0-9][0-9]/*.xyz")) + sorted(glob.glob(self.directory+"samples_*_[0-9][0-9][0-9][0-9]/*.xyz")) + sorted(glob.glob(self.directory+"samples_*_[0-9][0-9][0-9][0-9][0-9]/*.xyz")) + sorted(glob.glob(self.directory+"samples_*_[0-9][0-9][0-9][0-9][0-9][0-9]/*.xyz"))
|
|
78
|
+
file_list = file_list[1:]
|
|
79
|
+
struct_num = len(file_list)
|
|
80
|
+
|
|
81
|
+
stack_coord = None
|
|
82
|
+
dist_stack_coord = None
|
|
83
|
+
z_mat_stack_coord = None
|
|
84
|
+
|
|
85
|
+
for i in range(struct_num - 1):
|
|
86
|
+
mass_weight_coord_1, mass_weight_coord_2, element_list = self.read_xyz_file(file_list[i], file_list[i+1])
|
|
87
|
+
modified_coord_1, modified_coord_2 = Calculationtools().kabsch_algorithm(mass_weight_coord_1, mass_weight_coord_2)
|
|
88
|
+
tmp_dist = np.linalg.norm(modified_coord_1[:, np.newaxis] - modified_coord_1[np.newaxis, :], axis=2)
|
|
89
|
+
tmp_dist_2 = np.linalg.norm(modified_coord_2[:, np.newaxis] - modified_coord_2[np.newaxis, :], axis=2)
|
|
90
|
+
|
|
91
|
+
modified_coord_1 = modified_coord_1.reshape(1, 3*len(modified_coord_1)) # (1, N)
|
|
92
|
+
modified_coord_2 = modified_coord_2.reshape(1, 3*len(modified_coord_2))
|
|
93
|
+
if i == 0:
|
|
94
|
+
stack_coord = copy.copy(modified_coord_1)
|
|
95
|
+
upper_triangle_indices = np.triu_indices_from(tmp_dist, k=1)
|
|
96
|
+
upper_triangle_distances = tmp_dist[upper_triangle_indices]
|
|
97
|
+
upper_triangle_distances = upper_triangle_distances.reshape(1, -1)
|
|
98
|
+
dist_stack_coord = copy.copy(upper_triangle_distances)
|
|
99
|
+
z_mat_stack_coord = cartesian_to_z_matrix(modified_coord_1.reshape(-1, 3)).reshape(1, -1)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
upper_triangle_indices = np.triu_indices_from(tmp_dist_2, k=1)
|
|
103
|
+
upper_triangle_distances = tmp_dist_2[upper_triangle_indices]
|
|
104
|
+
upper_triangle_distances = upper_triangle_distances.reshape(1, -1)
|
|
105
|
+
stack_coord = np.vstack((stack_coord, modified_coord_2)) # (M, N)
|
|
106
|
+
dist_stack_coord = np.vstack((dist_stack_coord, upper_triangle_distances))
|
|
107
|
+
z_mat_stack_coord = np.vstack((z_mat_stack_coord, cartesian_to_z_matrix(modified_coord_2.reshape(-1, 3)).reshape(1, -1)))
|
|
108
|
+
|
|
109
|
+
stack_coord_meams = np.mean(stack_coord, axis=0)
|
|
110
|
+
stack_coord_std = np.std(stack_coord, axis=0)
|
|
111
|
+
stack_coord_standardized = (stack_coord - stack_coord_meams) / stack_coord_std # (M, N)
|
|
112
|
+
stack_coord_cov = 1 / (struct_num - 1) * np.dot(stack_coord_standardized.T, stack_coord_standardized) # (N, M) * (M, N)
|
|
113
|
+
eigenvalues, eigenvectors = np.linalg.eig(stack_coord_cov)
|
|
114
|
+
|
|
115
|
+
eigenvalues = np.real_if_close(eigenvalues, tol=1000)
|
|
116
|
+
eigenvectors = np.real_if_close(eigenvectors, tol=1000).T
|
|
117
|
+
|
|
118
|
+
eigval_sorted_indices = np.argsort(eigenvalues)
|
|
119
|
+
|
|
120
|
+
sum_of_eigenvalue = 0.0
|
|
121
|
+
for value in eigenvalues:
|
|
122
|
+
if value < 0:
|
|
123
|
+
continue
|
|
124
|
+
sum_of_eigenvalue += value
|
|
125
|
+
|
|
126
|
+
print("### cartesian coordinate PCA analysis ###")
|
|
127
|
+
print("dimensional reproducibility:", np.sum(eigenvalues)/sum_of_eigenvalue)
|
|
128
|
+
print("Percentage contribution 1:", eigenvalues[eigval_sorted_indices[-1]]/sum_of_eigenvalue)
|
|
129
|
+
print("Percentage contribution 2:", eigenvalues[eigval_sorted_indices[-2]]/sum_of_eigenvalue)
|
|
130
|
+
print("Percentage contribution 3:", eigenvalues[eigval_sorted_indices[-3]]/sum_of_eigenvalue)
|
|
131
|
+
|
|
132
|
+
PC1 = np.sum(eigenvectors[eigval_sorted_indices[-1]] * stack_coord, axis=1)
|
|
133
|
+
PC2 = np.sum(eigenvectors[eigval_sorted_indices[-2]] * stack_coord, axis=1)
|
|
134
|
+
|
|
135
|
+
result_list = np.vstack((PC1, PC2))
|
|
136
|
+
|
|
137
|
+
self.save_log_result(eigval_sorted_indices, eigenvalues, eigenvectors, element_list)
|
|
138
|
+
|
|
139
|
+
self.pca_visualization(result_list, self.energy_list, name="energy")
|
|
140
|
+
self.pca_visualization(result_list, self.bias_energy_list, name="bias_energy")
|
|
141
|
+
|
|
142
|
+
print("### redundant coordinate (only atom distance) PCA analysis ###")
|
|
143
|
+
dist_stack_coord_means = np.mean(dist_stack_coord, axis=0)
|
|
144
|
+
dist_stack_coord_std = np.std(dist_stack_coord, axis=0)
|
|
145
|
+
dist_stack_coord_standardized = (dist_stack_coord - dist_stack_coord_means) / dist_stack_coord_std # (M, N)
|
|
146
|
+
dist_stack_coord_cov = 1 / (struct_num - 1) * np.dot(dist_stack_coord_standardized.T, dist_stack_coord_standardized) # (N, M) * (M, N)
|
|
147
|
+
dist_eigenvalues, dist_eigenvectors = np.linalg.eig(dist_stack_coord_cov)
|
|
148
|
+
|
|
149
|
+
dist_eigenvalues = np.real_if_close(dist_eigenvalues, tol=1000)
|
|
150
|
+
dist_eigenvectors = np.real_if_close(dist_eigenvectors, tol=1000).T
|
|
151
|
+
|
|
152
|
+
dist_eigval_sorted_indices = np.argsort(dist_eigenvalues)
|
|
153
|
+
|
|
154
|
+
dist_sum_of_eigenvalue = 0.0
|
|
155
|
+
for value in dist_eigenvalues:
|
|
156
|
+
if value < 0:
|
|
157
|
+
continue
|
|
158
|
+
dist_sum_of_eigenvalue += value
|
|
159
|
+
|
|
160
|
+
print("dimensional reproducibility:", np.sum(dist_eigenvalues)/dist_sum_of_eigenvalue)
|
|
161
|
+
print("Percentage contribution 1:", dist_eigenvalues[dist_eigval_sorted_indices[-1]]/dist_sum_of_eigenvalue)
|
|
162
|
+
print("Percentage contribution 2:", dist_eigenvalues[dist_eigval_sorted_indices[-2]]/dist_sum_of_eigenvalue)
|
|
163
|
+
print("Percentage contribution 3:", dist_eigenvalues[dist_eigval_sorted_indices[-3]]/dist_sum_of_eigenvalue)
|
|
164
|
+
|
|
165
|
+
PC1 = np.sum(dist_eigenvectors[dist_eigval_sorted_indices[-1]] * dist_stack_coord, axis=1)
|
|
166
|
+
PC2 = np.sum(dist_eigenvectors[dist_eigval_sorted_indices[-2]] * dist_stack_coord, axis=1)
|
|
167
|
+
|
|
168
|
+
result_list = np.vstack((PC1, PC2))
|
|
169
|
+
self.save_log_result_for_redundant(dist_eigval_sorted_indices, dist_eigenvalues, dist_eigenvectors, element_list)
|
|
170
|
+
self.pca_visualization(result_list, self.energy_list, name="redundant_energy")
|
|
171
|
+
self.pca_visualization(result_list, self.bias_energy_list, name="redundant_bias_energy")
|
|
172
|
+
|
|
173
|
+
print("### redundant coordinate (z-matrix) PCA analysis ###")
|
|
174
|
+
|
|
175
|
+
z_mat_stack_coord_means = np.mean(z_mat_stack_coord, axis=0)
|
|
176
|
+
z_mat_stack_coord_std = np.std(z_mat_stack_coord, axis=0) + 1e-15
|
|
177
|
+
z_mat_stack_coord_standardized = (z_mat_stack_coord - z_mat_stack_coord_means) / z_mat_stack_coord_std # (M, N)
|
|
178
|
+
z_mat_stack_coord_cov = 1 / (struct_num - 1) * np.dot(z_mat_stack_coord_standardized.T, z_mat_stack_coord_standardized) # (N, M) * (M, N)
|
|
179
|
+
z_mat_eigenvalues, z_mat_eigenvectors = np.linalg.eig(z_mat_stack_coord_cov)
|
|
180
|
+
|
|
181
|
+
z_mat_eigenvalues = np.real_if_close(z_mat_eigenvalues, tol=1000)
|
|
182
|
+
z_mat_eigenvectors = np.real_if_close(z_mat_eigenvectors, tol=1000).T
|
|
183
|
+
|
|
184
|
+
z_mat_eigval_sorted_indices = np.argsort(z_mat_eigenvalues)
|
|
185
|
+
|
|
186
|
+
z_mat_sum_of_eigenvalue = 0.0
|
|
187
|
+
for value in z_mat_eigenvalues:
|
|
188
|
+
if value < 0:
|
|
189
|
+
continue
|
|
190
|
+
z_mat_sum_of_eigenvalue += value
|
|
191
|
+
|
|
192
|
+
print("dimensional reproducibility:", np.sum(z_mat_eigenvalues)/z_mat_sum_of_eigenvalue)
|
|
193
|
+
print("Percentage contribution 1:", z_mat_eigenvalues[z_mat_eigval_sorted_indices[-1]]/z_mat_sum_of_eigenvalue)
|
|
194
|
+
print("Percentage contribution 2:", z_mat_eigenvalues[z_mat_eigval_sorted_indices[-2]]/z_mat_sum_of_eigenvalue)
|
|
195
|
+
print("Percentage contribution 3:", z_mat_eigenvalues[z_mat_eigval_sorted_indices[-3]]/z_mat_sum_of_eigenvalue)
|
|
196
|
+
|
|
197
|
+
PC1 = np.sum(z_mat_eigenvectors[z_mat_eigval_sorted_indices[-1]] * z_mat_stack_coord, axis=1)
|
|
198
|
+
PC2 = np.sum(z_mat_eigenvectors[z_mat_eigval_sorted_indices[-2]] * z_mat_stack_coord, axis=1)
|
|
199
|
+
|
|
200
|
+
result_list = np.vstack((PC1, PC2))
|
|
201
|
+
self.save_log_result_for_z_mat(z_mat_eigval_sorted_indices, z_mat_eigenvalues, z_mat_eigenvectors, element_list)
|
|
202
|
+
self.pca_visualization(result_list, self.energy_list, name="z_matrix_energy")
|
|
203
|
+
self.pca_visualization(result_list, self.bias_energy_list, name="z_matrix_bias_energy")
|
|
204
|
+
|
|
205
|
+
print("PCA analysis completed...")
|
|
206
|
+
return
|
|
207
|
+
|
|
208
|
+
def save_log_result(self, eigval_sorted_indices, eigenvalues, eigenvectors, element_list):
|
|
209
|
+
contribution_list = eigenvalues / np.sum(eigenvalues)
|
|
210
|
+
|
|
211
|
+
with open(self.directory+"pca_analysis_result.log", "w") as f:
|
|
212
|
+
f.write("********************************************\n")
|
|
213
|
+
f.write("* *\n")
|
|
214
|
+
f.write("* PCA analysis for approx. reaction path *\n")
|
|
215
|
+
f.write("* *\n")
|
|
216
|
+
f.write("********************************************\n\n")
|
|
217
|
+
for i in range(len(contribution_list)):
|
|
218
|
+
f.write("-----\n")
|
|
219
|
+
f.write("basis "+str(i)+"\n")
|
|
220
|
+
contribution_of_eigvec = np.abs(eigenvectors[eigval_sorted_indices[-(i+1)]]) / np.sum(np.abs(eigenvectors[eigval_sorted_indices[-(i+1)]]))
|
|
221
|
+
f.write("contribution: "+str(contribution_list[eigval_sorted_indices[-(i+1)]])+"\n")
|
|
222
|
+
f.write(" vector contribution of vector\n")
|
|
223
|
+
for j in range(len(element_list)):
|
|
224
|
+
f.write(str(3*j+0)+" "+str(j+1)+" "+element_list[j]+" - x : "+str(eigenvectors[eigval_sorted_indices[-(i+1)]][3*j+0])+" "+str(contribution_of_eigvec[3*j+0])+"\n")
|
|
225
|
+
f.write(str(3*j+1)+" "+str(j+1)+" "+element_list[j]+" - y : "+str(eigenvectors[eigval_sorted_indices[-(i+1)]][3*j+1])+" "+str(contribution_of_eigvec[3*j+1])+"\n")
|
|
226
|
+
f.write(str(3*j+2)+" "+str(j+1)+" "+element_list[j]+" - z : "+str(eigenvectors[eigval_sorted_indices[-(i+1)]][3*j+2])+" "+str(contribution_of_eigvec[3*j+2])+"\n")
|
|
227
|
+
tmp_argsort = np.argsort(contribution_of_eigvec)
|
|
228
|
+
f.write(f"{tmp_argsort[-1]} {contribution_of_eigvec[tmp_argsort[-1]]} {tmp_argsort[-2]} {contribution_of_eigvec[tmp_argsort[-2]]} {tmp_argsort[-3]} {contribution_of_eigvec[tmp_argsort[-3]]} \n")
|
|
229
|
+
if len(tmp_argsort) > 3:
|
|
230
|
+
f.write(f"{tmp_argsort[-4]} {contribution_of_eigvec[tmp_argsort[-4]]} {tmp_argsort[-5]} {contribution_of_eigvec[tmp_argsort[-5]]} {tmp_argsort[-6]} {contribution_of_eigvec[tmp_argsort[-6]]} \n")
|
|
231
|
+
if len(tmp_argsort) > 6:
|
|
232
|
+
f.write(f"{tmp_argsort[-7]} {contribution_of_eigvec[tmp_argsort[-7]]} {tmp_argsort[-8]} {contribution_of_eigvec[tmp_argsort[-8]]} {tmp_argsort[-9]} {contribution_of_eigvec[tmp_argsort[-9]]} \n")
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
f.write("-----\n")
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
return
|
|
240
|
+
|
|
241
|
+
def save_log_result_for_redundant(self, eigval_sorted_indices, eigenvalues, eigenvectors, element_list):
|
|
242
|
+
contribution_list = eigenvalues / np.sum(eigenvalues)
|
|
243
|
+
|
|
244
|
+
with open(self.directory+"pca_analysis_result_redundant.log", "w") as f:
|
|
245
|
+
f.write("********************************************\n")
|
|
246
|
+
f.write("* *\n")
|
|
247
|
+
f.write("* PCA analysis for approx. reaction path *\n")
|
|
248
|
+
f.write("* redundant coordinates *\n")
|
|
249
|
+
f.write("* (only atom distances) *\n")
|
|
250
|
+
f.write("* *\n")
|
|
251
|
+
f.write("********************************************\n\n")
|
|
252
|
+
for i in range(len(contribution_list)):
|
|
253
|
+
f.write("-----\n")
|
|
254
|
+
f.write("basis "+str(i)+"\n")
|
|
255
|
+
contribution_of_eigvec = np.abs(eigenvectors[eigval_sorted_indices[-(i+1)]]) / np.sum(np.abs(eigenvectors[eigval_sorted_indices[-(i+1)]]))
|
|
256
|
+
f.write("contribution: "+str(contribution_list[eigval_sorted_indices[-(i+1)]])+"\n")
|
|
257
|
+
f.write(" vector contribution of vector\n")
|
|
258
|
+
count = 0
|
|
259
|
+
for j, k in list(itertools.combinations([l for l in range(len(element_list))], 2)):
|
|
260
|
+
f.write(str(count)+" "+str(j+1)+" "+element_list[j]+" - "+str(k+1)+" "+element_list[k]+" : "+str(eigenvectors[eigval_sorted_indices[-(i+1)]][count])+" "+str(contribution_of_eigvec[count])+"\n")
|
|
261
|
+
count += 1
|
|
262
|
+
|
|
263
|
+
tmp_argsort = np.argsort(contribution_of_eigvec)
|
|
264
|
+
f.write(f"{tmp_argsort[-1]} {contribution_of_eigvec[tmp_argsort[-1]]} {tmp_argsort[-2]} {contribution_of_eigvec[tmp_argsort[-2]]} {tmp_argsort[-3]} {contribution_of_eigvec[tmp_argsort[-3]]} \n")
|
|
265
|
+
|
|
266
|
+
f.write("-----\n")
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
return
|
|
270
|
+
def save_log_result_for_z_mat(self, eigval_sorted_indices, eigenvalues, eigenvectors, element_list):
|
|
271
|
+
contribution_list = eigenvalues / np.sum(eigenvalues)
|
|
272
|
+
|
|
273
|
+
with open(self.directory+"pca_analysis_result_z_matrix.log", "w") as f:
|
|
274
|
+
f.write("********************************************\n")
|
|
275
|
+
f.write("* *\n")
|
|
276
|
+
f.write("* PCA analysis for approx. reaction path *\n")
|
|
277
|
+
f.write("* redundant coordinates *\n")
|
|
278
|
+
f.write("* (z-matrix) *\n")
|
|
279
|
+
f.write("* *\n")
|
|
280
|
+
f.write("********************************************\n\n")
|
|
281
|
+
for i in range(len(contribution_list)):
|
|
282
|
+
f.write("-----\n")
|
|
283
|
+
f.write("basis "+str(i)+"\n")
|
|
284
|
+
contribution_of_eigvec = np.abs(eigenvectors[eigval_sorted_indices[-(i+1)]]) / np.sum(np.abs(eigenvectors[eigval_sorted_indices[-(i+1)]]))
|
|
285
|
+
f.write("contribution: "+str(contribution_list[eigval_sorted_indices[-(i+1)]])+"\n")
|
|
286
|
+
f.write(" vector contribution of vector\n")
|
|
287
|
+
bond_count = 0
|
|
288
|
+
angle_count = 0
|
|
289
|
+
dihedral_count = 0
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
for count in range(len(eigenvectors[eigval_sorted_indices[-(i+1)]])):
|
|
293
|
+
if count == 0 or count == 1 or (count % 3 == 0 and count > 2):
|
|
294
|
+
label = "bond "+str(bond_count+1)+" "+str(bond_count+2)
|
|
295
|
+
bond_count += 1
|
|
296
|
+
|
|
297
|
+
elif count == 2 or (count % 3 == 1 and count > 2):
|
|
298
|
+
label = "angle "+str(angle_count+1)+" "+str(angle_count+2)+" "+str(angle_count+3)
|
|
299
|
+
angle_count += 1
|
|
300
|
+
|
|
301
|
+
else:
|
|
302
|
+
label = "dihedral "+str(dihedral_count+1)+" "+str(dihedral_count+2)+" "+str(dihedral_count+3)+" "+str(dihedral_count+4)
|
|
303
|
+
dihedral_count += 1
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
f.write(str(count)+" "+label+" : "+str(eigenvectors[eigval_sorted_indices[-(i+1)]][count])+" "+str(contribution_of_eigvec[count])+"\n")
|
|
307
|
+
|
|
308
|
+
tmp_argsort = np.argsort(contribution_of_eigvec)
|
|
309
|
+
f.write(f"{tmp_argsort[-1]} {contribution_of_eigvec[tmp_argsort[-1]]} {tmp_argsort[-2]} {contribution_of_eigvec[tmp_argsort[-2]]} {tmp_argsort[-3]} {contribution_of_eigvec[tmp_argsort[-3]]} \n")
|
|
310
|
+
|
|
311
|
+
f.write("-----\n")
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
return
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from multioptpy.Parameters.atomic_number import number_element, element_number
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def atomic_mass(elem):
|
|
5
|
+
|
|
6
|
+
if type(elem) is int:
|
|
7
|
+
elem_num = elem
|
|
8
|
+
else:
|
|
9
|
+
|
|
10
|
+
elem_num = element_number(elem)
|
|
11
|
+
|
|
12
|
+
mass = {1: 1.00782503223, 2: 4.00260325413,
|
|
13
|
+
3: 7.0160034366, 4: 9.012183065, 5: 11.00930536, 6: 12.0, 7: 14.00307400443, 8: 15.99491461957, 9: 18.99840316273, 10: 19.9924401762,
|
|
14
|
+
11: 22.989769282, 12: 23.985041697, 13: 26.98153853, 14: 27.97692653465, 15: 30.97376199842, 16: 31.9720711744, 17: 34.968852682, 18: 39.9623831237,
|
|
15
|
+
19: 38.9637064864, 20: 39.962590863, 21: 44.95590828, 22: 47.94794198, 23: 50.94395704, 24: 51.94050623, 25: 54.93804391, 26: 55.93493633, 27: 58.93319429, 28: 57.93534241, 29: 62.92959772, 30: 63.92914201, 31: 68.9255735, 32: 73.921177761, 33: 74.92159457, 34: 79.9165218, 35: 78.9183376, 36: 83.9114977282,
|
|
16
|
+
37: 84.9117897379, 38: 87.9056125, 39: 88.9058403, 40: 89.9046977, 41: 92.906373, 42: 97.90540482, 43: 96.9063667, 44: 101.9043441, 45: 102.905498, 46: 105.9034804, 47: 106.9050916, 48: 113.90336509, 49: 114.903878776, 50: 119.90220163, 51: 120.903812, 52: 129.906222748, 53: 126.9044719, 54: 131.9041550856,
|
|
17
|
+
55: 132.905451961, 56: 137.905247, 57: 138.9063563, 58: 139.9054431, 59: 140.9076576, 60: 141.907729, 61: 144.9127559, 62: 151.9197397, 63: 152.921238, 64: 157.9241123, 65: 158.9253547, 66: 163.9291819, 67: 164.9303288,
|
|
18
|
+
68: 165.9302995, 69: 168.9342179, 70: 173.9388664, 71: 174.9407752, 72: 179.946557, 73: 180.9479958, 74: 183.95093092, 75: 186.9557501, 76: 191.961477, 77: 192.9629216, 78: 194.9647917, 79: 196.96656879, 80: 201.9706434, 81: 204.9744278,
|
|
19
|
+
82: 207.9766525, 83: 208.9803991, 84: 208.9824308, 85: 209.9871479, 86: 222.0175782}# https://www.nist.gov/pml/atomic-weights-and-isotopic-compositions-relative-atomic-masses
|
|
20
|
+
return mass[int(elem_num)]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def element_number(elem):
|
|
5
|
+
num = {"H": 1, "He": 2,
|
|
6
|
+
"Li": 3, "Be": 4, "B": 5, "C": 6, "N": 7, "O": 8, "F": 9, "Ne": 10,
|
|
7
|
+
"Na": 11, "Mg": 12, "Al": 13, "Si": 14, "P": 15, "S": 16, "Cl": 17, "Ar": 18,
|
|
8
|
+
"K": 19, "Ca": 20, "Sc": 21, "Ti": 22, "V": 23, "Cr": 24, "Mn": 25, "Fe": 26, "Co": 27, "Ni": 28, "Cu": 29, "Zn": 30, "Ga": 31, "Ge": 32, "As": 33, "Se": 34, "Br": 35, "Kr": 36,
|
|
9
|
+
"Rb": 37, "Sr": 38, "Y": 39, "Zr": 40, "Nb": 41, "Mo": 42,"Tc": 43,"Ru": 44,"Rh": 45,"Pd": 46,"Ag": 47,"Cd": 48,"In": 49,"Sn": 50,"Sb": 51,"Te": 52,"I": 53,"Xe": 54,
|
|
10
|
+
"Cs": 55 ,"Ba": 56, "La": 57,"Ce":58,"Pr": 59,"Nd": 60,"Pm": 61,"Sm": 62,"Eu": 63,"Gd": 64,"Tb": 65,"Dy": 66,"Ho": 67,"Er": 68,"Tm": 69,"Yb": 70,"Lu": 71,"Hf": 72,"Ta": 73,"W": 74,"Re": 75,"Os": 76,"Ir": 77,"Pt": 78,"Au": 79,"Hg": 80,"Tl": 81,"Pb":82,"Bi":83,"Po":84,"At":85,"Rn":86}
|
|
11
|
+
|
|
12
|
+
return num[elem]
|
|
13
|
+
|
|
14
|
+
def number_element(num):
|
|
15
|
+
elem = {1: "H", 2:"He",
|
|
16
|
+
3:"Li", 4:"Be", 5:"B", 6:"C", 7:"N", 8:"O", 9:"F", 10:"Ne",
|
|
17
|
+
11:"Na", 12:"Mg", 13:"Al", 14:"Si", 15:"P", 16:"S", 17:"Cl", 18:"Ar",
|
|
18
|
+
19:"K", 20:"Ca", 21:"Sc", 22:"Ti", 23:"V", 24:"Cr", 25:"Mn", 26:"Fe", 27:"Co", 28:"Ni", 29:"Cu", 30:"Zn", 31:"Ga", 32:"Ge", 33:"As", 34:"Se", 35:"Br", 36:"Kr",
|
|
19
|
+
37:"Rb", 38:"Sr", 39:"Y", 40:"Zr", 41:"Nb", 42:"Mo",43:"Tc",44:"Ru",45:"Rh", 46:"Pd", 47:"Ag", 48:"Cd", 49:"In", 50:"Sn", 51:"Sb", 52:"Te", 53:"I", 54:"Xe",
|
|
20
|
+
55:"Cs", 56:"Ba", 57:"La",58:"Ce",59:"Pr",60:"Nd",61:"Pm",62:"Sm", 63:"Eu", 64:"Gd", 65:"Tb", 66:"Dy" ,67:"Ho", 68:"Er", 69:"Tm", 70:"Yb", 71:"Lu", 72:"Hf", 73:"Ta", 74:"W", 75:"Re", 76:"Os", 77:"Ir", 78:"Pt", 79:"Au", 80:"Hg", 81:"Tl", 82:"Pb", 83:"Bi", 84:"Po", 85:"At", 86:"Rn"}
|
|
21
|
+
|
|
22
|
+
return elem[num]
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from multioptpy.Parameters.atomic_number import number_element, element_number
|
|
2
|
+
from multioptpy.Parameters.unit_values import UnitValueLib
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def covalent_radii_lib(element):#single bond
|
|
7
|
+
if element is int:
|
|
8
|
+
element = number_element(element)
|
|
9
|
+
CRL = {"H": 0.32, "He": 0.46,
|
|
10
|
+
"Li": 1.33, "Be": 1.02, "B": 0.85, "C": 0.75, "N": 0.71, "O": 0.63, "F": 0.64, "Ne": 0.67,
|
|
11
|
+
"Na": 1.55, "Mg": 1.39, "Al":1.26, "Si": 1.16, "P": 1.11, "S": 1.03, "Cl": 0.99, "Ar": 0.96,
|
|
12
|
+
"K": 1.96, "Ca": 1.71, "Sc": 1.48, "Ti": 1.36, "V": 1.34, "Cr": 1.22, "Mn": 1.19, "Fe": 1.16, "Co": 1.11, "Ni": 1.10, "Cu": 1.12, "Zn": 1.18, "Ga": 1.24, "Ge": 1.24, "As": 1.21, "Se": 1.16, "Br": 1.14, "Kr": 1.17,
|
|
13
|
+
"Rb": 2.10, "Sr": 1.85, "Y": 1.63, "Zr": 1.54,"Nb": 1.47,"Mo": 1.38,"Tc": 1.28,"Ru": 1.25,"Rh": 1.25,"Pd": 1.20,"Ag": 1.28,"Cd": 1.36,"In": 1.42,"Sn": 1.40,"Sb": 1.40,"Te": 1.36,"I": 1.33,"Xe": 1.31,
|
|
14
|
+
"Cs": 2.32,"Ba": 1.96,"La":1.80,"Ce": 1.63,"Pr": 1.76,"Nd": 1.74,"Pm": 1.73,"Sm": 1.72,"Eu": 1.68,"Gd": 1.69 ,"Tb": 1.68,"Dy": 1.67,"Ho": 1.66,"Er": 1.65,"Tm": 1.64,"Yb": 1.70,"Lu": 1.62,"Hf": 1.52,"Ta": 1.46,"W": 1.37,"Re": 1.31,"Os": 1.29,"Ir": 1.22,"Pt": 1.23,"Au": 1.24,"Hg": 1.33,"Tl": 1.44,"Pb":1.44,"Bi":1.51,"Po":1.45,"At":1.47,"Rn":1.42, 'X':1.000}#ang.
|
|
15
|
+
# ref. Pekka Pyykkö; Michiko Atsumi (2009). “Molecular single-bond covalent radii for elements 1 - 118”. Chemistry: A European Journal 15: 186–197. doi:10.1002/chem.200800987. (H...Rn)
|
|
16
|
+
|
|
17
|
+
return CRL[element] / UnitValueLib().bohr2angstroms#Bohr
|
|
18
|
+
|
|
19
|
+
def double_covalent_radii_lib(element):#double bond
|
|
20
|
+
if element is int:
|
|
21
|
+
element = number_element(element)
|
|
22
|
+
CRL = {"H": 0.32, "He": 0.46,
|
|
23
|
+
"Li": 1.24, "Be": 0.90, "B": 0.78, "C": 0.67, "N": 0.60, "O": 0.57, "F": 0.59, "Ne": 0.96,
|
|
24
|
+
"Na": 1.60, "Mg": 1.32, "Al":1.13, "Si": 1.07, "P": 1.02, "S": 0.94, "Cl": 0.95, "Ar": 1.07,
|
|
25
|
+
"K": 1.93, "Ca": 1.47, "Sc": 1.16, "Ti": 1.17, "V": 1.12, "Cr": 1.11, "Mn": 1.05, "Fe": 1.09, "Co": 1.03, "Ni": 1.01, "Cu": 1.15, "Zn": 1.20, "Ga": 1.17, "Ge": 1.11, "As": 1.14, "Se": 1.07, "Br": 1.09, "Kr": 1.21,
|
|
26
|
+
"Rb": 2.02, "Sr": 1.57, "Y": 1.30, "Zr": 1.27,"Nb": 1.25,"Mo": 1.21,"Tc": 1.20,"Ru": 1.14,"Rh": 1.10,"Pd": 1.17,"Ag": 1.39,"Cd": 1.44,"In": 1.36,"Sn": 1.30,"Sb": 1.33,"Te": 1.28,"I": 1.29,"Xe": 1.35,
|
|
27
|
+
"Cs": 2.09,"Ba": 1.61,"La":1.39,"Ce": 1.37,"Pr": 1.38,"Nd": 1.37,"Pm": 1.35,"Sm": 1.34,"Eu": 1.34,"Gd": 1.35 ,"Tb": 1.35,"Dy": 1.33,"Ho": 1.33,"Er": 1.33,"Tm": 1.31,"Yb": 1.29,"Lu": 1.31,"Hf": 1.28,"Ta": 1.26,"W": 1.20,"Re": 1.19,"Os": 1.16,"Ir": 1.15,"Pt": 1.12,"Au": 1.21,"Hg": 1.42,"Tl": 1.42,"Pb":1.35,"Bi":1.41,"Po":1.35,"At":1.38,"Rn":1.45, 'X':1.000}#ang.
|
|
28
|
+
# ref. P. Pyykkö; M. Atsumi (2009). "Molecular Double-Bond Covalent Radii for Elements Li–E112". Chemistry: A European Journal. 15 (46): 12770–12779. doi:10.1002/chem.200901472. (H...Rn)
|
|
29
|
+
#If double bond length is not available, single bond length is used. (H, He)
|
|
30
|
+
|
|
31
|
+
return CRL[element] / UnitValueLib().bohr2angstroms#Bohr
|
|
32
|
+
|
|
33
|
+
def triple_covalent_radii_lib(element):#triple bond
|
|
34
|
+
if element is int:
|
|
35
|
+
element = number_element(element)
|
|
36
|
+
CRL = {"H": 0.32, "He": 0.46,
|
|
37
|
+
"Li": 1.24, "Be": 0.85, "B": 0.73, "C": 0.60, "N": 0.54, "O": 0.53, "F": 0.53, "Ne": 0.96,
|
|
38
|
+
"Na": 1.60, "Mg": 1.27, "Al":1.11, "Si": 1.02, "P": 0.94, "S": 0.95, "Cl": 0.93, "Ar": 0.96,
|
|
39
|
+
"K": 1.93, "Ca": 1.33, "Sc": 1.14, "Ti": 1.08, "V": 1.06, "Cr": 1.03, "Mn": 1.03, "Fe": 1.02, "Co": 0.96, "Ni": 1.01, "Cu": 1.20, "Zn": 1.20, "Ga": 1.21, "Ge": 1.21, "As": 1.06, "Se": 1.07, "Br": 1.10, "Kr": 1.08,
|
|
40
|
+
"Rb": 2.02, "Sr": 1.39, "Y": 1.24, "Zr": 1.21,"Nb": 1.16,"Mo": 1.13,"Tc": 1.10,"Ru": 1.03,"Rh": 1.06,"Pd": 1.12,"Ag": 1.37,"Cd": 1.44,"In": 1.46,"Sn": 1.32,"Sb": 1.27,"Te": 1.21,"I": 1.25,"Xe": 1.22,
|
|
41
|
+
"Cs": 2.09,"Ba": 1.49,"La":1.39,"Ce": 1.31,"Pr": 1.28,"Nd": 1.37,"Pm": 1.35,"Sm": 1.34,"Eu": 1.34,"Gd": 1.32 ,"Tb": 1.35,"Dy": 1.33,"Ho": 1.33,"Er": 1.33,"Tm": 1.31,"Yb": 1.29,"Lu": 1.31,"Hf": 1.21,"Ta": 1.19,"W": 1.15,"Re": 1.10,"Os": 1.09,"Ir": 1.07,"Pt": 1.10,"Au": 1.23,"Hg": 1.42,"Tl": 1.50,"Pb":1.37,"Bi":1.35,"Po":1.29,"At":1.38,"Rn":1.33, 'X':1.000}#ang.
|
|
42
|
+
# ref. P. Pyykkö; S. Riedel; M. Patzschke (2005). "Triple-Bond Covalent Radii". Chemistry: A European Journal. 11 (12): 3511–3520. doi:10.1002/chem.200401299. (H...Rn)
|
|
43
|
+
#If there is no triple bond length, use the double bond length; if there is no double bond length, use the single bond length. (H, He, Li, Ne, Na, K, Zn, Rb, Cd, Cs, Nd, Pm, Sm, Eu, Tb, Dy, Ho, Er, Tm, Yb, Hg)
|
|
44
|
+
return CRL[element] / UnitValueLib().bohr2angstroms#Bohr
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from multioptpy.Parameters.atomic_number import number_element, element_number
|
|
2
|
+
from multioptpy.Parameters.unit_values import UnitValueLib
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def D2_VDW_radii_lib(element):
|
|
6
|
+
# VDW radii for D2 dispersion model
|
|
7
|
+
if element is int:
|
|
8
|
+
element = number_element(element)
|
|
9
|
+
"""
|
|
10
|
+
D2_VDW_distance = {'H':0.91,'He':0.92,
|
|
11
|
+
'Li' : 0.75 ,'Be': 1.28, 'B':1.35 ,'C': 1.32, 'N': 1.27,'O': 1.22, 'F':1.17,'Ne': 1.13,
|
|
12
|
+
'Na':1.04,'Mg': 1.24 ,'Al':1.49 ,'Si': 1.56, 'P':1.55, 'S':1.53 ,'Cl':1.49,'Ar':1.45 ,
|
|
13
|
+
'K': 1.35,'Ca':1.34 ,'Sc':1.42 ,'Ti':1.42 ,'V': 1.42, 'Cr':1.42 ,'Mn': 1.42, 'Fe': 1.42,'Co':1.42 ,'Ni':1.42 ,'Cu':1.42 ,'Zn':1.42 ,'Ga': 1.50,'Ge':1.57,'As':1.60 ,'Se':1.61,'Br':1.59,'Kr':1.57 ,
|
|
14
|
+
'Rb':1.48 ,'Sr': 1.46,'Y':1.49 ,'Zr':1.49 ,'Nb':1.49 ,'Mo':1.49,'Tc':1.49 ,'Ru':1.49 ,'Rh':1.49 ,'Pd':1.49 ,'Ag':1.49 ,'Cd':1.49 ,'In':1.52 ,'Sn':1.64 ,'Sb':1.71 ,'Te':1.72 , 'I':1.72, 'Xe':1.71 ,
|
|
15
|
+
'Cs':2.00 ,'Ba':2.00 , 'La':2.00 , 'Ce':2.00 ,'Pr':2.00 ,'Nd':2.00 ,'Pm':2.00 ,'Sm':2.00 ,'Eu':2.00 ,'Gd':2.00 ,'Tb':2.00 ,'Dy':2.00 ,'Ho':2.00 ,'Er':2.00 ,'Tm':2.00 ,'Yb':2.00,'Lu':2.00 ,'Hf': 2.00,
|
|
16
|
+
'Ta':2.00 ,'W':2.00 ,'Re':2.00 ,'Os':2.00 ,'Ir':2.00 ,'Pt':2.00 ,'Au':2.00 ,'Hg':2.00 ,'Tl':2.00 ,'Pb':2.00 ,'Bi':2.00 ,'Po':2.00 ,'At':2.00 ,'Rn': 2.00}
|
|
17
|
+
"""
|
|
18
|
+
D2_VDW_distance = {
|
|
19
|
+
'H': 1.001, 'He': 1.012,
|
|
20
|
+
'Li': 0.825, 'Be': 1.408, 'B': 1.485, 'C': 1.452, 'N': 1.397, 'O': 1.342, 'F': 1.287, 'Ne': 1.243,
|
|
21
|
+
'Na': 1.144, 'Mg': 1.364, 'Al': 1.639, 'Si': 1.716, 'P': 1.705, 'S': 1.683, 'Cl': 1.639, 'Ar': 1.595,
|
|
22
|
+
'K': 1.485, 'Ca': 1.474, 'Sc': 1.562, 'Ti': 1.562, 'V': 1.562, 'Cr': 1.562, 'Mn': 1.562, 'Fe': 1.562,
|
|
23
|
+
'Co': 1.562, 'Ni': 1.562, 'Cu': 1.562, 'Zn': 1.562, 'Ga': 1.650, 'Ge': 1.727, 'As': 1.760, 'Se': 1.771,
|
|
24
|
+
'Br': 1.749, 'Kr': 1.727, 'Rb': 1.628, 'Sr': 1.606, 'Y': 1.639, 'Zr': 1.639, 'Nb': 1.639, 'Mo': 1.639,
|
|
25
|
+
'Tc': 1.639, 'Ru': 1.639, 'Rh': 1.639, 'Pd': 1.639, 'Ag': 1.639, 'Cd': 1.639, 'In': 1.672, 'Sn': 1.804,
|
|
26
|
+
'Sb': 1.881, 'Te': 1.892, 'I': 1.892, 'Xe': 1.881, 'Cs': 1.802, 'Ba': 1.762, 'La': 1.720, 'Ce': 1.753,
|
|
27
|
+
'Pr': 1.753, 'Nd': 1.753, 'Pm': 1.753, 'Sm': 1.753, 'Eu': 1.753, 'Gd': 1.753, 'Tb': 1.753, 'Dy': 1.753,
|
|
28
|
+
'Ho': 1.753, 'Er': 1.753, 'Tm': 1.753, 'Yb': 1.753, 'Lu': 1.753, 'Hf': 1.788, 'Ta': 1.772, 'W': 1.772,
|
|
29
|
+
'Re': 1.772, 'Os': 1.772, 'Ir': 1.772, 'Pt': 1.772, 'Au': 1.772, 'Hg': 1.758, 'Tl': 1.989, 'Pb': 1.944,
|
|
30
|
+
'Bi': 1.898, 'Po': 2.005, 'At': 1.991, 'Rn': 1.924
|
|
31
|
+
}
|
|
32
|
+
return D2_VDW_distance[element] / UnitValueLib().bohr2angstroms#Bohr
|
|
33
|
+
|
|
34
|
+
def D2_C6_coeff_lib(element):
|
|
35
|
+
if element is int:
|
|
36
|
+
element = number_element(element)
|
|
37
|
+
C6_coefficients = {'H': 0.14, 'He': 0.08,
|
|
38
|
+
'Li': 1.61, 'Be': 1.61, 'B': 3.13, 'C': 1.75, 'N': 1.23, 'O': 0.70, 'F': 0.75, 'Ne': 0.63,
|
|
39
|
+
'Na': 5.71, 'Mg': 5.71, 'Al': 10.79, 'Si': 9.23, 'P': 7.84, 'S': 5.57, 'Cl': 5.07, 'Ar': 4.61,
|
|
40
|
+
'K': 10.80, 'Ca': 10.80,
|
|
41
|
+
'Sc': 10.80, 'Ti': 10.80, 'V': 10.80, 'Cr': 10.80, 'Mn': 10.80,
|
|
42
|
+
'Fe': 10.80, 'Co': 10.80, 'Ni': 10.80, 'Cu': 10.80, 'Zn': 10.80,
|
|
43
|
+
'Ga': 16.99, 'Ge': 17.10, 'As': 16.37, 'Se': 12.64, 'Br': 12.47, 'Kr': 12.01,
|
|
44
|
+
'Rb': 24.67, 'Sr': 24.67,
|
|
45
|
+
'Y': 24.67, 'Zr': 24.67, 'Nb': 24.67, 'Mo': 24.67, 'Tc': 24.67,
|
|
46
|
+
'Ru': 24.67, 'Rh': 24.67, 'Pd': 24.67, 'Ag': 24.67, 'Cd': 24.67,
|
|
47
|
+
'In': 37.32, 'Sn': 38.71, 'Sb': 38.44, 'Te': 31.74, 'I': 31.50, 'Xe': 29.99,
|
|
48
|
+
'Cs': 50.00, 'Ba': 50.00,
|
|
49
|
+
'La': 50.00, 'Ce': 50.00, 'Pr': 50.00, 'Nd': 50.00, 'Pm': 50.00, 'Sm': 50.00,
|
|
50
|
+
'Eu': 50.00, 'Gd': 50.00, 'Tb': 50.00, 'Dy': 50.00, 'Ho': 50.00, 'Er': 50.00,
|
|
51
|
+
'Tm': 50.00, 'Yb': 50.00, 'Lu': 50.00,
|
|
52
|
+
'Hf': 50.00, 'Ta': 50.00, 'W': 50.00, 'Re': 50.00, 'Os': 50.00,
|
|
53
|
+
'Ir': 50.00, 'Pt': 50.00, 'Au': 50.00, 'Hg': 50.00,
|
|
54
|
+
'Tl': 50.00, 'Pb': 50.00, 'Bi': 50.00, 'Po': 50.00, 'At': 50.00, 'Rn': 50.00}# J nm^6 mol^-1
|
|
55
|
+
|
|
56
|
+
# J nm^6 mol^-1 -> hartree bohr^6
|
|
57
|
+
param = C6_coefficients[element] * 10 ** 6 / (UnitValueLib().bohr2angstroms) ** 6 / UnitValueLib().hartree2j / UnitValueLib().mol2au
|
|
58
|
+
|
|
59
|
+
return param#hartree bohr^6
|
|
60
|
+
|
|
61
|
+
D2_S6_parameter = 1.00 #dimensionless
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class D3Parameters:
|
|
6
|
+
"""Parameters class for D3 dispersion correction"""
|
|
7
|
+
def __init__(self, s6=1.0, s8=0.7875, a1=0.4289, a2=4.4407):
|
|
8
|
+
# Default parameters for PBE0
|
|
9
|
+
self.s6 = s6 # Scaling constant for C6 term (typically 1.0)
|
|
10
|
+
self.s8 = s8 # Scaling constant for C8 term
|
|
11
|
+
self.a1 = a1 # Parameter for damping function of C6 term
|
|
12
|
+
self.a2 = a2 # Parameter for damping function of C8 term
|
|
13
|
+
|
|
14
|
+
# r4_over_r2 values from tad-dftd3 library
|
|
15
|
+
# PBE0/def2-QZVP atomic values calculated by S. Grimme in Gaussian (2010)
|
|
16
|
+
# with updates for rare gases and super-heavy elements
|
|
17
|
+
self.r4r2_values = {
|
|
18
|
+
# None
|
|
19
|
+
# H, He
|
|
20
|
+
'H': 8.0589, 'He': 3.4698,
|
|
21
|
+
# Li-Ne
|
|
22
|
+
'Li': 29.0974, 'Be': 14.8517, 'B': 11.8799, 'C': 7.8715, 'N': 5.5588,
|
|
23
|
+
'O': 4.7566, 'F': 3.8025, 'Ne': 3.1036,
|
|
24
|
+
# Na-Ar
|
|
25
|
+
'Na': 26.1552, 'Mg': 17.2304, 'Al': 17.7210, 'Si': 12.7442, 'P': 9.5361,
|
|
26
|
+
'S': 8.1652, 'Cl': 6.7463, 'Ar': 5.6004,
|
|
27
|
+
# K, Ca
|
|
28
|
+
'K': 29.2012, 'Ca': 22.3934,
|
|
29
|
+
# Sc-Zn
|
|
30
|
+
'Sc': 19.0598, 'Ti': 16.8590, 'V': 15.4023, 'Cr': 12.5589, 'Mn': 13.4788,
|
|
31
|
+
'Fe': 12.2309, 'Co': 11.2809, 'Ni': 10.5569, 'Cu': 10.1428, 'Zn': 9.4907,
|
|
32
|
+
# Ga-Kr
|
|
33
|
+
'Ga': 13.4606, 'Ge': 10.8544, 'As': 8.9386, 'Se': 8.1350, 'Br': 7.1251, 'Kr': 6.1971,
|
|
34
|
+
# Rb, Sr
|
|
35
|
+
'Rb': 30.0162, 'Sr': 24.4103,
|
|
36
|
+
# Y-Cd
|
|
37
|
+
'Y': 20.3537, 'Zr': 17.4780, 'Nb': 13.5528, 'Mo': 11.8451, 'Tc': 11.0355,
|
|
38
|
+
'Ru': 10.1997, 'Rh': 9.5414, 'Pd': 9.0061, 'Ag': 8.6417, 'Cd': 8.9975,
|
|
39
|
+
# In-Xe
|
|
40
|
+
'In': 14.0834, 'Sn': 11.8333, 'Sb': 10.0179, 'Te': 9.3844, 'I': 8.4110, 'Xe': 7.5152,
|
|
41
|
+
# Cs, Ba
|
|
42
|
+
'Cs': 32.7622, 'Ba': 27.5708,
|
|
43
|
+
# La-Eu
|
|
44
|
+
'La': 23.1671, 'Ce': 21.6003, 'Pr': 20.9615, 'Nd': 20.4562, 'Pm': 20.1010,
|
|
45
|
+
'Sm': 19.7475, 'Eu': 19.4828,
|
|
46
|
+
# Gd-Yb
|
|
47
|
+
'Gd': 15.6013, 'Tb': 19.2362, 'Dy': 17.4717, 'Ho': 17.8321, 'Er': 17.4237,
|
|
48
|
+
'Tm': 17.1954, 'Yb': 17.1631,
|
|
49
|
+
# Lu-Hg
|
|
50
|
+
'Lu': 14.5716, 'Hf': 15.8758, 'Ta': 13.8989, 'W': 12.4834, 'Re': 11.4421,
|
|
51
|
+
'Os': 10.2671, 'Ir': 8.3549, 'Pt': 7.8496, 'Au': 7.3278, 'Hg': 7.4820,
|
|
52
|
+
# Tl-Rn
|
|
53
|
+
'Tl': 13.5124, 'Pb': 11.6554, 'Bi': 10.0959, 'Po': 9.7340, 'At': 8.8584, 'Rn': 8.0125
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
# Default value for unlisted elements
|
|
57
|
+
self.default_r4r2 = 10.0
|
|
58
|
+
|
|
59
|
+
def get_r4r2(self, element):
|
|
60
|
+
"""Get r^4/r^2 ratio for each element"""
|
|
61
|
+
if element in self.r4r2_values:
|
|
62
|
+
return self.r4r2_values[element]
|
|
63
|
+
return self.default_r4r2
|