t7morgen
commited on
Commit
•
7d18a20
1
Parent(s):
3543db3
vis
Browse files- .gitattributes +2 -0
- 1A30.pdb +52 -0
- GFN2all.cpp +210 -0
- GFN2all.exe +3 -0
- GFN2all_crd.cpp +210 -0
- GFN2all_crd.exe +3 -0
- README.md +5 -5
- __init__.py +0 -0
- __pycache__/run_gfn.cpython-310.pyc +0 -0
- __pycache__/test.cpython-310.pyc +0 -0
- app.py +172 -0
- cyclohexane.xyz +20 -0
- dummy_struct.xyz +20 -0
- dummy_struct_dens.cub +0 -0
- geom_cyclohexane.xyz +20 -0
- geometry.xyz +20 -0
- main.py +98 -0
- qm_atom_features.csv +19 -0
- requirements.txt +2 -0
- requirements_full.txt +6 -0
- runGFN2.py +318 -0
- runGFN2_crd.txt +299 -0
- run_gfn.py +342 -0
- testing_py3Dmol.ipynb +0 -0
- ulysses +1 -0
.gitattributes
CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
GFN2all.exe filter=lfs diff=lfs merge=lfs -text
|
37 |
+
GFN2all_crd.exe filter=lfs diff=lfs merge=lfs -text
|
1A30.pdb
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
CRYST1 81.052 81.052 81.052 109.47 109.47 109.47 1
|
2 |
+
ATOM 1 N GLU 199 36.081 39.009 29.686 1.00 0.00 N
|
3 |
+
ATOM 2 H1 GLU 199 35.429 38.796 30.426 1.00 0.00 H
|
4 |
+
ATOM 3 H2 GLU 199 36.154 38.207 29.076 1.00 0.00 H
|
5 |
+
ATOM 4 H3 GLU 199 35.853 39.916 29.303 1.00 0.00 H
|
6 |
+
ATOM 5 CA GLU 199 37.432 39.167 30.291 1.00 0.00 C
|
7 |
+
ATOM 6 HA GLU 199 38.116 38.436 29.860 1.00 0.00 H
|
8 |
+
ATOM 7 CB GLU 199 37.982 40.570 30.022 1.00 0.00 C
|
9 |
+
ATOM 8 HB2 GLU 199 38.901 40.671 30.598 1.00 0.00 H
|
10 |
+
ATOM 9 HB3 GLU 199 38.212 40.628 28.958 1.00 0.00 H
|
11 |
+
ATOM 10 CG GLU 199 37.028 41.688 30.394 1.00 0.00 C
|
12 |
+
ATOM 11 HG2 GLU 199 36.079 41.510 29.887 1.00 0.00 H
|
13 |
+
ATOM 12 HG3 GLU 199 36.878 41.635 31.472 1.00 0.00 H
|
14 |
+
ATOM 13 CD GLU 199 37.549 43.062 30.023 1.00 0.00 C
|
15 |
+
ATOM 14 OE1 GLU 199 38.098 43.217 28.907 1.00 0.00 O
|
16 |
+
ATOM 15 OE2 GLU 199 37.394 43.992 30.847 1.00 0.00 O
|
17 |
+
ATOM 16 C GLU 199 37.378 38.880 31.790 1.00 0.00 C
|
18 |
+
ATOM 17 O GLU 199 36.391 39.196 32.464 1.00 0.00 O
|
19 |
+
ATOM 18 N ASP 200 38.421 38.232 32.294 1.00 0.00 N
|
20 |
+
ATOM 19 H ASP 200 39.166 37.937 31.679 1.00 0.00 H
|
21 |
+
ATOM 20 CA ASP 200 38.512 37.883 33.705 1.00 0.00 C
|
22 |
+
ATOM 21 HA ASP 200 37.703 38.355 34.262 1.00 0.00 H
|
23 |
+
ATOM 22 CB ASP 200 38.401 36.370 33.871 1.00 0.00 C
|
24 |
+
ATOM 23 HB2 ASP 200 39.160 35.871 33.269 1.00 0.00 H
|
25 |
+
ATOM 24 HB3 ASP 200 38.581 36.162 34.926 1.00 0.00 H
|
26 |
+
ATOM 25 CG ASP 200 37.030 35.856 33.483 1.00 0.00 C
|
27 |
+
ATOM 26 OD1 ASP 200 36.116 35.958 34.323 1.00 0.00 O
|
28 |
+
ATOM 27 OD2 ASP 200 36.851 35.393 32.334 1.00 0.00 O
|
29 |
+
ATOM 28 C ASP 200 39.827 38.407 34.256 1.00 0.00 C
|
30 |
+
ATOM 29 O ASP 200 40.869 37.761 34.126 1.00 0.00 O
|
31 |
+
ATOM 30 N LEU 201 39.771 39.607 34.828 1.00 0.00 N
|
32 |
+
ATOM 31 H LEU 201 38.893 40.106 34.850 1.00 0.00 H
|
33 |
+
ATOM 32 CA LEU 201 40.950 40.261 35.373 1.00 0.00 C
|
34 |
+
ATOM 33 HA LEU 201 41.853 39.729 35.075 1.00 0.00 H
|
35 |
+
ATOM 34 CB LEU 201 41.025 41.684 34.837 1.00 0.00 C
|
36 |
+
ATOM 35 HB2 LEU 201 40.080 42.153 35.112 1.00 0.00 H
|
37 |
+
ATOM 36 HB3 LEU 201 41.851 42.260 35.254 1.00 0.00 H
|
38 |
+
ATOM 37 CG LEU 201 41.150 41.645 33.318 1.00 0.00 C
|
39 |
+
ATOM 38 HG LEU 201 40.848 40.661 32.961 1.00 0.00 H
|
40 |
+
ATOM 39 CD1 LEU 201 40.276 42.692 32.696 1.00 0.00 C
|
41 |
+
ATOM 40 HD11 LEU 201 40.578 43.677 33.052 1.00 0.00 H
|
42 |
+
ATOM 41 HD12 LEU 201 40.375 42.652 31.612 1.00 0.00 H
|
43 |
+
ATOM 42 HD13 LEU 201 39.237 42.509 32.972 1.00 0.00 H
|
44 |
+
ATOM 43 CD2 LEU 201 42.612 41.790 32.919 1.00 0.00 C
|
45 |
+
ATOM 44 HD21 LEU 201 43.189 40.972 33.350 1.00 0.00 H
|
46 |
+
ATOM 45 HD22 LEU 201 42.697 41.762 31.833 1.00 0.00 H
|
47 |
+
ATOM 46 HD23 LEU 201 42.997 42.740 33.289 1.00 0.00 H
|
48 |
+
ATOM 47 C LEU 201 40.979 40.272 36.891 1.00 0.00 C
|
49 |
+
ATOM 48 O LEU 201 42.089 40.361 37.458 1.00 0.00 O
|
50 |
+
ATOM 49 OXT LEU 201 39.891 40.190 37.498 1.00 0.00 O
|
51 |
+
TER 50 LEU 201
|
52 |
+
END
|
GFN2all.cpp
ADDED
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#include <iostream>
|
2 |
+
#include "ulysses/src/GFN.hpp"
|
3 |
+
#include "ulysses/src/math/SolverPackage.hpp"
|
4 |
+
#include "ulysses/src/Gas.hpp"
|
5 |
+
|
6 |
+
int main(int argc, char** argv) {
|
7 |
+
|
8 |
+
//check the files gfn2-xtb_optg.cpp and pm6-corrected.cpp to extend the options here
|
9 |
+
|
10 |
+
//arguments
|
11 |
+
// 0 exe
|
12 |
+
// 1 geometry
|
13 |
+
// 2 charge
|
14 |
+
// 3 Telec = 300
|
15 |
+
// 4 solvation?
|
16 |
+
// 5 solvent name
|
17 |
+
// 6 optimise geometry?
|
18 |
+
// 7 name for new geometry file
|
19 |
+
// 8 thermo?
|
20 |
+
// 9 energy threshold for geometry optimization = 1.0e-6
|
21 |
+
// 10 gradient threshold for geometry optimization = 1.0e-3
|
22 |
+
// 11 calculate density?
|
23 |
+
// 12 name for density file
|
24 |
+
// 13 electronic reactivity indices?
|
25 |
+
// 14 orbital reactivity indices?
|
26 |
+
// 15 Koopman IP?
|
27 |
+
// 16 IP?
|
28 |
+
// 17 EA?
|
29 |
+
// 18 electronativity?
|
30 |
+
// 19 hardness?
|
31 |
+
|
32 |
+
//parameters passed as argument
|
33 |
+
char *p;
|
34 |
+
int charge = strtol(argv[2],&p,10);
|
35 |
+
char *q;
|
36 |
+
double Telec = strtod(argv[3],&q);
|
37 |
+
char *r;
|
38 |
+
int solvation = strtol(argv[4],&r,10);
|
39 |
+
char *v;
|
40 |
+
int optgeom = strtol(argv[6],&v,10);
|
41 |
+
char *s;
|
42 |
+
int thermo = strtol(argv[8],&s,10);
|
43 |
+
char *t;
|
44 |
+
double energy_threshold = strtod(argv[9],&t);
|
45 |
+
char *u;
|
46 |
+
double gradient_threshold = strtod(argv[10],&u);
|
47 |
+
char *w;
|
48 |
+
int calcdensity = strtol(argv[11],&w,10);
|
49 |
+
char *z1;
|
50 |
+
int elecrx = strtol(argv[13],&z1,10);
|
51 |
+
char *z2;
|
52 |
+
int orbrx = strtol(argv[14],&z2,10);
|
53 |
+
char *z3;
|
54 |
+
int koopman = strtol(argv[15],&z3,10);
|
55 |
+
char *z4;
|
56 |
+
int ip = strtol(argv[16],&z4,10);
|
57 |
+
char *z5;
|
58 |
+
int ea = strtol(argv[17],&z5,10);
|
59 |
+
char *z6;
|
60 |
+
int electronegativity = strtol(argv[18],&z6,10);
|
61 |
+
char *z7;
|
62 |
+
int hardness = strtol(argv[19],&z7,10);
|
63 |
+
|
64 |
+
//system declaration
|
65 |
+
std::cout << "running " << argv[1] << "\n";
|
66 |
+
std::cout << "charge = " << charge << std::endl;
|
67 |
+
std::cout << "T electron = " << Telec << std::endl;
|
68 |
+
|
69 |
+
//allocate molecules
|
70 |
+
Molecule Mol1(argv[1],charge,1,"C1");
|
71 |
+
|
72 |
+
//define method and basis set
|
73 |
+
BSet basis(Mol1,"gfn2");
|
74 |
+
GFN2 electron(basis,Mol1);
|
75 |
+
electron.setElectronTemp(Telec);
|
76 |
+
|
77 |
+
//use ALPB solvation?
|
78 |
+
if (solvation > 0) {
|
79 |
+
electron.setSolvent(argv[5]);
|
80 |
+
// "water"
|
81 |
+
// "acetone"
|
82 |
+
// "acetonitrile"
|
83 |
+
// "aniline"
|
84 |
+
// "benzaldehyde"
|
85 |
+
// "benzene"
|
86 |
+
// "dichloromethane"
|
87 |
+
// "chloroform"
|
88 |
+
// "carbon disulfide"
|
89 |
+
// "dioxane"
|
90 |
+
// "dmf"
|
91 |
+
// "dmso"
|
92 |
+
// "ethanol"
|
93 |
+
// "diethyl ether"
|
94 |
+
// "ethyl acetate"
|
95 |
+
// "furane"
|
96 |
+
// "hexadecane"
|
97 |
+
// "hexane"
|
98 |
+
// "methanol"
|
99 |
+
// "nitromethane"
|
100 |
+
// "octanol"
|
101 |
+
// "phenol"
|
102 |
+
// "thf"
|
103 |
+
// "toluene"
|
104 |
+
// "water"
|
105 |
+
// "octanol wet"
|
106 |
+
}
|
107 |
+
|
108 |
+
electron.Calculate(0);
|
109 |
+
|
110 |
+
//optimise geometry?
|
111 |
+
if (optgeom > 0) {
|
112 |
+
BFGSd solve(4,6);
|
113 |
+
SolverOpt(electron,solve,4,0,energy_threshold,gradient_threshold);
|
114 |
+
Molecule Mol2 = electron.Component();
|
115 |
+
Mol2.WriteXYZ(argv[7]);
|
116 |
+
}
|
117 |
+
|
118 |
+
electron.Calculate(1);
|
119 |
+
|
120 |
+
std::cout << std::setprecision(7) << "\n";
|
121 |
+
//perform thermodynamics?
|
122 |
+
if (thermo > 0) {
|
123 |
+
//get vibrations
|
124 |
+
std::vector<double> all_vibrations = electron.CalcVibrFrequencies();
|
125 |
+
int nvibrations = 6;
|
126 |
+
std::vector<double> vibrations(all_vibrations.size() - nvibrations); //CalcVibrFrequencies returns also translation and rotation modes; these must be removed
|
127 |
+
for (size_t idvibr = 0; idvibr < vibrations.size(); ++idvibr) {
|
128 |
+
vibrations[idvibr] = all_vibrations[idvibr + nvibrations];
|
129 |
+
}
|
130 |
+
std::cout << ">all vibrational frequencies" << std::endl;
|
131 |
+
for (size_t idvibr = 0; idvibr < all_vibrations.size(); ++idvibr) {
|
132 |
+
std::cout << all_vibrations[idvibr] << std::endl;
|
133 |
+
}
|
134 |
+
std::cout << "<all vibrational frequencies" << std::endl;
|
135 |
+
//get electronic energies
|
136 |
+
std::vector<double> Eel;
|
137 |
+
Eel.push_back(electron.getEnergy(1)); //the one means that the D3H4X correction is applied to the total energy; use 0 if you want non-corrected energies
|
138 |
+
//get the degeneracy of ground state
|
139 |
+
std::vector<double> gel(1,1.0);
|
140 |
+
|
141 |
+
//get the eigenvalues of inertia matrix
|
142 |
+
std::vector<double> inertia = electron.Component().InertiaEigenvalues();
|
143 |
+
|
144 |
+
double T = 298.15;
|
145 |
+
bool grimmecorrection = true;
|
146 |
+
double numbermolecules = NA; //1 mol
|
147 |
+
double volume = 0.0224;
|
148 |
+
PBlRRlHOE IdealGas(T,argv[1],inertia,vibrations,Eel,gel,charge,1,"C1","0",grimmecorrection,numbermolecules,volume);
|
149 |
+
|
150 |
+
//loop over temperatures and print out
|
151 |
+
double temperature = 100.0; //K
|
152 |
+
std::cout << ">Thermodynamics" << std::endl;
|
153 |
+
for (size_t idx = 0; idx < 2201; ++idx) {
|
154 |
+
IdealGas.changeT(temperature);
|
155 |
+
std::cout << temperature << ";" << IdealGas.S() << ";" << IdealGas.H() << ";" << IdealGas.G() << ";" << IdealGas.U() << ";" << IdealGas.A() << ";" << IdealGas.CP() << ";" << IdealGas.CV() << std::endl;
|
156 |
+
temperature += 0.5;
|
157 |
+
}
|
158 |
+
std::cout << "<Thermodynamics" << std::endl;
|
159 |
+
}
|
160 |
+
|
161 |
+
//get the density?
|
162 |
+
if (calcdensity > 0) {
|
163 |
+
electron.ElectronicDensity(argv[12]);
|
164 |
+
}
|
165 |
+
|
166 |
+
//get charges and polarisabilities
|
167 |
+
std::vector<size_t> atoms = Mol1.Atoms();
|
168 |
+
std::vector<double> AtmCharge = electron.getQAtoms();
|
169 |
+
std::vector<double> polarizabilities;
|
170 |
+
electron.AtomicPolarizabilities(polarizabilities,AtmCharge);
|
171 |
+
std::cout << ">atom;charge;pol\n";
|
172 |
+
for (size_t idx = 0; idx < atoms.size(); ++idx) {
|
173 |
+
std::cout << atoms[idx] << ";";
|
174 |
+
std::cout << AtmCharge[idx] << ";" << polarizabilities[idx] << "\n";
|
175 |
+
}
|
176 |
+
std::cout << "<atom;charge;pol\n";
|
177 |
+
double polbity = 0.0;
|
178 |
+
electron.TotalPolarizability(polbity,AtmCharge);
|
179 |
+
std::cout << " Total Polarizability " << polbity << "\n";
|
180 |
+
|
181 |
+
//additional properties
|
182 |
+
matrixE RxData(1,1);
|
183 |
+
if (elecrx > 0) {
|
184 |
+
electron.ReactivityIndices(RxData,false);
|
185 |
+
std::cout << ">Electronic Reactivity indices" << std::endl;
|
186 |
+
RxData.Print(4);
|
187 |
+
std::cout << "<Electronic Reactivity indices" << std::endl;
|
188 |
+
}
|
189 |
+
|
190 |
+
if (orbrx > 0) {
|
191 |
+
electron.ReactivityIndices(RxData,true);
|
192 |
+
std::cout << ">Orbital Reactivity indices" << std::endl;
|
193 |
+
RxData.Print(4);
|
194 |
+
std::cout << "<Orbital Reactivity indices" << std::endl;
|
195 |
+
}
|
196 |
+
|
197 |
+
if (koopman > 0) {std::cout << "Ionization Potential (Koopman): " << electron.IonizationPotential(true)*au2eV << " eV" << std::endl;}
|
198 |
+
if (ip > 0) {std::cout << "Ionization Potential (Definition): " << electron.IonizationPotential(false)*au2eV << " eV" << std::endl;}
|
199 |
+
if (ea > 0) {std::cout << "Electron Affinity (Definition): " << electron.ElectronAffinity()*au2eV << " eV" << std::endl;}
|
200 |
+
|
201 |
+
if ((electronegativity > 0)||(hardness > 0)) {
|
202 |
+
double chi;
|
203 |
+
double eta;
|
204 |
+
electron.HSABdata(chi,eta);
|
205 |
+
std::cout << "Electronegativity: " << chi*au2eV << " eV" << std::endl;
|
206 |
+
std::cout << "Hardness: " << eta*au2eV << " eV" << std::endl;
|
207 |
+
}
|
208 |
+
|
209 |
+
return 0;
|
210 |
+
}
|
GFN2all.exe
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:342e15927cb35c6c4446d7f35491e4ce1a86fc00c8e1d21b270cabff6071d65a
|
3 |
+
size 6962680
|
GFN2all_crd.cpp
ADDED
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#include <iostream>
|
2 |
+
#include "ulysses/src/GFN.hpp"
|
3 |
+
#include "ulysses/src/math/SolverPackage.hpp"
|
4 |
+
#include "ulysses/src/Gas.hpp"
|
5 |
+
|
6 |
+
int main(int argc, char** argv) {
|
7 |
+
|
8 |
+
//check the files gfn2-xtb_optg.cpp and pm6-corrected.cpp to extend the options here
|
9 |
+
|
10 |
+
//arguments
|
11 |
+
// 0 exe
|
12 |
+
// 1 geometry
|
13 |
+
// 2 charge
|
14 |
+
// 3 Telec = 300
|
15 |
+
// 4 solvation?
|
16 |
+
// 5 solvent name
|
17 |
+
// 6 optimise geometry?
|
18 |
+
// 7 name for new geometry file
|
19 |
+
// 8 thermo?
|
20 |
+
// 9 energy threshold for geometry optimization = 1.0e-6
|
21 |
+
// 10 gradient threshold for geometry optimization = 1.0e-3
|
22 |
+
// 11 calculate density?
|
23 |
+
// 12 name for density file
|
24 |
+
// 13 electronic reactivity indices?
|
25 |
+
// 14 orbital reactivity indices?
|
26 |
+
// 15 Koopman IP?
|
27 |
+
// 16 IP?
|
28 |
+
// 17 EA?
|
29 |
+
// 18 electronativity?
|
30 |
+
// 19 hardness?
|
31 |
+
|
32 |
+
//parameters passed as argument
|
33 |
+
char *p;
|
34 |
+
int charge = strtol(argv[2],&p,10);
|
35 |
+
char *q;
|
36 |
+
double Telec = strtod(argv[3],&q);
|
37 |
+
char *r;
|
38 |
+
int solvation = strtol(argv[4],&r,10);
|
39 |
+
char *v;
|
40 |
+
int optgeom = strtol(argv[6],&v,10);
|
41 |
+
char *s;
|
42 |
+
int thermo = strtol(argv[8],&s,10);
|
43 |
+
char *t;
|
44 |
+
double energy_threshold = strtod(argv[9],&t);
|
45 |
+
char *u;
|
46 |
+
double gradient_threshold = strtod(argv[10],&u);
|
47 |
+
char *w;
|
48 |
+
int calcdensity = strtol(argv[11],&w,10);
|
49 |
+
char *z1;
|
50 |
+
int elecrx = strtol(argv[13],&z1,10);
|
51 |
+
char *z2;
|
52 |
+
int orbrx = strtol(argv[14],&z2,10);
|
53 |
+
char *z3;
|
54 |
+
int koopman = strtol(argv[15],&z3,10);
|
55 |
+
char *z4;
|
56 |
+
int ip = strtol(argv[16],&z4,10);
|
57 |
+
char *z5;
|
58 |
+
int ea = strtol(argv[17],&z5,10);
|
59 |
+
char *z6;
|
60 |
+
int electronegativity = strtol(argv[18],&z6,10);
|
61 |
+
char *z7;
|
62 |
+
int hardness = strtol(argv[19],&z7,10);
|
63 |
+
|
64 |
+
//system declaration
|
65 |
+
std::cout << "running " << argv[1] << "\n";
|
66 |
+
std::cout << "charge = " << charge << std::endl;
|
67 |
+
std::cout << "T electron = " << Telec << std::endl;
|
68 |
+
|
69 |
+
//allocate molecules
|
70 |
+
Molecule Mol1(argv[1],charge,1,"C1");
|
71 |
+
|
72 |
+
//define method and basis set
|
73 |
+
BSet basis(Mol1,"gfn2");
|
74 |
+
GFN2 electron(basis,Mol1);
|
75 |
+
electron.setElectronTemp(Telec);
|
76 |
+
|
77 |
+
//use ALPB solvation?
|
78 |
+
if (solvation > 0) {
|
79 |
+
electron.setSolvent(argv[5]);
|
80 |
+
// "water"
|
81 |
+
// "acetone"
|
82 |
+
// "acetonitrile"
|
83 |
+
// "aniline"
|
84 |
+
// "benzaldehyde"
|
85 |
+
// "benzene"
|
86 |
+
// "dichloromethane"
|
87 |
+
// "chloroform"
|
88 |
+
// "carbon disulfide"
|
89 |
+
// "dioxane"
|
90 |
+
// "dmf"
|
91 |
+
// "dmso"
|
92 |
+
// "ethanol"
|
93 |
+
// "diethyl ether"
|
94 |
+
// "ethyl acetate"
|
95 |
+
// "furane"
|
96 |
+
// "hexadecane"
|
97 |
+
// "hexane"
|
98 |
+
// "methanol"
|
99 |
+
// "nitromethane"
|
100 |
+
// "octanol"
|
101 |
+
// "phenol"
|
102 |
+
// "thf"
|
103 |
+
// "toluene"
|
104 |
+
// "water"
|
105 |
+
// "octanol wet"
|
106 |
+
}
|
107 |
+
|
108 |
+
electron.Calculate(0);
|
109 |
+
|
110 |
+
//optimise geometry?
|
111 |
+
if (optgeom > 0) {
|
112 |
+
BFGSd solve(4,6);
|
113 |
+
SolverOpt(electron,solve,4,0,energy_threshold,gradient_threshold);
|
114 |
+
}
|
115 |
+
Molecule Mol2 = electron.Component();
|
116 |
+
Mol2.WriteXYZ(argv[7]);
|
117 |
+
|
118 |
+
electron.Calculate(1);
|
119 |
+
|
120 |
+
std::cout << std::setprecision(7) << "\n";
|
121 |
+
//perform thermodynamics?
|
122 |
+
if (thermo > 0) {
|
123 |
+
//get vibrations
|
124 |
+
std::vector<double> all_vibrations = electron.CalcVibrFrequencies();
|
125 |
+
int nvibrations = 6;
|
126 |
+
std::vector<double> vibrations(all_vibrations.size() - nvibrations); //CalcVibrFrequencies returns also translation and rotation modes; these must be removed
|
127 |
+
for (size_t idvibr = 0; idvibr < vibrations.size(); ++idvibr) {
|
128 |
+
vibrations[idvibr] = all_vibrations[idvibr + nvibrations];
|
129 |
+
}
|
130 |
+
std::cout << ">all vibrational frequencies" << std::endl;
|
131 |
+
for (size_t idvibr = 0; idvibr < all_vibrations.size(); ++idvibr) {
|
132 |
+
std::cout << all_vibrations[idvibr] << std::endl;
|
133 |
+
}
|
134 |
+
std::cout << "<all vibrational frequencies" << std::endl;
|
135 |
+
//get electronic energies
|
136 |
+
std::vector<double> Eel;
|
137 |
+
Eel.push_back(electron.getEnergy(1)); //the one means that the D3H4X correction is applied to the total energy; use 0 if you want non-corrected energies
|
138 |
+
//get the degeneracy of ground state
|
139 |
+
std::vector<double> gel(1,1.0);
|
140 |
+
|
141 |
+
//get the eigenvalues of inertia matrix
|
142 |
+
std::vector<double> inertia = electron.Component().InertiaEigenvalues();
|
143 |
+
|
144 |
+
double T = 298.15;
|
145 |
+
bool grimmecorrection = true;
|
146 |
+
double numbermolecules = NA; //1 mol
|
147 |
+
double volume = 0.0224;
|
148 |
+
PBlRRlHOE IdealGas(T,argv[1],inertia,vibrations,Eel,gel,charge,1,"C1","0",grimmecorrection,numbermolecules,volume);
|
149 |
+
|
150 |
+
//loop over temperatures and print out
|
151 |
+
double temperature = 100.0; //K
|
152 |
+
std::cout << ">Thermodynamics" << std::endl;
|
153 |
+
for (size_t idx = 0; idx < 2201; ++idx) {
|
154 |
+
IdealGas.changeT(temperature);
|
155 |
+
std::cout << temperature << ";" << IdealGas.S() << ";" << IdealGas.H() << ";" << IdealGas.G() << ";" << IdealGas.U() << ";" << IdealGas.A() << ";" << IdealGas.CP() << ";" << IdealGas.CV() << std::endl;
|
156 |
+
temperature += 0.5;
|
157 |
+
}
|
158 |
+
std::cout << "<Thermodynamics" << std::endl;
|
159 |
+
}
|
160 |
+
|
161 |
+
//get the density?
|
162 |
+
if (calcdensity > 0) {
|
163 |
+
electron.ElectronicDensity(argv[12]);
|
164 |
+
}
|
165 |
+
|
166 |
+
//get charges and polarisabilities
|
167 |
+
std::vector<size_t> atoms = Mol1.Atoms();
|
168 |
+
std::vector<double> AtmCharge = electron.getQAtoms();
|
169 |
+
std::vector<double> polarizabilities;
|
170 |
+
electron.AtomicPolarizabilities(polarizabilities,AtmCharge);
|
171 |
+
std::cout << ">atom;charge;pol\n";
|
172 |
+
for (size_t idx = 0; idx < atoms.size(); ++idx) {
|
173 |
+
std::cout << atoms[idx] << ";";
|
174 |
+
std::cout << AtmCharge[idx] << ";" << polarizabilities[idx] << "\n";
|
175 |
+
}
|
176 |
+
std::cout << "<atom;charge;pol\n";
|
177 |
+
double polbity = 0.0;
|
178 |
+
electron.TotalPolarizability(polbity,AtmCharge);
|
179 |
+
std::cout << " Total Polarizability " << polbity << "\n";
|
180 |
+
|
181 |
+
//additional properties
|
182 |
+
matrixE RxData(1,1);
|
183 |
+
if (elecrx > 0) {
|
184 |
+
electron.ReactivityIndices(RxData,false);
|
185 |
+
std::cout << ">Electronic Reactivity indices" << std::endl;
|
186 |
+
RxData.Print(4);
|
187 |
+
std::cout << "<Electronic Reactivity indices" << std::endl;
|
188 |
+
}
|
189 |
+
|
190 |
+
if (orbrx > 0) {
|
191 |
+
electron.ReactivityIndices(RxData,true);
|
192 |
+
std::cout << ">Orbital Reactivity indices" << std::endl;
|
193 |
+
RxData.Print(4);
|
194 |
+
std::cout << "<Orbital Reactivity indices" << std::endl;
|
195 |
+
}
|
196 |
+
|
197 |
+
if (koopman > 0) {std::cout << "Ionization Potential (Koopman): " << electron.IonizationPotential(true)*au2eV << " eV" << std::endl;}
|
198 |
+
if (ip > 0) {std::cout << "Ionization Potential (Definition): " << electron.IonizationPotential(false)*au2eV << " eV" << std::endl;}
|
199 |
+
if (ea > 0) {std::cout << "Electron Affinity (Definition): " << electron.ElectronAffinity()*au2eV << " eV" << std::endl;}
|
200 |
+
|
201 |
+
if ((electronegativity > 0)||(hardness > 0)) {
|
202 |
+
double chi;
|
203 |
+
double eta;
|
204 |
+
electron.HSABdata(chi,eta);
|
205 |
+
std::cout << "Electronegativity: " << chi*au2eV << " eV" << std::endl;
|
206 |
+
std::cout << "Hardness: " << eta*au2eV << " eV" << std::endl;
|
207 |
+
}
|
208 |
+
|
209 |
+
return 0;
|
210 |
+
}
|
GFN2all_crd.exe
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:51ae3dd4f618a652ac02f5544fdd98a0e539f1935e343ceb143773b5d18c02e0
|
3 |
+
size 6962680
|
README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 3.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: lgpl-2.1
|
|
|
1 |
---
|
2 |
+
title: QM Properties Of Molecules
|
3 |
+
emoji: 📉
|
4 |
+
colorFrom: red
|
5 |
+
colorTo: gray
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 3.48.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: lgpl-2.1
|
__init__.py
ADDED
File without changes
|
__pycache__/run_gfn.cpython-310.pyc
ADDED
Binary file (8.46 kB). View file
|
|
__pycache__/test.cpython-310.pyc
ADDED
Binary file (7.94 kB). View file
|
|
app.py
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import py3Dmol
|
3 |
+
from Bio.PDB import *
|
4 |
+
import numpy as np
|
5 |
+
from Bio.PDB import PDBParser
|
6 |
+
import pandas as pd
|
7 |
+
import os, sys
|
8 |
+
#sys.path.append(os.getcwd())
|
9 |
+
print('importing...')
|
10 |
+
from run_gfn import run_gfn2
|
11 |
+
print('done')
|
12 |
+
# JavaScript functions
|
13 |
+
resid_hover = """function(atom,viewer) {{
|
14 |
+
if(!atom.label) {{
|
15 |
+
atom.label = viewer.addLabel('{0}:'+atom.atom+atom.serial,
|
16 |
+
{{position: atom, backgroundColor: 'mintcream', fontColor:'black'}});
|
17 |
+
}}
|
18 |
+
}}"""
|
19 |
+
hover_func = """
|
20 |
+
function(atom,viewer) {
|
21 |
+
if(!atom.label) {
|
22 |
+
atom.label = viewer.addLabel(atom.interaction,
|
23 |
+
{position: atom, backgroundColor: 'black', fontColor:'white'});
|
24 |
+
}
|
25 |
+
}"""
|
26 |
+
unhover_func = """
|
27 |
+
function(atom,viewer) {
|
28 |
+
if(atom.label) {
|
29 |
+
viewer.removeLabel(atom.label);
|
30 |
+
delete atom.label;
|
31 |
+
}
|
32 |
+
}"""
|
33 |
+
|
34 |
+
def get_qm_atom_features(gfn2_output, checked_features):
|
35 |
+
qm_atom_features = {}
|
36 |
+
qm_atom_features['atom type'] = gfn2_output["fetchatomicprops"]["atmlist"]
|
37 |
+
for checked_feature in checked_features:
|
38 |
+
if checked_feature == 'Charge':
|
39 |
+
qm_atom_features['Charge'] = gfn2_output["fetchatomicprops"]["charges"]
|
40 |
+
if checked_feature == 'Polarizability':
|
41 |
+
qm_atom_features['Polarizability'] = gfn2_output["fetchatomicprops"]["polarisabilities"]
|
42 |
+
return qm_atom_features
|
43 |
+
|
44 |
+
def get_qm_mol_features(gfn2_output, checked_features):
|
45 |
+
qm_mol_features = {}
|
46 |
+
qm_mol_features['Total Energy'] = gfn2_output["etotal"]
|
47 |
+
qm_mol_features['Total Polarizability'] = gfn2_output["totalpol"]
|
48 |
+
|
49 |
+
return qm_mol_features
|
50 |
+
|
51 |
+
def export_csv(d):
|
52 |
+
d.to_csv("qm_atom_features.csv")
|
53 |
+
return gr.File.update(value="qm_atom_features.csv", visible=True)
|
54 |
+
|
55 |
+
def get_basic_visualization(input_f,input_format):
|
56 |
+
view = py3Dmol.view(width=600, height=400)
|
57 |
+
view.setBackgroundColor('white')
|
58 |
+
view.addModel(input_f, input_format)
|
59 |
+
view.setStyle({'stick': {'colorscheme': {'prop': 'resi', 'C': 'turquoise'}}})
|
60 |
+
#view.setStyle({'stick': {'colorscheme': {'prop': 'resi', 'C': '#cccccc'}},'cartoon': {'color': '#4c4e9e', 'alpha':"0.6"}})
|
61 |
+
view.zoomTo()
|
62 |
+
output = view._make_html().replace("'", '"')
|
63 |
+
print('output of html', output)
|
64 |
+
x = f"""<!DOCTYPE html><html> {output} </html>""" # do not use ' in this input
|
65 |
+
visualization_html = f"""<iframe style="width: 100%; height:420px" data-ui="true" name="result" allow="midi; geolocation; microphone; camera;
|
66 |
+
display-capture; encrypted-media;" sandbox="allow-modals allow-forms
|
67 |
+
allow-scripts allow-same-origin allow-popups
|
68 |
+
allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""
|
69 |
+
allowpaymentrequest="" frameborder="0" srcdoc='{x}'></iframe>"""
|
70 |
+
return visualization_html
|
71 |
+
|
72 |
+
def add_spheres_feature_view(view, feature,xyz, viewnum, sizefactor, spec_color):
|
73 |
+
for i in range(len(feature)):
|
74 |
+
if feature[i]<0:
|
75 |
+
color="red"
|
76 |
+
else:
|
77 |
+
color=spec_color
|
78 |
+
view.addSphere({'center':{
|
79 |
+
'x':xyz[i][0],
|
80 |
+
'y':xyz[i][1],
|
81 |
+
'z':xyz[i][2]},
|
82 |
+
'radius':abs(feature[i])*sizefactor,'color':color,'alpha':1.00}, viewer=viewnum)
|
83 |
+
return view
|
84 |
+
|
85 |
+
def add_densities(view, dens, color, viewnum):
|
86 |
+
view.addVolumetricData(dens, "cube", {'isoval': 0.01, 'color': color, 'opacity': 1.0}, viewer=viewnum)
|
87 |
+
return view
|
88 |
+
|
89 |
+
|
90 |
+
def get_feature_visualization(input_f,input_format, features, xyz):
|
91 |
+
view = py3Dmol.view(width=600, height=400, viewergrid=(2,2))
|
92 |
+
view.setBackgroundColor('white')
|
93 |
+
view.addModel(input_f, input_format, viewer=(0,0))
|
94 |
+
view.addModel(input_f, input_format, viewer=(0,1))
|
95 |
+
view.addModel(input_f, input_format, viewer=(1,0))
|
96 |
+
view.setStyle({'stick': {'colorscheme': {'prop': 'resi', 'C': '#cccccc'}}}, viewer=(0,0))
|
97 |
+
view.setStyle({'stick': {'colorscheme': {'prop': 'resi', 'C': '#cccccc'}}}, viewer=(0,1))
|
98 |
+
view.setStyle({'stick': {'colorscheme': {'prop': 'resi', 'C': '#cccccc'}}}, viewer=(1,0))
|
99 |
+
#view.setStyle({'stick': {'colorscheme': {'prop': 'resi', 'C': '#cccccc'}}}, viewer=(0,1))
|
100 |
+
add_spheres_feature_view(view, features["fetchatomicprops"]["charges"], xyz, (0,1), 20, 'blue')
|
101 |
+
add_spheres_feature_view(view, features["fetchatomicprops"]["polarisabilities"], xyz, (1,0), 0.2, 'orange')
|
102 |
+
add_densities(view, open('dummy_struct_dens.cub', "r").read(), 'green', (1,1))
|
103 |
+
#view.setStyle({'stick': {'colorscheme': {'prop': 'resi', 'C': '#cccccc'}},'cartoon': {'color': '#4c4e9e', 'alpha':"0.6"}})
|
104 |
+
view.zoomTo(viewer=(0,0))
|
105 |
+
output = view._make_html().replace("'", '"')
|
106 |
+
x = f"""<!DOCTYPE html><html> {output} </html>""" # do not use ' in this input
|
107 |
+
visualization_html = f"""<iframe style="width: 100%; height:420px" name="result" allow="midi; geolocation; microphone; camera;
|
108 |
+
display-capture; encrypted-media;" sandbox="allow-modals allow-forms
|
109 |
+
allow-scripts allow-same-origin allow-popups
|
110 |
+
allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""
|
111 |
+
allowpaymentrequest="" frameborder="0" srcdoc='{x}'></iframe>"""
|
112 |
+
return visualization_html
|
113 |
+
|
114 |
+
|
115 |
+
|
116 |
+
def predict(checked_features, input_file, temperature):
|
117 |
+
input_f = open(input_file.name, "r").read()
|
118 |
+
input_format = input_file.name.split('.')[-1]
|
119 |
+
|
120 |
+
with open('dummy_struct.'+input_format, "w") as oF:
|
121 |
+
oF.write(input_f)
|
122 |
+
|
123 |
+
input_f2 = open('dummy_struct.'+input_format, "r").read()
|
124 |
+
gfn2_input = ["filename","geom=dummy_struct."+input_format, 'calcdens=1']
|
125 |
+
gfn2_output = run_gfn2(gfn2_input)
|
126 |
+
|
127 |
+
qm_atom_features = get_qm_atom_features(gfn2_output, checked_features)
|
128 |
+
qm_mol_features = get_qm_mol_features(gfn2_output, checked_features)
|
129 |
+
#basic_visualization_html = get_basic_visualization(input_f,input_format)
|
130 |
+
feature_visualization_html = get_feature_visualization(input_f,input_format, gfn2_output, gfn2_output['xyz'])
|
131 |
+
|
132 |
+
|
133 |
+
return feature_visualization_html, pd.DataFrame(qm_atom_features)#, pd.DataFrame(qm_mol_features, index=[0])
|
134 |
+
|
135 |
+
with gr.Blocks() as demo:
|
136 |
+
gr.Markdown("# QM property calculation")
|
137 |
+
|
138 |
+
#text_input = gr.Textbox()
|
139 |
+
#text_output = gr.Textbox()
|
140 |
+
#text_button = gr.Button("Flip")
|
141 |
+
|
142 |
+
|
143 |
+
|
144 |
+
with gr.Row():
|
145 |
+
input_file = gr.File(label="Structure file for input")
|
146 |
+
charge = gr.Textbox(placeholder="Total charge", label="Give the total charge of the input molecule. (Default=0)")
|
147 |
+
checked_features = gr.CheckboxGroup(["Charge", "Polarizability", "Koopman IP", "Electronic Density"], label="QM features", info="Which features shall be calculated?")
|
148 |
+
temperature = gr.Slider(value=300,minimum=0, maximum=1000, label="Temperature for Thermodynamics evaluation in K", step=5)
|
149 |
+
#with gr.Row():
|
150 |
+
# helix = gr.ColorPicker(label="helix")
|
151 |
+
# sheet = gr.ColorPicker(label="sheet")
|
152 |
+
# loop = gr.ColorPicker(label="loop")
|
153 |
+
single_btn = gr.Button(label="Run")
|
154 |
+
with gr.Row():
|
155 |
+
basic_html = gr.HTML()
|
156 |
+
gr.HighlightedText(value=[("Positive Charge","blue"),("Negative charge","red"),("Polarizability","orange"), ("Electronic Densities", "Green")], color_map={"red":"red", "blue":"blue", "orange":"orange", "Green":"green"})
|
157 |
+
#with gr.Row():
|
158 |
+
# basic_html = gr.HTML()
|
159 |
+
with gr.Row():
|
160 |
+
Dbutton = gr.Button("Download calculated atom features")
|
161 |
+
csv = gr.File(interactive=False, visible=False)
|
162 |
+
with gr.Row():
|
163 |
+
df_atom_features = gr.Dataframe()
|
164 |
+
#df_mol_features = gr.Dataframe()
|
165 |
+
|
166 |
+
single_btn.click(fn=predict, inputs=[checked_features, input_file, temperature], outputs=[basic_html, df_atom_features])
|
167 |
+
Dbutton.click(export_csv, df_atom_features, csv)
|
168 |
+
|
169 |
+
|
170 |
+
|
171 |
+
|
172 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|
cyclohexane.xyz
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
18
|
2 |
+
|
3 |
+
C 1.1681569 -0.2550550 0.8756595
|
4 |
+
C 1.3484628 0.1965789 -0.5826021
|
5 |
+
C -0.1630149 0.2550556 1.4507918
|
6 |
+
C -1.3484630 -0.1965791 0.5826038
|
7 |
+
C -1.1681567 0.2550548 -0.8756576
|
8 |
+
C 0.1630149 -0.2550556 -1.4507899
|
9 |
+
H -1.4440620 -1.2992544 0.6239080
|
10 |
+
H -2.2954881 0.2017985 0.9917659
|
11 |
+
H -0.2922653 -0.1016823 2.4895446
|
12 |
+
H -0.1446071 1.3607175 1.5133326
|
13 |
+
H 1.4440620 1.2992544 -0.6239060
|
14 |
+
H 2.2954880 -0.2017985 -0.9917640
|
15 |
+
H 2.0131366 0.1016836 1.4934968
|
16 |
+
H 1.2010813 -1.3607168 0.9319297
|
17 |
+
H 0.2922653 0.1016827 -2.4895433
|
18 |
+
H 0.1446071 -1.3607176 -1.5133316
|
19 |
+
H -2.0131365 -0.1016835 -1.4934950
|
20 |
+
H -1.2010813 1.3607168 -0.9319277
|
dummy_struct.xyz
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
18
|
2 |
+
|
3 |
+
C 1.1681569 -0.2550550 0.8756595
|
4 |
+
C 1.3484628 0.1965789 -0.5826021
|
5 |
+
C -0.1630149 0.2550556 1.4507918
|
6 |
+
C -1.3484630 -0.1965791 0.5826038
|
7 |
+
C -1.1681567 0.2550548 -0.8756576
|
8 |
+
C 0.1630149 -0.2550556 -1.4507899
|
9 |
+
H -1.4440620 -1.2992544 0.6239080
|
10 |
+
H -2.2954881 0.2017985 0.9917659
|
11 |
+
H -0.2922653 -0.1016823 2.4895446
|
12 |
+
H -0.1446071 1.3607175 1.5133326
|
13 |
+
H 1.4440620 1.2992544 -0.6239060
|
14 |
+
H 2.2954880 -0.2017985 -0.9917640
|
15 |
+
H 2.0131366 0.1016836 1.4934968
|
16 |
+
H 1.2010813 -1.3607168 0.9319297
|
17 |
+
H 0.2922653 0.1016827 -2.4895433
|
18 |
+
H 0.1446071 -1.3607176 -1.5133316
|
19 |
+
H -2.0131365 -0.1016835 -1.4934950
|
20 |
+
H -1.2010813 1.3607168 -0.9319277
|
dummy_struct_dens.cub
ADDED
The diff for this file is too large to render.
See raw diff
|
|
geom_cyclohexane.xyz
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
18
|
2 |
+
|
3 |
+
C 1.1681569 -0.2550550 0.8756595
|
4 |
+
C 1.3484628 0.1965789 -0.5826021
|
5 |
+
C -0.1630149 0.2550556 1.4507918
|
6 |
+
C -1.3484630 -0.1965791 0.5826038
|
7 |
+
C -1.1681567 0.2550548 -0.8756576
|
8 |
+
C 0.1630149 -0.2550556 -1.4507899
|
9 |
+
H -1.4440620 -1.2992544 0.6239080
|
10 |
+
H -2.2954881 0.2017985 0.9917659
|
11 |
+
H -0.2922653 -0.1016823 2.4895446
|
12 |
+
H -0.1446071 1.3607175 1.5133326
|
13 |
+
H 1.4440620 1.2992544 -0.6239060
|
14 |
+
H 2.2954880 -0.2017985 -0.9917640
|
15 |
+
H 2.0131366 0.1016836 1.4934968
|
16 |
+
H 1.2010813 -1.3607168 0.9319297
|
17 |
+
H 0.2922653 0.1016827 -2.4895433
|
18 |
+
H 0.1446071 -1.3607176 -1.5133316
|
19 |
+
H -2.0131365 -0.1016835 -1.4934950
|
20 |
+
H -1.2010813 1.3607168 -0.9319277
|
geometry.xyz
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
18
|
2 |
+
|
3 |
+
C 1.1681569 -0.2550550 0.8756595
|
4 |
+
C 1.3484628 0.1965789 -0.5826021
|
5 |
+
C -0.1630149 0.2550556 1.4507918
|
6 |
+
C -1.3484630 -0.1965791 0.5826038
|
7 |
+
C -1.1681567 0.2550548 -0.8756576
|
8 |
+
C 0.1630149 -0.2550556 -1.4507899
|
9 |
+
H -1.4440620 -1.2992544 0.6239080
|
10 |
+
H -2.2954881 0.2017985 0.9917659
|
11 |
+
H -0.2922653 -0.1016823 2.4895446
|
12 |
+
H -0.1446071 1.3607175 1.5133326
|
13 |
+
H 1.4440620 1.2992544 -0.6239060
|
14 |
+
H 2.2954880 -0.2017985 -0.9917640
|
15 |
+
H 2.0131366 0.1016836 1.4934968
|
16 |
+
H 1.2010813 -1.3607168 0.9319297
|
17 |
+
H 0.2922653 0.1016827 -2.4895433
|
18 |
+
H 0.1446071 -1.3607176 -1.5133316
|
19 |
+
H -2.0131365 -0.1016835 -1.4934950
|
20 |
+
H -1.2010813 1.3607168 -0.9319277
|
main.py
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import py3Dmol
|
3 |
+
from Bio.PDB import *
|
4 |
+
import numpy as np
|
5 |
+
from Bio.PDB import PDBParser
|
6 |
+
import pandas as pd
|
7 |
+
import os, sys
|
8 |
+
#sys.path.append(os.getcwd())
|
9 |
+
print('importing...')
|
10 |
+
from run_gfn import run_gfn2
|
11 |
+
print('done')
|
12 |
+
# JavaScript functions
|
13 |
+
resid_hover = """function(atom,viewer) {{
|
14 |
+
if(!atom.label) {{
|
15 |
+
atom.label = viewer.addLabel('{0}:'+atom.atom+atom.serial,
|
16 |
+
{{position: atom, backgroundColor: 'mintcream', fontColor:'black'}});
|
17 |
+
}}
|
18 |
+
}}"""
|
19 |
+
hover_func = """
|
20 |
+
function(atom,viewer) {
|
21 |
+
if(!atom.label) {
|
22 |
+
atom.label = viewer.addLabel(atom.interaction,
|
23 |
+
{position: atom, backgroundColor: 'black', fontColor:'white'});
|
24 |
+
}
|
25 |
+
}"""
|
26 |
+
unhover_func = """
|
27 |
+
function(atom,viewer) {
|
28 |
+
if(atom.label) {
|
29 |
+
viewer.removeLabel(atom.label);
|
30 |
+
delete atom.label;
|
31 |
+
}
|
32 |
+
}"""
|
33 |
+
|
34 |
+
|
35 |
+
def predict(input_id, input_file):
|
36 |
+
|
37 |
+
|
38 |
+
input_f = open(input_file.name, "r").read()
|
39 |
+
input_format = input_file.name.split('.')[-1]
|
40 |
+
|
41 |
+
#with open('geometry.'+input_format, "w") as oF:
|
42 |
+
# oF.write(input_f)
|
43 |
+
#
|
44 |
+
#input_f2 = open('geometry.'+input_format, "r").read()
|
45 |
+
#print(len(input_f),len(input_f))
|
46 |
+
#for c in range(len(input_f)):
|
47 |
+
# if input_f[c] != input_f2[c]:
|
48 |
+
# print(input_f[c], input_f2[c])
|
49 |
+
|
50 |
+
gfn2_output = run_gfn2(["filename","geom=cyclohexane."+input_format])
|
51 |
+
print(gfn2_output)
|
52 |
+
charges = gfn2_output["fetchatomicprops"]["charges"]
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
view = py3Dmol.view(width=600, height=400)
|
57 |
+
view.setBackgroundColor('white')
|
58 |
+
view.addModel(input_f, input_format)
|
59 |
+
view.setStyle({'stick': {'colorscheme': {'prop': 'resi', 'C': 'turquoise'}}})
|
60 |
+
#view.setStyle({'stick': {'colorscheme': {'prop': 'resi', 'C': '#cccccc'}},'cartoon': {'color': '#4c4e9e', 'alpha':"0.6"}})
|
61 |
+
view.zoomTo()
|
62 |
+
|
63 |
+
output = view._make_html().replace("'", '"')
|
64 |
+
print("got a view")
|
65 |
+
x = f"""<!DOCTYPE html><html> {output} </html>""" # do not use ' in this input
|
66 |
+
return f"""<iframe style="width: 100%; height:420px" name="result" allow="midi; geolocation; microphone; camera;
|
67 |
+
display-capture; encrypted-media;" sandbox="allow-modals allow-forms
|
68 |
+
allow-scripts allow-same-origin allow-popups
|
69 |
+
allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""
|
70 |
+
allowpaymentrequest="" frameborder="0" srcdoc='{x}'></iframe>"""
|
71 |
+
|
72 |
+
print('run 1')
|
73 |
+
callback = gr.CSVLogger()
|
74 |
+
with gr.Blocks() as demo:
|
75 |
+
gr.Markdown("# Protein Adaptability Prediction")
|
76 |
+
|
77 |
+
#text_input = gr.Textbox()
|
78 |
+
#text_output = gr.Textbox()
|
79 |
+
#text_button = gr.Button("Flip")
|
80 |
+
inp = gr.Textbox(placeholder="PDB Code or upload file below", label="Input structure")
|
81 |
+
pdb_file = gr.File(label="PDB File Upload")
|
82 |
+
#with gr.Row():
|
83 |
+
# helix = gr.ColorPicker(label="helix")
|
84 |
+
# sheet = gr.ColorPicker(label="sheet")
|
85 |
+
# loop = gr.ColorPicker(label="loop")
|
86 |
+
single_btn = gr.Button(label="Run")
|
87 |
+
with gr.Row():
|
88 |
+
html = gr.HTML()
|
89 |
+
with gr.Row():
|
90 |
+
dataframe = gr.Dataframe()
|
91 |
+
|
92 |
+
single_btn.click(fn=predict, inputs=[inp, pdb_file], outputs=[html])
|
93 |
+
|
94 |
+
#out_d = run_gfn2("geom=cyclohexane.xyz")
|
95 |
+
|
96 |
+
|
97 |
+
#demo.launch(debug=True)
|
98 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|
qm_atom_features.csv
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,atom type
|
2 |
+
0,6
|
3 |
+
1,6
|
4 |
+
2,6
|
5 |
+
3,6
|
6 |
+
4,6
|
7 |
+
5,6
|
8 |
+
6,1
|
9 |
+
7,1
|
10 |
+
8,1
|
11 |
+
9,1
|
12 |
+
10,1
|
13 |
+
11,1
|
14 |
+
12,1
|
15 |
+
13,1
|
16 |
+
14,1
|
17 |
+
15,1
|
18 |
+
16,1
|
19 |
+
17,1
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
numpy
|
requirements_full.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
requests
|
3 |
+
py3Dmol
|
4 |
+
biopython
|
5 |
+
pandas
|
6 |
+
numpy
|
runGFN2.py
ADDED
@@ -0,0 +1,318 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import sys
|
3 |
+
import subprocess
|
4 |
+
|
5 |
+
|
6 |
+
def run_gfn2(argv):
|
7 |
+
#arguments and give them default values
|
8 |
+
exe = "./GFN2all.exe"
|
9 |
+
geometryfile = ""
|
10 |
+
charge = "0"
|
11 |
+
Telec = "300"
|
12 |
+
solvation = "0"
|
13 |
+
solventname = "gas"
|
14 |
+
optimisegeometry = "0"
|
15 |
+
newgeometryfile = ""
|
16 |
+
thermo = "0"
|
17 |
+
energythresh = "1.0e-6"
|
18 |
+
gradientthresh = "1.0e-3"
|
19 |
+
calcdensity = "0"
|
20 |
+
densityfile = ""
|
21 |
+
electronicreactivity = "0"
|
22 |
+
orbitalreactivity = "0"
|
23 |
+
KoopmanIP = "0"
|
24 |
+
IP = "0"
|
25 |
+
EA = "0"
|
26 |
+
electronegativity = "0"
|
27 |
+
hardness = "0"
|
28 |
+
|
29 |
+
#parse whatever we get
|
30 |
+
for iarg in range(1,len(argv)):
|
31 |
+
argument = argv[iarg].lower().replace("=","")
|
32 |
+
if argument.startswith("geometry") or argument.startswith("geom"):
|
33 |
+
geometryfile = argument.replace("geometry","").replace("geom","")
|
34 |
+
elif argument.startswith("charge") or argument.startswith("chrg"):
|
35 |
+
charge = argument.replace("charge","").replace("chrg","")
|
36 |
+
elif argument.startswith("telec") or argument.startswith("telectronic"):
|
37 |
+
Telec = argument.replace("telectronic","").replace("telec","")
|
38 |
+
elif argument.startswith("usesolv") or argument.startswith("usesolvent"):
|
39 |
+
solvation = argument.replace("usesolvent","").replace("usesolv","")
|
40 |
+
elif argument.startswith("solvent") or argument.startswith("solventname"):
|
41 |
+
solventname = argument.replace("solventname","").replace("solvent","")
|
42 |
+
elif argument.startswith("optg") or argument.startswith("optimisegeom") or argument.startswith("optimizegeom") or argument.startswith("optimisegeometry") or argument.startswith("optimizegeometry"):
|
43 |
+
optimisegeometry = argument.replace("optg","").replace("optimise","").replace("optimize","").replace("geometry","").replace("geom","")
|
44 |
+
elif argument.startswith("newgeom") or argument.startswith("newgeomfile") or argument.startswith("newgeometryfile"):
|
45 |
+
newgeometryfile = argument.replace("newgeometryfile","").replace("newgeomfile","").replace("newgeom","")
|
46 |
+
elif argument.startswith("dothermo") or argument.startswith("thermo") or argument.startswith("thermodynamics"):
|
47 |
+
thermo = argument.replace("dothermo","").replace("thermodynamics","").replace("thermo","")
|
48 |
+
elif argument.startswith("ethresh") or argument.startswith("energythresh") or argument.startswith("energythreshold"):
|
49 |
+
energythresh = argument.replace("ethresh","").replace("energythreshold","").replace("energythresh","")
|
50 |
+
elif argument.startswith("gthresh") or argument.startswith("gradthresh") or argument.startswith("gradientthreshold"):
|
51 |
+
gradientthresh = argument.replace("gthresh","").replace("gradientthreshold","").replace("gradthresh","")
|
52 |
+
elif argument.startswith("calcdens") or argument.startswith("calcdensity") or argument.startswith("calculatedensity"):
|
53 |
+
calcdensity = argument.replace("calcdensity","").replace("calcdens","").replace("calculatedensity","")
|
54 |
+
elif argument.startswith("densityfile") or argument.startswith("densfile"):
|
55 |
+
calcdensity = argument.replace("densityfile","").replace("densfile","")
|
56 |
+
elif argument.startswith("ereact") or argument.startswith("electronicreactivity"):
|
57 |
+
electronicreactivity = argument.replace("ereact","").replace("electronicreactivity","")
|
58 |
+
elif argument.startswith("oreact") or argument.startswith("orbreact") or argument.startswith("orbitalreactivity"):
|
59 |
+
orbitalreactivity = argument.replace("oreact","").replace("orbreact","").replace("orbitalreactivity","")
|
60 |
+
elif argument.startswith("koopman") or argument.startswith("ipkoopman") or argument.startswith("koopmanip"):
|
61 |
+
KoopmanIP = argument.replace("ip","").replace("koopman","")
|
62 |
+
elif argument.startswith("ip") or argument.startswith("ionizationpotential") or argument.startswith("ionisationpotential") or argument.startswith("ipot"):
|
63 |
+
IP = argument.replace("ip","").replace("ionizationpotential","").replace("ionisationpotential","").replace("ipot","")
|
64 |
+
elif argument.startswith("ea") or argument.startswith("electronaffinity") or argument.startswith("eaffin"):
|
65 |
+
EA = argument.replace("ea","").replace("electronaffinity","").replace("eaffin","")
|
66 |
+
elif argument.startswith("electronegativity"):
|
67 |
+
electronegativity = argument.replace("electronegativity","")
|
68 |
+
elif argument.startswith("hardness"):
|
69 |
+
hardness = argument.replace("hardness","")
|
70 |
+
|
71 |
+
#ensure consistency
|
72 |
+
if geometryfile + "blahblah" == "blahblah":
|
73 |
+
print("ERROR: geometry file is needed")
|
74 |
+
sys.exit()
|
75 |
+
|
76 |
+
newgeometryfile.replace(".xyz","").replace(".sdf","").replace(".mol2","").replace(".pdb","")
|
77 |
+
if (newgeometryfile + "blahblah" == "blahblah") and (optimisegeometry == "1"):
|
78 |
+
newgeometryfile = geometryfile.replace(".xyz","").replace(".sdf","").replace(".mol2","").replace(".pdb","") + "_opt"
|
79 |
+
|
80 |
+
if (solvation == "1"):
|
81 |
+
if (solventname == "water") or (solventname == "h2o") or (solventname == "o"): solventname = "water"
|
82 |
+
elif (solventname == "acetone") or (solventname == "cc(o)c"): solventname = "acetone"
|
83 |
+
elif (solventname == "acetonitrile") or (solventname == "ch3cn") or (solventname == "ccn"): solventname = "acetonitrile"
|
84 |
+
elif (solventname == "aniline") or (solventname == "phnh2") or (solventname == "nc1ccccc1") or (solventname == "c1ccc(cc1)n"): solventname = "aniline"
|
85 |
+
elif (solventname == "benzaldehyde") or (solventname == "phcho") or (solventname == "occ1ccccc1") or (solventname == "c1ccc(cc1)co"): solventname = "benzaldehyde"
|
86 |
+
elif (solventname == "benzene") or (solventname == "c6h6") or (solventname == "phh") or (solventname == "c1ccccc1"): solventname = "benzene"
|
87 |
+
elif (solventname == "dichloromethane") or (solventname == "ch2cl2") or (solventname == "c(cl)cl") or (solventname == "c(cl)(cl)"): solventname = "dichloromethane"
|
88 |
+
elif (solventname == "chloroform") or (solventname == "chcl3") or (solventname == "c(cl)(cl)cl") or (solventname == "c(cl)(cl)(cl)"): solventname = "chloroform"
|
89 |
+
elif (solventname == "carbon disulfide") or (solventname == "carbondisulfide") or (solventname == "cs2") or (solventname == "scs"): solventname = "carbon disulfide"
|
90 |
+
elif (solventname == "dioxane") or (solventname == "o1ccocc1"): solventname = "dioxane"
|
91 |
+
elif (solventname == "dmf") or (solventname == "dimethylformamide") or (solventname == "cn(c)co"): solventname = "dmf"
|
92 |
+
elif (solventname == "dmso") or (solventname == "dimethylsulfoxide") or (solventname == "cs(o)c") or (solventname == "cs(c)o"): solventname = "dmso"
|
93 |
+
elif (solventname == "ethanol") or (solventname == "etoh") or (solventname == "ch3ch2oh") or (solventname == "cco"): solventname = "ethanol"
|
94 |
+
elif (solventname == "diethyl ether") or (solventname == "etoet") or (solventname == "ccocc") or (solventname == "ch3ch2och2ch3"): solventname = "diethyl ether"
|
95 |
+
elif (solventname == "ethyl acetate") or (solventname == "acoet") or (solventname == "etoac") or (solventname == "ccoc(o)c"): solventname = "ethyl acetate"
|
96 |
+
elif (solventname == "furan") or (solventname == "furane"): solventname = "furane"
|
97 |
+
elif (solventname == "hexadecane") or (solventname == "c16"): solventname = "hexadecane"
|
98 |
+
elif (solventname == "hexane") or (solventname == "cccccc") or (solventname == "c6"): solventname = "hexane"
|
99 |
+
elif (solventname == "methanol") or (solventname == "meoh") or (solventname == "co") or (solventname == "ch3oh"): solventname = "methanol"
|
100 |
+
elif (solventname == "nitromethane") or (solventname == "meno2") or (solventname == "ch3no2") or (solventname == "cn(o)o"): solventname = "nitromethane"
|
101 |
+
elif (solventname == "octanol") or (solventname == "cccccccc") or (solventname == "c8"): solventname = "octanol"
|
102 |
+
elif (solventname == "phenol") or (solventname == "phoh") or (solventname == "oc1ccccc1") or (solventname == "c1ccc(cc1)o"): solventname = "phenol"
|
103 |
+
elif (solventname == "thf") or (solventname == "tetrahydrofuran"): solventname = "thf"
|
104 |
+
elif (solventname == "toluene") or (solventname == "phme") or (solventname == "cc1ccccc1"): solventname = "toluene"
|
105 |
+
elif (solventname == "octanol wet") or (solventname == "octanolwet") or (solventname == "wet octanol") or (solventname == "wetoctanol"): solventname = "octanol wet"
|
106 |
+
|
107 |
+
if (densityfile + "blahblah" == "blahblah") and (calcdensity == "1"):
|
108 |
+
densityfile = geometryfile.replace(".xyz","").replace(".sdf","").replace(".mol2","").replace(".pdb","") + "_dens"
|
109 |
+
|
110 |
+
def RunQMOptg():
|
111 |
+
proc = subprocess.Popen([exe,geometryfile,charge,Telec,solvation,solventname,optimisegeometry,newgeometryfile,thermo,energythresh,gradientthresh,calcdensity,densityfile,electronicreactivity,orbitalreactivity,KoopmanIP,IP,EA,electronegativity,hardness], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
112 |
+
out,err = proc.communicate()
|
113 |
+
return out,err
|
114 |
+
out,err = RunQMOptg()
|
115 |
+
|
116 |
+
if err.decode("utf-8") + "blahblah" != "blahblah": print("error:",err)
|
117 |
+
else:
|
118 |
+
#process data from output file
|
119 |
+
outputfile = out.decode("utf-8").split("\n")
|
120 |
+
print(out.decode("utf-8"))
|
121 |
+
etotal = 0.0
|
122 |
+
gsolvation = 0.0
|
123 |
+
fetchvibr = False
|
124 |
+
vibrations = []
|
125 |
+
fetchthermo = False
|
126 |
+
temperature = []
|
127 |
+
entropy = []
|
128 |
+
enthalpy = []
|
129 |
+
gibbs = []
|
130 |
+
internalenergy = []
|
131 |
+
helmholtz = []
|
132 |
+
cp = []
|
133 |
+
cv = []
|
134 |
+
fetchatomicprops = False
|
135 |
+
atmlist = []
|
136 |
+
charges = []
|
137 |
+
polarisabilities = []
|
138 |
+
totalpol = 0.0
|
139 |
+
fetchelecreact = False
|
140 |
+
fetchorbreact = False
|
141 |
+
eFukuiElctrophilie = []
|
142 |
+
eFukuiNucleophilie = []
|
143 |
+
eFukuiRadical = []
|
144 |
+
eSoftnessElctrophilie = []
|
145 |
+
eSoftnessNucleophilie = []
|
146 |
+
eSoftnessRadical = []
|
147 |
+
oFukuiElctrophilie = []
|
148 |
+
oFukuiNucleophilie = []
|
149 |
+
oFukuiRadical = []
|
150 |
+
oSoftnessElctrophilie = []
|
151 |
+
oSoftnessNucleophilie = []
|
152 |
+
oSoftnessRadical = []
|
153 |
+
ipkoopman = 0.0
|
154 |
+
ip = 0.0
|
155 |
+
ea = 0.0
|
156 |
+
eneg = 0.0
|
157 |
+
hard = 0.0
|
158 |
+
out_dict = {}
|
159 |
+
for iline in range(len(outputfile)):
|
160 |
+
line = outputfile[iline]
|
161 |
+
#check whether array data is available
|
162 |
+
if line.startswith(">all vibrational frequencies"):
|
163 |
+
fetchvibr = True
|
164 |
+
continue
|
165 |
+
elif line.startswith("<all vibrational frequencies"):
|
166 |
+
fetchvibr = False
|
167 |
+
continue
|
168 |
+
elif line.startswith(">Thermodynamics"):
|
169 |
+
fetchthermo = True
|
170 |
+
continue
|
171 |
+
elif line.startswith("<Thermodynamics"):
|
172 |
+
fetchthermo = False
|
173 |
+
continue
|
174 |
+
elif line.startswith(">atom;charge;pol"):
|
175 |
+
fetchatomicprops = True
|
176 |
+
continue
|
177 |
+
elif line.startswith("<atom;charge;pol"):
|
178 |
+
fetchatomicprops = False
|
179 |
+
continue
|
180 |
+
elif line.startswith(">Electronic Reactivity indices"):
|
181 |
+
fetchelecreact = True
|
182 |
+
continue
|
183 |
+
elif line.startswith("<Electronic Reactivity indices"):
|
184 |
+
fetchelecreact = False
|
185 |
+
continue
|
186 |
+
elif line.startswith(">Orbital Reactivity indices"):
|
187 |
+
fetchorbreact = True
|
188 |
+
continue
|
189 |
+
elif line.startswith("<Orbital Reactivity indices"):
|
190 |
+
fetchorbreact = False
|
191 |
+
continue
|
192 |
+
#fetch data
|
193 |
+
if line.startswith("Total Energy = "):
|
194 |
+
etotal = float(line.replace("Total Energy = ",""))
|
195 |
+
out_dict['etotal']=etotal
|
196 |
+
elif line.startswith("Gsolv = "):
|
197 |
+
gsolvation = float(line.replace("Gsolv = ",""))
|
198 |
+
out_dict['gsolvation']=gsolvation
|
199 |
+
elif "Total Polarizability" in line:
|
200 |
+
totalpol = float(line.replace("Total Polarizability","").replace(" ",""))
|
201 |
+
out_dict['totalpol']=totalpol
|
202 |
+
elif line.startswith("Ionization Potential (Koopman):"):
|
203 |
+
ipkoopman = float(line.replace("Ionization Potential (Koopman):","").replace(" eV",""))
|
204 |
+
out_dict['ipkoopman']=ipkoopman
|
205 |
+
elif line.startswith("Ionization Potential (Definition): "):
|
206 |
+
ip = float(line.replace("Ionization Potential (Definition): ","").replace(" eV",""))
|
207 |
+
out_dict['ip']=ip
|
208 |
+
elif line.startswith("Electron Affinity (Definition): "):
|
209 |
+
ea = float(line.replace("Electron Affinity (Definition): ","").replace(" eV",""))
|
210 |
+
out_dict['ea']=ea
|
211 |
+
elif line.startswith("Electronegativity: "):
|
212 |
+
eneg = float(line.replace("Electronegativity: ","").replace(" eV",""))
|
213 |
+
out_dict['eneg']=eneg
|
214 |
+
elif line.startswith("Hardness: "):
|
215 |
+
hard = float(line.replace("Hardness: ","").replace(" eV",""))
|
216 |
+
out_dict['hard']=hard
|
217 |
+
elif fetchvibr:
|
218 |
+
vibrations.append(float(line))
|
219 |
+
out_dict['vibrations']=vibrations
|
220 |
+
elif fetchthermo:
|
221 |
+
data = line.split(";")
|
222 |
+
temperature.append(float(data[0]))
|
223 |
+
entropy.append(float(data[1]))
|
224 |
+
enthalpy.append(float(data[2]))
|
225 |
+
gibbs.append(float(data[3]))
|
226 |
+
internalenergy.append(float(data[4]))
|
227 |
+
helmholtz.append(float(data[5]))
|
228 |
+
cp.append(float(data[6]))
|
229 |
+
cv.append(float(data[7]))
|
230 |
+
out_dict['fetchthermo']={"temperature":temperature,
|
231 |
+
"entropy":entropy,
|
232 |
+
"enthalpy":enthalpy,
|
233 |
+
"gibbs":gibbs,
|
234 |
+
"internalenergy":internalenergy,
|
235 |
+
"helmholtz":helmholtz,
|
236 |
+
"cp":cp,
|
237 |
+
"cv":cv
|
238 |
+
}
|
239 |
+
elif fetchatomicprops:
|
240 |
+
data = line.split(";")
|
241 |
+
atmlist.append(int(data[0]))
|
242 |
+
charges.append(float(data[1]))
|
243 |
+
polarisabilities.append(float(data[2]))
|
244 |
+
out_dict['fetchatomicprops']={"atmlist":atmlist,
|
245 |
+
"charges":charges,
|
246 |
+
"polarisabilities":polarisabilities
|
247 |
+
}
|
248 |
+
elif fetchelecreact:
|
249 |
+
data = line.strip().rstrip().replace(" "," ").split(" ")
|
250 |
+
eFukuiElctrophilie.append(float(data[0]))
|
251 |
+
eFukuiNucleophilie.append(float(data[1]))
|
252 |
+
eFukuiRadical.append(float(data[2]))
|
253 |
+
eSoftnessElctrophilie.append(float(data[3]))
|
254 |
+
eSoftnessNucleophilie.append(float(data[4]))
|
255 |
+
eSoftnessRadical.append(float(data[5]))
|
256 |
+
out_dict['fetchelecreact']=fetchelecreact
|
257 |
+
elif fetchorbreact:
|
258 |
+
data = line.strip().rstrip().replace(" "," ").split(" ")
|
259 |
+
oFukuiElctrophilie.append(float(data[0]))
|
260 |
+
oFukuiNucleophilie.append(float(data[1]))
|
261 |
+
oFukuiRadical.append(float(data[2]))
|
262 |
+
oSoftnessElctrophilie.append(float(data[3]))
|
263 |
+
oSoftnessNucleophilie.append(float(data[4]))
|
264 |
+
oSoftnessRadical.append(float(data[5]))
|
265 |
+
out_dict['fetchorbreact']=fetchorbreact
|
266 |
+
print(argv)
|
267 |
+
return out_dict
|
268 |
+
#data collected; if there is a whether, then variable is boolean
|
269 |
+
#geometryfile the geometry of the molecule
|
270 |
+
#charge the total charge
|
271 |
+
#solventname the name of the solvent
|
272 |
+
#optimisegeometry whether geometry was optimised
|
273 |
+
#newgeometryfile the name of the file containing optimised geometry
|
274 |
+
#thermo whether thermodynamics was done
|
275 |
+
#calcdensity whether the electronic density was calculated
|
276 |
+
#densityfile the name of the file containing electronic density
|
277 |
+
#electronicreactivity whether electronic reactivity data was calculated
|
278 |
+
#orbitalreactivity whether orbital reacticity data was calculated
|
279 |
+
#KoopmanIP whether the Koopman ionisation potential was calculated
|
280 |
+
#IP whether the ionisation potential was calculated
|
281 |
+
#EA whether electron affinity was calculated
|
282 |
+
#electronegativity whether electronegativity was calculated
|
283 |
+
#hardness whether hardness was calculated
|
284 |
+
#etotal the molecule's total energy in Hartree
|
285 |
+
#gsolvation solvation Gibbs free energy in Hartree
|
286 |
+
#vibrations array containing vibrational frequencies in cm-1
|
287 |
+
#temperature array containing temperatures
|
288 |
+
#entropy array containing entropies
|
289 |
+
#enthalpy array containing enthalpies
|
290 |
+
#gibbs array containing Gibbs free energies
|
291 |
+
#internalenergy array containing internal energies
|
292 |
+
#helmholtz array containing Helmholts energies
|
293 |
+
#cp array containing heat capacities at constant pressure
|
294 |
+
#cv array containing heat capacities at constant volume
|
295 |
+
#atmlist list of atoms
|
296 |
+
#charges partial charges in electrons
|
297 |
+
#polarisabilities atomic polarisabilities in bohr
|
298 |
+
#totalpol total polarisability in cubic bohr
|
299 |
+
#eFukuiElctrophilie Fukui index for electrophilicity (calculated from charges)
|
300 |
+
#eFukuiNucleophilie Fukui index for nucleophilicity (calculated from charges)
|
301 |
+
#eFukuiRadical Fukui index for radical reactivity (calculated from charges)
|
302 |
+
#eSoftnessElctrophilie softness index for electrophilicity (calculated from charges)
|
303 |
+
#eSoftnessNucleophilie softness index for nucleophilicity (calculated from charges)
|
304 |
+
#eSoftnessRadical softness index for radical reactivity (calculated from charges)
|
305 |
+
#oFukuiElctrophilie Fukui index for electrophilicity (calculated from frontier orbitals)
|
306 |
+
#oFukuiNucleophilie Fukui index for nucleophilicity (calculated from frontier orbitals)
|
307 |
+
#oFukuiRadical Fukui index for radical reactivity (calculated from frontier orbitals)
|
308 |
+
#oSoftnessElctrophilie softness index for electrophilicity (calculated from frontier orbitals)
|
309 |
+
#oSoftnessNucleophilie softness index for nucleophilicity (calculated from frontier orbitals)
|
310 |
+
#oSoftnessRadical softness index for radical reactivity (calculated from frontier orbitals)
|
311 |
+
#ipkoopman Koopman ionisation potential in eV
|
312 |
+
#ip ionisation potential in eV
|
313 |
+
#ea electron affinity in eV
|
314 |
+
#eneg electronegativity in eV
|
315 |
+
#hard hardness in eV
|
316 |
+
out_dict = run_gfn2(sys.argv)
|
317 |
+
|
318 |
+
print(out_dict)
|
runGFN2_crd.txt
ADDED
@@ -0,0 +1,299 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import sys
|
3 |
+
import subprocess
|
4 |
+
|
5 |
+
#arguments and give them default values
|
6 |
+
exe = "./GFN2all.exe"
|
7 |
+
geometryfile = ""
|
8 |
+
charge = "0"
|
9 |
+
Telec = "300"
|
10 |
+
solvation = "0"
|
11 |
+
solventname = "gas"
|
12 |
+
optimisegeometry = "0"
|
13 |
+
newgeometryfile = ""
|
14 |
+
thermo = "0"
|
15 |
+
energythresh = "1.0e-6"
|
16 |
+
gradientthresh = "1.0e-3"
|
17 |
+
calcdensity = "0"
|
18 |
+
densityfile = ""
|
19 |
+
electronicreactivity = "0"
|
20 |
+
orbitalreactivity = "0"
|
21 |
+
KoopmanIP = "0"
|
22 |
+
IP = "0"
|
23 |
+
EA = "0"
|
24 |
+
electronegativity = "0"
|
25 |
+
hardness = "0"
|
26 |
+
|
27 |
+
#parse whatever we get
|
28 |
+
for iarg in range(1,len(sys.argv)):
|
29 |
+
argument = sys.argv[iarg].lower().replace("=","")
|
30 |
+
if argument.startswith("geometry") or argument.startswith("geom"):
|
31 |
+
geometryfile = argument.replace("geometry","").replace("geom","")
|
32 |
+
elif argument.startswith("charge") or argument.startswith("chrg"):
|
33 |
+
charge = argument.replace("charge","").replace("chrg","")
|
34 |
+
elif argument.startswith("telec") or argument.startswith("telectronic"):
|
35 |
+
Telec = argument.replace("telectronic","").replace("telec","")
|
36 |
+
elif argument.startswith("usesolv") or argument.startswith("usesolvent"):
|
37 |
+
solvation = argument.replace("usesolvent","").replace("usesolv","")
|
38 |
+
elif argument.startswith("solvent") or argument.startswith("solventname"):
|
39 |
+
solventname = argument.replace("solventname","").replace("solvent","")
|
40 |
+
elif argument.startswith("optg") or argument.startswith("optimisegeom") or argument.startswith("optimizegeom") or argument.startswith("optimisegeometry") or argument.startswith("optimizegeometry"):
|
41 |
+
optimisegeometry = argument.replace("optg","").replace("optimise","").replace("optimize","").replace("geometry","").replace("geom","")
|
42 |
+
elif argument.startswith("newgeom") or argument.startswith("newgeomfile") or argument.startswith("newgeometryfile"):
|
43 |
+
newgeometryfile = argument.replace("newgeometryfile","").replace("newgeomfile","").replace("newgeom","")
|
44 |
+
elif argument.startswith("dothermo") or argument.startswith("thermo") or argument.startswith("thermodynamics"):
|
45 |
+
thermo = argument.replace("dothermo","").replace("thermodynamics","").replace("thermo","")
|
46 |
+
elif argument.startswith("ethresh") or argument.startswith("energythresh") or argument.startswith("energythreshold"):
|
47 |
+
energythresh = argument.replace("ethresh","").replace("energythreshold","").replace("energythresh","")
|
48 |
+
elif argument.startswith("gthresh") or argument.startswith("gradthresh") or argument.startswith("gradientthreshold"):
|
49 |
+
gradientthresh = argument.replace("gthresh","").replace("gradientthreshold","").replace("gradthresh","")
|
50 |
+
elif argument.startswith("calcdens") or argument.startswith("calcdensity") or argument.startswith("calculatedensity"):
|
51 |
+
calcdensity = argument.replace("calcdensity","").replace("calcdens","").replace("calculatedensity","")
|
52 |
+
elif argument.startswith("densityfile") or argument.startswith("densfile"):
|
53 |
+
calcdensity = argument.replace("densityfile","").replace("densfile","")
|
54 |
+
elif argument.startswith("ereact") or argument.startswith("electronicreactivity"):
|
55 |
+
electronicreactivity = argument.replace("ereact","").replace("electronicreactivity","")
|
56 |
+
elif argument.startswith("oreact") or argument.startswith("orbreact") or argument.startswith("orbitalreactivity"):
|
57 |
+
orbitalreactivity = argument.replace("oreact","").replace("orbreact","").replace("orbitalreactivity","")
|
58 |
+
elif argument.startswith("koopman") or argument.startswith("ipkoopman") or argument.startswith("koopmanip"):
|
59 |
+
KoopmanIP = argument.replace("ip","").replace("koopman","")
|
60 |
+
elif argument.startswith("ip") or argument.startswith("ionizationpotential") or argument.startswith("ionisationpotential") or argument.startswith("ipot"):
|
61 |
+
IP = argument.replace("ip","").replace("ionizationpotential","").replace("ionisationpotential","").replace("ipot","")
|
62 |
+
elif argument.startswith("ea") or argument.startswith("electronaffinity") or argument.startswith("eaffin"):
|
63 |
+
EA = argument.replace("ea","").replace("electronaffinity","").replace("eaffin","")
|
64 |
+
elif argument.startswith("electronegativity"):
|
65 |
+
electronegativity = argument.replace("electronegativity","")
|
66 |
+
elif argument.startswith("hardness"):
|
67 |
+
hardness = argument.replace("hardness","")
|
68 |
+
|
69 |
+
#ensure consistency
|
70 |
+
if geometryfile + "blahblah" == "blahblah":
|
71 |
+
print("ERROR: geometry file is needed")
|
72 |
+
sys.exit()
|
73 |
+
|
74 |
+
newgeometryfile.replace(".xyz","").replace(".sdf","").replace(".mol2","").replace(".pdb","")
|
75 |
+
if (newgeometryfile + "blahblah" == "blahblah") and (optimisegeometry == "1"): newgeometryfile = geometryfile.replace(".xyz","").replace(".sdf","").replace(".mol2","").replace(".pdb","") + "_opt"
|
76 |
+
|
77 |
+
if (solvation == "1"):
|
78 |
+
if (solventname == "water") or (solventname == "h2o") or (solventname == "o"): solventname = "water"
|
79 |
+
elif (solventname == "acetone") or (solventname == "cc(o)c"): solventname = "acetone"
|
80 |
+
elif (solventname == "acetonitrile") or (solventname == "ch3cn") or (solventname == "ccn"): solventname = "acetonitrile"
|
81 |
+
elif (solventname == "aniline") or (solventname == "phnh2") or (solventname == "nc1ccccc1") or (solventname == "c1ccc(cc1)n"): solventname = "aniline"
|
82 |
+
elif (solventname == "benzaldehyde") or (solventname == "phcho") or (solventname == "occ1ccccc1") or (solventname == "c1ccc(cc1)co"): solventname = "benzaldehyde"
|
83 |
+
elif (solventname == "benzene") or (solventname == "c6h6") or (solventname == "phh") or (solventname == "c1ccccc1"): solventname = "benzene"
|
84 |
+
elif (solventname == "dichloromethane") or (solventname == "ch2cl2") or (solventname == "c(cl)cl") or (solventname == "c(cl)(cl)"): solventname = "dichloromethane"
|
85 |
+
elif (solventname == "chloroform") or (solventname == "chcl3") or (solventname == "c(cl)(cl)cl") or (solventname == "c(cl)(cl)(cl)"): solventname = "chloroform"
|
86 |
+
elif (solventname == "carbon disulfide") or (solventname == "carbondisulfide") or (solventname == "cs2") or (solventname == "scs"): solventname = "carbon disulfide"
|
87 |
+
elif (solventname == "dioxane") or (solventname == "o1ccocc1"): solventname = "dioxane"
|
88 |
+
elif (solventname == "dmf") or (solventname == "dimethylformamide") or (solventname == "cn(c)co"): solventname = "dmf"
|
89 |
+
elif (solventname == "dmso") or (solventname == "dimethylsulfoxide") or (solventname == "cs(o)c") or (solventname == "cs(c)o"): solventname = "dmso"
|
90 |
+
elif (solventname == "ethanol") or (solventname == "etoh") or (solventname == "ch3ch2oh") or (solventname == "cco"): solventname = "ethanol"
|
91 |
+
elif (solventname == "diethyl ether") or (solventname == "etoet") or (solventname == "ccocc") or (solventname == "ch3ch2och2ch3"): solventname = "diethyl ether"
|
92 |
+
elif (solventname == "ethyl acetate") or (solventname == "acoet") or (solventname == "etoac") or (solventname == "ccoc(o)c"): solventname = "ethyl acetate"
|
93 |
+
elif (solventname == "furan") or (solventname == "furane"): solventname = "furane"
|
94 |
+
elif (solventname == "hexadecane") or (solventname == "c16"): solventname = "hexadecane"
|
95 |
+
elif (solventname == "hexane") or (solventname == "cccccc") or (solventname == "c6"): solventname = "hexane"
|
96 |
+
elif (solventname == "methanol") or (solventname == "meoh") or (solventname == "co") or (solventname == "ch3oh"): solventname = "methanol"
|
97 |
+
elif (solventname == "nitromethane") or (solventname == "meno2") or (solventname == "ch3no2") or (solventname == "cn(o)o"): solventname = "nitromethane"
|
98 |
+
elif (solventname == "octanol") or (solventname == "cccccccc") or (solventname == "c8"): solventname = "octanol"
|
99 |
+
elif (solventname == "phenol") or (solventname == "phoh") or (solventname == "oc1ccccc1") or (solventname == "c1ccc(cc1)o"): solventname = "phenol"
|
100 |
+
elif (solventname == "thf") or (solventname == "tetrahydrofuran"): solventname = "thf"
|
101 |
+
elif (solventname == "toluene") or (solventname == "phme") or (solventname == "cc1ccccc1"): solventname = "toluene"
|
102 |
+
elif (solventname == "octanol wet") or (solventname == "octanolwet") or (solventname == "wet octanol") or (solventname == "wetoctanol"): solventname = "octanol wet"
|
103 |
+
|
104 |
+
if (densityfile + "blahblah" == "blahblah") and (calcdensity == "1"): densityfile = geometryfile.replace(".xyz","").replace(".sdf","").replace(".mol2","").replace(".pdb","") + "_dens"
|
105 |
+
|
106 |
+
def RunQMOptg():
|
107 |
+
proc = subprocess.Popen([exe,geometryfile,charge,Telec,solvation,solventname,optimisegeometry,newgeometryfile,thermo,energythresh,gradientthresh,calcdensity,densityfile,electronicreactivity,orbitalreactivity,KoopmanIP,IP,EA,electronegativity,hardness], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
108 |
+
out,err = proc.communicate()
|
109 |
+
return out,err
|
110 |
+
out,err = RunQMOptg()
|
111 |
+
|
112 |
+
def ReadXYZ(filename):
|
113 |
+
#function reading xyz format
|
114 |
+
rfile = open(filename,"r")
|
115 |
+
rfilelines = rfile.readlines()
|
116 |
+
natoms = int(rfilelines[0])
|
117 |
+
geometry = []
|
118 |
+
for iatm in range(natoms):
|
119 |
+
line = rfilelines[iatm + 2]
|
120 |
+
cleanline = line
|
121 |
+
for idx in range(250):
|
122 |
+
line = cleanline.replace(" "," ")
|
123 |
+
cleanline = line
|
124 |
+
if not (" " in cleanline): break
|
125 |
+
data = cleanline.split(" ")
|
126 |
+
aux = [float(data[1]),float(data[2]),float(data[3])]
|
127 |
+
geometry.append(aux)
|
128 |
+
return geometry
|
129 |
+
|
130 |
+
if err.decode("utf-8") + "blahblah" != "blahblah": print("error:",err)
|
131 |
+
else:
|
132 |
+
#process data from output file
|
133 |
+
outputfile = out.decode("utf-8").split("\n")
|
134 |
+
print(out.decode("utf-8"))
|
135 |
+
etotal = 0.0
|
136 |
+
gsolvation = 0.0
|
137 |
+
fetchvibr = False
|
138 |
+
vibrations = []
|
139 |
+
fetchthermo = False
|
140 |
+
temperature = []
|
141 |
+
entropy = []
|
142 |
+
enthalpy = []
|
143 |
+
gibbs = []
|
144 |
+
internalenergy = []
|
145 |
+
helmholtz = []
|
146 |
+
cp = []
|
147 |
+
cv = []
|
148 |
+
fetchatomicprops = False
|
149 |
+
atmlist = []
|
150 |
+
charges = []
|
151 |
+
polarisabilities = []
|
152 |
+
totalpol = 0.0
|
153 |
+
fetchelecreact = False
|
154 |
+
fetchorbreact = False
|
155 |
+
eFukuiElctrophilie = []
|
156 |
+
eFukuiNucleophilie = []
|
157 |
+
eFukuiRadical = []
|
158 |
+
eSoftnessElctrophilie = []
|
159 |
+
eSoftnessNucleophilie = []
|
160 |
+
eSoftnessRadical = []
|
161 |
+
oFukuiElctrophilie = []
|
162 |
+
oFukuiNucleophilie = []
|
163 |
+
oFukuiRadical = []
|
164 |
+
oSoftnessElctrophilie = []
|
165 |
+
oSoftnessNucleophilie = []
|
166 |
+
oSoftnessRadical = []
|
167 |
+
ipkoopman = 0.0
|
168 |
+
geometry = []
|
169 |
+
ip = 0.0
|
170 |
+
ea = 0.0
|
171 |
+
eneg = 0.0
|
172 |
+
hard = 0.0
|
173 |
+
for iline in range(len(outputfile)):
|
174 |
+
line = outputfile[iline]
|
175 |
+
#check whether array data is available
|
176 |
+
if line.startswith(">all vibrational frequencies"):
|
177 |
+
fetchvibr = True
|
178 |
+
continue
|
179 |
+
elif line.startswith("<all vibrational frequencies"):
|
180 |
+
fetchvibr = False
|
181 |
+
continue
|
182 |
+
elif line.startswith(">Thermodynamics"):
|
183 |
+
fetchthermo = True
|
184 |
+
continue
|
185 |
+
elif line.startswith("<Thermodynamics"):
|
186 |
+
fetchthermo = False
|
187 |
+
continue
|
188 |
+
elif line.startswith(">atom;charge;pol"):
|
189 |
+
fetchatomicprops = True
|
190 |
+
continue
|
191 |
+
elif line.startswith("<atom;charge;pol"):
|
192 |
+
fetchatomicprops = False
|
193 |
+
continue
|
194 |
+
elif line.startswith(">Electronic Reactivity indices"):
|
195 |
+
fetchelecreact = True
|
196 |
+
continue
|
197 |
+
elif line.startswith("<Electronic Reactivity indices"):
|
198 |
+
fetchelecreact = False
|
199 |
+
continue
|
200 |
+
elif line.startswith(">Orbital Reactivity indices"):
|
201 |
+
fetchorbreact = True
|
202 |
+
continue
|
203 |
+
elif line.startswith("<Orbital Reactivity indices"):
|
204 |
+
fetchorbreact = False
|
205 |
+
continue
|
206 |
+
#fetch data
|
207 |
+
if line.startswith("Total Energy = "): etotal = float(line.replace("Total Energy = ",""))
|
208 |
+
elif line.startswith("Gsolv = "): gsolvation = float(line.replace("Gsolv = ",""))
|
209 |
+
elif "Total Polarizability" in line: totalpol = float(line.replace("Total Polarizability","").replace(" ",""))
|
210 |
+
elif line.startswith("Ionization Potential (Koopman):"): ipkoopman = float(line.replace("Ionization Potential (Koopman):","").replace(" eV",""))
|
211 |
+
elif line.startswith("Ionization Potential (Definition): "): ip = float(line.replace("Ionization Potential (Definition): ","").replace(" eV",""))
|
212 |
+
elif line.startswith("Electron Affinity (Definition): "): ea = float(line.replace("Electron Affinity (Definition): ","").replace(" eV",""))
|
213 |
+
elif line.startswith("Electronegativity: "): eneg = float(line.replace("Electronegativity: ","").replace(" eV",""))
|
214 |
+
elif line.startswith("Hardness: "): hard = float(line.replace("Hardness: ","").replace(" eV",""))
|
215 |
+
elif fetchvibr: vibrations.append(float(line))
|
216 |
+
elif fetchthermo:
|
217 |
+
data = line.split(";")
|
218 |
+
temperature.append(float(data[0]))
|
219 |
+
entropy.append(float(data[1]))
|
220 |
+
enthalpy.append(float(data[2]))
|
221 |
+
gibbs.append(float(data[3]))
|
222 |
+
internalenergy.append(float(data[4]))
|
223 |
+
helmholtz.append(float(data[5]))
|
224 |
+
cp.append(float(data[6]))
|
225 |
+
cv.append(float(data[7]))
|
226 |
+
elif fetchatomicprops:
|
227 |
+
data = line.split(";")
|
228 |
+
atmlist.append(int(data[0]))
|
229 |
+
charges.append(float(data[1]))
|
230 |
+
polarisabilities.append(float(data[2]))
|
231 |
+
elif fetchelecreact:
|
232 |
+
data = line.strip().rstrip().replace(" "," ").split(" ")
|
233 |
+
eFukuiElctrophilie.append(float(data[0]))
|
234 |
+
eFukuiNucleophilie.append(float(data[1]))
|
235 |
+
eFukuiRadical.append(float(data[2]))
|
236 |
+
eSoftnessElctrophilie.append(float(data[3]))
|
237 |
+
eSoftnessNucleophilie.append(float(data[4]))
|
238 |
+
eSoftnessRadical.append(float(data[5]))
|
239 |
+
elif fetchorbreact:
|
240 |
+
data = line.strip().rstrip().replace(" "," ").split(" ")
|
241 |
+
oFukuiElctrophilie.append(float(data[0]))
|
242 |
+
oFukuiNucleophilie.append(float(data[1]))
|
243 |
+
oFukuiRadical.append(float(data[2]))
|
244 |
+
oSoftnessElctrophilie.append(float(data[3]))
|
245 |
+
oSoftnessNucleophilie.append(float(data[4]))
|
246 |
+
oSoftnessRadical.append(float(data[5]))
|
247 |
+
if (optimisegeometry == "0"): newgeometryfile = geometryfile
|
248 |
+
if not newgeometryfile.endswith(".xyz"): newgeometryfile += ".xyz"
|
249 |
+
geometry = ReadXYZ(newgeometryfile)
|
250 |
+
print(geometry)
|
251 |
+
#data collected; if there is a whether, then variable is boolean
|
252 |
+
#geometryfile the geometry of the molecule
|
253 |
+
#charge the total charge
|
254 |
+
#solventname the name of the solvent
|
255 |
+
#optimisegeometry whether geometry was optimised
|
256 |
+
#newgeometryfile the name of the file containing optimised geometry
|
257 |
+
#geometry contains the best geometry (either the input one if not optg takes place, or the optimized geometry if optg took place)
|
258 |
+
#thermo whether thermodynamics was done
|
259 |
+
#calcdensity whether the electronic density was calculated
|
260 |
+
#densityfile the name of the file containing electronic density
|
261 |
+
#electronicreactivity whether electronic reactivity data was calculated
|
262 |
+
#orbitalreactivity whether orbital reacticity data was calculated
|
263 |
+
#KoopmanIP whether the Koopman ionisation potential was calculated
|
264 |
+
#IP whether the ionisation potential was calculated
|
265 |
+
#EA whether electron affinity was calculated
|
266 |
+
#electronegativity whether electronegativity was calculated
|
267 |
+
#hardness whether hardness was calculated
|
268 |
+
#etotal the molecule's total energy in Hartree
|
269 |
+
#gsolvation solvation Gibbs free energy in Hartree
|
270 |
+
#vibrations array containing vibrational frequencies in cm-1
|
271 |
+
#temperature array containing temperatures
|
272 |
+
#entropy array containing entropies
|
273 |
+
#enthalpy array containing enthalpies
|
274 |
+
#gibbs array containing Gibbs free energies
|
275 |
+
#internalenergy array containing internal energies
|
276 |
+
#helmholtz array containing Helmholts energies
|
277 |
+
#cp array containing heat capacities at constant pressure
|
278 |
+
#cv array containing heat capacities at constant volume
|
279 |
+
#atmlist list of atoms
|
280 |
+
#charges partial charges in electrons
|
281 |
+
#polarisabilities atomic polarisabilities in bohr
|
282 |
+
#totalpol total polarisability in cubic bohr
|
283 |
+
#eFukuiElctrophilie Fukui index for electrophilicity (calculated from charges)
|
284 |
+
#eFukuiNucleophilie Fukui index for nucleophilicity (calculated from charges)
|
285 |
+
#eFukuiRadical Fukui index for radical reactivity (calculated from charges)
|
286 |
+
#eSoftnessElctrophilie softness index for electrophilicity (calculated from charges)
|
287 |
+
#eSoftnessNucleophilie softness index for nucleophilicity (calculated from charges)
|
288 |
+
#eSoftnessRadical softness index for radical reactivity (calculated from charges)
|
289 |
+
#oFukuiElctrophilie Fukui index for electrophilicity (calculated from frontier orbitals)
|
290 |
+
#oFukuiNucleophilie Fukui index for nucleophilicity (calculated from frontier orbitals)
|
291 |
+
#oFukuiRadical Fukui index for radical reactivity (calculated from frontier orbitals)
|
292 |
+
#oSoftnessElctrophilie softness index for electrophilicity (calculated from frontier orbitals)
|
293 |
+
#oSoftnessNucleophilie softness index for nucleophilicity (calculated from frontier orbitals)
|
294 |
+
#oSoftnessRadical softness index for radical reactivity (calculated from frontier orbitals)
|
295 |
+
#ipkoopman Koopman ionisation potential in eV
|
296 |
+
#ip ionisation potential in eV
|
297 |
+
#ea electron affinity in eV
|
298 |
+
#eneg electronegativity in eV
|
299 |
+
#hard hardness in eV
|
run_gfn.py
ADDED
@@ -0,0 +1,342 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import sys
|
3 |
+
import subprocess
|
4 |
+
|
5 |
+
|
6 |
+
def ReadXYZ(filename):
|
7 |
+
#function reading xyz format
|
8 |
+
rfile = open(filename,"r")
|
9 |
+
rfilelines = rfile.readlines()
|
10 |
+
natoms = int(rfilelines[0])
|
11 |
+
geometry = []
|
12 |
+
for iatm in range(natoms):
|
13 |
+
line = rfilelines[iatm + 2]
|
14 |
+
cleanline = line
|
15 |
+
for idx in range(250):
|
16 |
+
line = cleanline.replace(" "," ")
|
17 |
+
cleanline = line
|
18 |
+
if not (" " in cleanline): break
|
19 |
+
data = cleanline.split(" ")
|
20 |
+
aux = [float(data[1]),float(data[2]),float(data[3])]
|
21 |
+
geometry.append(aux)
|
22 |
+
return geometry
|
23 |
+
|
24 |
+
def run_gfn2(argv):
|
25 |
+
#arguments and give them default values
|
26 |
+
exe = "./GFN2all_crd.exe"
|
27 |
+
geometryfile = ""
|
28 |
+
charge = "0"
|
29 |
+
Telec = "300"
|
30 |
+
solvation = "0"
|
31 |
+
solventname = "gas"
|
32 |
+
optimisegeometry = "0"
|
33 |
+
newgeometryfile = ""
|
34 |
+
thermo = "0"
|
35 |
+
energythresh = "1.0e-6"
|
36 |
+
gradientthresh = "1.0e-3"
|
37 |
+
calcdensity = "0"
|
38 |
+
densityfile = ""
|
39 |
+
electronicreactivity = "0"
|
40 |
+
orbitalreactivity = "0"
|
41 |
+
KoopmanIP = "0"
|
42 |
+
IP = "0"
|
43 |
+
EA = "0"
|
44 |
+
electronegativity = "0"
|
45 |
+
hardness = "0"
|
46 |
+
|
47 |
+
#parse whatever we get
|
48 |
+
for iarg in range(1,len(argv)):
|
49 |
+
argument = argv[iarg].lower().replace("=","")
|
50 |
+
if argument.startswith("geometry") or argument.startswith("geom"):
|
51 |
+
geometryfile = argument.replace("geometry","").replace("geom","")
|
52 |
+
elif argument.startswith("charge") or argument.startswith("chrg"):
|
53 |
+
charge = argument.replace("charge","").replace("chrg","")
|
54 |
+
elif argument.startswith("telec") or argument.startswith("telectronic"):
|
55 |
+
Telec = argument.replace("telectronic","").replace("telec","")
|
56 |
+
elif argument.startswith("usesolv") or argument.startswith("usesolvent"):
|
57 |
+
solvation = argument.replace("usesolvent","").replace("usesolv","")
|
58 |
+
elif argument.startswith("solvent") or argument.startswith("solventname"):
|
59 |
+
solventname = argument.replace("solventname","").replace("solvent","")
|
60 |
+
elif argument.startswith("optg") or argument.startswith("optimisegeom") or argument.startswith("optimizegeom") or argument.startswith("optimisegeometry") or argument.startswith("optimizegeometry"):
|
61 |
+
optimisegeometry = argument.replace("optg","").replace("optimise","").replace("optimize","").replace("geometry","").replace("geom","")
|
62 |
+
elif argument.startswith("newgeom") or argument.startswith("newgeomfile") or argument.startswith("newgeometryfile"):
|
63 |
+
newgeometryfile = argument.replace("newgeometryfile","").replace("newgeomfile","").replace("newgeom","")
|
64 |
+
elif argument.startswith("dothermo") or argument.startswith("thermo") or argument.startswith("thermodynamics"):
|
65 |
+
thermo = argument.replace("dothermo","").replace("thermodynamics","").replace("thermo","")
|
66 |
+
elif argument.startswith("ethresh") or argument.startswith("energythresh") or argument.startswith("energythreshold"):
|
67 |
+
energythresh = argument.replace("ethresh","").replace("energythreshold","").replace("energythresh","")
|
68 |
+
elif argument.startswith("gthresh") or argument.startswith("gradthresh") or argument.startswith("gradientthreshold"):
|
69 |
+
gradientthresh = argument.replace("gthresh","").replace("gradientthreshold","").replace("gradthresh","")
|
70 |
+
elif argument.startswith("calcdens") or argument.startswith("calcdensity") or argument.startswith("calculatedensity"):
|
71 |
+
calcdensity = argument.replace("calcdensity","").replace("calcdens","").replace("calculatedensity","")
|
72 |
+
elif argument.startswith("densityfile") or argument.startswith("densfile"):
|
73 |
+
calcdensity = argument.replace("densityfile","").replace("densfile","")
|
74 |
+
elif argument.startswith("ereact") or argument.startswith("electronicreactivity"):
|
75 |
+
electronicreactivity = argument.replace("ereact","").replace("electronicreactivity","")
|
76 |
+
elif argument.startswith("oreact") or argument.startswith("orbreact") or argument.startswith("orbitalreactivity"):
|
77 |
+
orbitalreactivity = argument.replace("oreact","").replace("orbreact","").replace("orbitalreactivity","")
|
78 |
+
elif argument.startswith("koopman") or argument.startswith("ipkoopman") or argument.startswith("koopmanip"):
|
79 |
+
KoopmanIP = argument.replace("ip","").replace("koopman","")
|
80 |
+
elif argument.startswith("ip") or argument.startswith("ionizationpotential") or argument.startswith("ionisationpotential") or argument.startswith("ipot"):
|
81 |
+
IP = argument.replace("ip","").replace("ionizationpotential","").replace("ionisationpotential","").replace("ipot","")
|
82 |
+
elif argument.startswith("ea") or argument.startswith("electronaffinity") or argument.startswith("eaffin"):
|
83 |
+
EA = argument.replace("ea","").replace("electronaffinity","").replace("eaffin","")
|
84 |
+
elif argument.startswith("electronegativity"):
|
85 |
+
electronegativity = argument.replace("electronegativity","")
|
86 |
+
elif argument.startswith("hardness"):
|
87 |
+
hardness = argument.replace("hardness","")
|
88 |
+
|
89 |
+
#ensure consistency
|
90 |
+
if geometryfile + "blahblah" == "blahblah":
|
91 |
+
print("ERROR: geometry file is needed")
|
92 |
+
sys.exit()
|
93 |
+
|
94 |
+
newgeometryfile.replace(".xyz","").replace(".sdf","").replace(".mol2","").replace(".pdb","")
|
95 |
+
if (newgeometryfile + "blahblah" == "blahblah") and (optimisegeometry == "1"):
|
96 |
+
newgeometryfile = geometryfile.replace(".xyz","").replace(".sdf","").replace(".mol2","").replace(".pdb","") + "_opt"
|
97 |
+
|
98 |
+
if (solvation == "1"):
|
99 |
+
if (solventname == "water") or (solventname == "h2o") or (solventname == "o"): solventname = "water"
|
100 |
+
elif (solventname == "acetone") or (solventname == "cc(o)c"): solventname = "acetone"
|
101 |
+
elif (solventname == "acetonitrile") or (solventname == "ch3cn") or (solventname == "ccn"): solventname = "acetonitrile"
|
102 |
+
elif (solventname == "aniline") or (solventname == "phnh2") or (solventname == "nc1ccccc1") or (solventname == "c1ccc(cc1)n"): solventname = "aniline"
|
103 |
+
elif (solventname == "benzaldehyde") or (solventname == "phcho") or (solventname == "occ1ccccc1") or (solventname == "c1ccc(cc1)co"): solventname = "benzaldehyde"
|
104 |
+
elif (solventname == "benzene") or (solventname == "c6h6") or (solventname == "phh") or (solventname == "c1ccccc1"): solventname = "benzene"
|
105 |
+
elif (solventname == "dichloromethane") or (solventname == "ch2cl2") or (solventname == "c(cl)cl") or (solventname == "c(cl)(cl)"): solventname = "dichloromethane"
|
106 |
+
elif (solventname == "chloroform") or (solventname == "chcl3") or (solventname == "c(cl)(cl)cl") or (solventname == "c(cl)(cl)(cl)"): solventname = "chloroform"
|
107 |
+
elif (solventname == "carbon disulfide") or (solventname == "carbondisulfide") or (solventname == "cs2") or (solventname == "scs"): solventname = "carbon disulfide"
|
108 |
+
elif (solventname == "dioxane") or (solventname == "o1ccocc1"): solventname = "dioxane"
|
109 |
+
elif (solventname == "dmf") or (solventname == "dimethylformamide") or (solventname == "cn(c)co"): solventname = "dmf"
|
110 |
+
elif (solventname == "dmso") or (solventname == "dimethylsulfoxide") or (solventname == "cs(o)c") or (solventname == "cs(c)o"): solventname = "dmso"
|
111 |
+
elif (solventname == "ethanol") or (solventname == "etoh") or (solventname == "ch3ch2oh") or (solventname == "cco"): solventname = "ethanol"
|
112 |
+
elif (solventname == "diethyl ether") or (solventname == "etoet") or (solventname == "ccocc") or (solventname == "ch3ch2och2ch3"): solventname = "diethyl ether"
|
113 |
+
elif (solventname == "ethyl acetate") or (solventname == "acoet") or (solventname == "etoac") or (solventname == "ccoc(o)c"): solventname = "ethyl acetate"
|
114 |
+
elif (solventname == "furan") or (solventname == "furane"): solventname = "furane"
|
115 |
+
elif (solventname == "hexadecane") or (solventname == "c16"): solventname = "hexadecane"
|
116 |
+
elif (solventname == "hexane") or (solventname == "cccccc") or (solventname == "c6"): solventname = "hexane"
|
117 |
+
elif (solventname == "methanol") or (solventname == "meoh") or (solventname == "co") or (solventname == "ch3oh"): solventname = "methanol"
|
118 |
+
elif (solventname == "nitromethane") or (solventname == "meno2") or (solventname == "ch3no2") or (solventname == "cn(o)o"): solventname = "nitromethane"
|
119 |
+
elif (solventname == "octanol") or (solventname == "cccccccc") or (solventname == "c8"): solventname = "octanol"
|
120 |
+
elif (solventname == "phenol") or (solventname == "phoh") or (solventname == "oc1ccccc1") or (solventname == "c1ccc(cc1)o"): solventname = "phenol"
|
121 |
+
elif (solventname == "thf") or (solventname == "tetrahydrofuran"): solventname = "thf"
|
122 |
+
elif (solventname == "toluene") or (solventname == "phme") or (solventname == "cc1ccccc1"): solventname = "toluene"
|
123 |
+
elif (solventname == "octanol wet") or (solventname == "octanolwet") or (solventname == "wet octanol") or (solventname == "wetoctanol"): solventname = "octanol wet"
|
124 |
+
|
125 |
+
if (densityfile + "blahblah" == "blahblah") and (calcdensity == "1"):
|
126 |
+
densityfile = geometryfile.replace(".xyz","").replace(".sdf","").replace(".mol2","").replace(".pdb","") + "_dens"
|
127 |
+
|
128 |
+
def RunQMOptg():
|
129 |
+
proc = subprocess.Popen([exe,geometryfile,charge,Telec,solvation,solventname,optimisegeometry,newgeometryfile,thermo,energythresh,gradientthresh,calcdensity,densityfile,electronicreactivity,orbitalreactivity,KoopmanIP,IP,EA,electronegativity,hardness], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
130 |
+
out,err = proc.communicate()
|
131 |
+
return out,err
|
132 |
+
out,err = RunQMOptg()
|
133 |
+
|
134 |
+
if err.decode("utf-8") + "blahblah" != "blahblah": print("error:",err)
|
135 |
+
else:
|
136 |
+
#process data from output file
|
137 |
+
outputfile = out.decode("utf-8").split("\n")
|
138 |
+
#print(out.decode("utf-8"))
|
139 |
+
etotal = 0.0
|
140 |
+
gsolvation = 0.0
|
141 |
+
fetchvibr = False
|
142 |
+
vibrations = []
|
143 |
+
fetchthermo = False
|
144 |
+
temperature = []
|
145 |
+
entropy = []
|
146 |
+
enthalpy = []
|
147 |
+
gibbs = []
|
148 |
+
internalenergy = []
|
149 |
+
helmholtz = []
|
150 |
+
cp = []
|
151 |
+
cv = []
|
152 |
+
fetchatomicprops = False
|
153 |
+
atmlist = []
|
154 |
+
charges = []
|
155 |
+
polarisabilities = []
|
156 |
+
totalpol = 0.0
|
157 |
+
fetchelecreact = False
|
158 |
+
fetchorbreact = False
|
159 |
+
eFukuiElctrophilie = []
|
160 |
+
eFukuiNucleophilie = []
|
161 |
+
eFukuiRadical = []
|
162 |
+
eSoftnessElctrophilie = []
|
163 |
+
eSoftnessNucleophilie = []
|
164 |
+
eSoftnessRadical = []
|
165 |
+
oFukuiElctrophilie = []
|
166 |
+
oFukuiNucleophilie = []
|
167 |
+
oFukuiRadical = []
|
168 |
+
oSoftnessElctrophilie = []
|
169 |
+
oSoftnessNucleophilie = []
|
170 |
+
oSoftnessRadical = []
|
171 |
+
ipkoopman = 0.0
|
172 |
+
ip = 0.0
|
173 |
+
ea = 0.0
|
174 |
+
eneg = 0.0
|
175 |
+
hard = 0.0
|
176 |
+
out_dict = {}
|
177 |
+
for iline in range(len(outputfile)):
|
178 |
+
line = outputfile[iline]
|
179 |
+
#check whether array data is available
|
180 |
+
if line.startswith(">all vibrational frequencies"):
|
181 |
+
fetchvibr = True
|
182 |
+
continue
|
183 |
+
elif line.startswith("<all vibrational frequencies"):
|
184 |
+
fetchvibr = False
|
185 |
+
continue
|
186 |
+
elif line.startswith(">Thermodynamics"):
|
187 |
+
fetchthermo = True
|
188 |
+
continue
|
189 |
+
elif line.startswith("<Thermodynamics"):
|
190 |
+
fetchthermo = False
|
191 |
+
continue
|
192 |
+
elif line.startswith(">atom;charge;pol"):
|
193 |
+
fetchatomicprops = True
|
194 |
+
continue
|
195 |
+
elif line.startswith("<atom;charge;pol"):
|
196 |
+
fetchatomicprops = False
|
197 |
+
continue
|
198 |
+
elif line.startswith(">Electronic Reactivity indices"):
|
199 |
+
fetchelecreact = True
|
200 |
+
continue
|
201 |
+
elif line.startswith("<Electronic Reactivity indices"):
|
202 |
+
fetchelecreact = False
|
203 |
+
continue
|
204 |
+
elif line.startswith(">Orbital Reactivity indices"):
|
205 |
+
fetchorbreact = True
|
206 |
+
continue
|
207 |
+
elif line.startswith("<Orbital Reactivity indices"):
|
208 |
+
fetchorbreact = False
|
209 |
+
continue
|
210 |
+
#fetch data
|
211 |
+
if line.startswith("Total Energy = "):
|
212 |
+
etotal = float(line.replace("Total Energy = ",""))
|
213 |
+
out_dict['etotal']=etotal
|
214 |
+
elif line.startswith("Gsolv = "):
|
215 |
+
gsolvation = float(line.replace("Gsolv = ",""))
|
216 |
+
out_dict['gsolvation']=gsolvation
|
217 |
+
elif "Total Polarizability" in line:
|
218 |
+
totalpol = float(line.replace("Total Polarizability","").replace(" ",""))
|
219 |
+
out_dict['totalpol']=totalpol
|
220 |
+
elif line.startswith("Ionization Potential (Koopman):"):
|
221 |
+
ipkoopman = float(line.replace("Ionization Potential (Koopman):","").replace(" eV",""))
|
222 |
+
out_dict['ipkoopman']=ipkoopman
|
223 |
+
elif line.startswith("Ionization Potential (Definition): "):
|
224 |
+
ip = float(line.replace("Ionization Potential (Definition): ","").replace(" eV",""))
|
225 |
+
out_dict['ip']=ip
|
226 |
+
elif line.startswith("Electron Affinity (Definition): "):
|
227 |
+
ea = float(line.replace("Electron Affinity (Definition): ","").replace(" eV",""))
|
228 |
+
out_dict['ea']=ea
|
229 |
+
elif line.startswith("Electronegativity: "):
|
230 |
+
eneg = float(line.replace("Electronegativity: ","").replace(" eV",""))
|
231 |
+
out_dict['eneg']=eneg
|
232 |
+
elif line.startswith("Hardness: "):
|
233 |
+
hard = float(line.replace("Hardness: ","").replace(" eV",""))
|
234 |
+
out_dict['hard']=hard
|
235 |
+
elif fetchvibr:
|
236 |
+
vibrations.append(float(line))
|
237 |
+
out_dict['vibrations']=vibrations
|
238 |
+
elif fetchthermo:
|
239 |
+
data = line.split(";")
|
240 |
+
temperature.append(float(data[0]))
|
241 |
+
entropy.append(float(data[1]))
|
242 |
+
enthalpy.append(float(data[2]))
|
243 |
+
gibbs.append(float(data[3]))
|
244 |
+
internalenergy.append(float(data[4]))
|
245 |
+
helmholtz.append(float(data[5]))
|
246 |
+
cp.append(float(data[6]))
|
247 |
+
cv.append(float(data[7]))
|
248 |
+
out_dict['fetchthermo']={"temperature":temperature,
|
249 |
+
"entropy":entropy,
|
250 |
+
"enthalpy":enthalpy,
|
251 |
+
"gibbs":gibbs,
|
252 |
+
"internalenergy":internalenergy,
|
253 |
+
"helmholtz":helmholtz,
|
254 |
+
"cp":cp,
|
255 |
+
"cv":cv
|
256 |
+
}
|
257 |
+
elif fetchatomicprops:
|
258 |
+
data = line.split(";")
|
259 |
+
atmlist.append(int(data[0]))
|
260 |
+
charges.append(float(data[1]))
|
261 |
+
polarisabilities.append(float(data[2]))
|
262 |
+
out_dict['fetchatomicprops']={"atmlist":atmlist,
|
263 |
+
"charges":charges,
|
264 |
+
"polarisabilities":polarisabilities
|
265 |
+
}
|
266 |
+
elif fetchelecreact:
|
267 |
+
data = line.strip().rstrip().replace(" "," ").split(" ")
|
268 |
+
eFukuiElctrophilie.append(float(data[0]))
|
269 |
+
eFukuiNucleophilie.append(float(data[1]))
|
270 |
+
eFukuiRadical.append(float(data[2]))
|
271 |
+
eSoftnessElctrophilie.append(float(data[3]))
|
272 |
+
eSoftnessNucleophilie.append(float(data[4]))
|
273 |
+
eSoftnessRadical.append(float(data[5]))
|
274 |
+
out_dict['fetchelecreact']=fetchelecreact
|
275 |
+
elif fetchorbreact:
|
276 |
+
data = line.strip().rstrip().replace(" "," ").split(" ")
|
277 |
+
oFukuiElctrophilie.append(float(data[0]))
|
278 |
+
oFukuiNucleophilie.append(float(data[1]))
|
279 |
+
oFukuiRadical.append(float(data[2]))
|
280 |
+
oSoftnessElctrophilie.append(float(data[3]))
|
281 |
+
oSoftnessNucleophilie.append(float(data[4]))
|
282 |
+
oSoftnessRadical.append(float(data[5]))
|
283 |
+
out_dict['fetchorbreact']=fetchorbreact
|
284 |
+
#print(argv)
|
285 |
+
#print(out_dict)
|
286 |
+
if not newgeometryfile.endswith(".xyz"):
|
287 |
+
newgeometryfile += ".xyz"
|
288 |
+
out_dict["xyz"] = ReadXYZ(newgeometryfile)
|
289 |
+
return out_dict
|
290 |
+
#data collected; if there is a whether, then variable is boolean
|
291 |
+
#geometryfile the geometry of the molecule
|
292 |
+
#charge the total charge
|
293 |
+
#solventname the name of the solvent
|
294 |
+
#optimisegeometry whether geometry was optimised
|
295 |
+
#newgeometryfile the name of the file containing optimised geometry
|
296 |
+
#thermo whether thermodynamics was done
|
297 |
+
#calcdensity whether the electronic density was calculated
|
298 |
+
#densityfile the name of the file containing electronic density
|
299 |
+
#electronicreactivity whether electronic reactivity data was calculated
|
300 |
+
#orbitalreactivity whether orbital reacticity data was calculated
|
301 |
+
#KoopmanIP whether the Koopman ionisation potential was calculated
|
302 |
+
#IP whether the ionisation potential was calculated
|
303 |
+
#EA whether electron affinity was calculated
|
304 |
+
#electronegativity whether electronegativity was calculated
|
305 |
+
#hardness whether hardness was calculated
|
306 |
+
#etotal the molecule's total energy in Hartree
|
307 |
+
#gsolvation solvation Gibbs free energy in Hartree
|
308 |
+
#vibrations array containing vibrational frequencies in cm-1
|
309 |
+
#temperature array containing temperatures
|
310 |
+
#entropy array containing entropies
|
311 |
+
#enthalpy array containing enthalpies
|
312 |
+
#gibbs array containing Gibbs free energies
|
313 |
+
#internalenergy array containing internal energies
|
314 |
+
#helmholtz array containing Helmholts energies
|
315 |
+
#cp array containing heat capacities at constant pressure
|
316 |
+
#cv array containing heat capacities at constant volume
|
317 |
+
#atmlist list of atoms
|
318 |
+
#charges partial charges in electrons
|
319 |
+
#polarisabilities atomic polarisabilities in bohr
|
320 |
+
#totalpol total polarisability in cubic bohr
|
321 |
+
#eFukuiElctrophilie Fukui index for electrophilicity (calculated from charges)
|
322 |
+
#eFukuiNucleophilie Fukui index for nucleophilicity (calculated from charges)
|
323 |
+
#eFukuiRadical Fukui index for radical reactivity (calculated from charges)
|
324 |
+
#eSoftnessElctrophilie softness index for electrophilicity (calculated from charges)
|
325 |
+
#eSoftnessNucleophilie softness index for nucleophilicity (calculated from charges)
|
326 |
+
#eSoftnessRadical softness index for radical reactivity (calculated from charges)
|
327 |
+
#oFukuiElctrophilie Fukui index for electrophilicity (calculated from frontier orbitals)
|
328 |
+
#oFukuiNucleophilie Fukui index for nucleophilicity (calculated from frontier orbitals)
|
329 |
+
#oFukuiRadical Fukui index for radical reactivity (calculated from frontier orbitals)
|
330 |
+
#oSoftnessElctrophilie softness index for electrophilicity (calculated from frontier orbitals)
|
331 |
+
#oSoftnessNucleophilie softness index for nucleophilicity (calculated from frontier orbitals)
|
332 |
+
#oSoftnessRadical softness index for radical reactivity (calculated from frontier orbitals)
|
333 |
+
#ipkoopman Koopman ionisation potential in eV
|
334 |
+
#ip ionisation potential in eV
|
335 |
+
#ea electron affinity in eV
|
336 |
+
#eneg electronegativity in eV
|
337 |
+
#hard hardness in eV
|
338 |
+
|
339 |
+
if __name__=="__main__":
|
340 |
+
out_dict = run_gfn2(sys.argv)
|
341 |
+
|
342 |
+
print(out_dict)
|
testing_py3Dmol.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|
ulysses
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Subproject commit 75e16c3c06a85831c076ca54b530c45dfcc9fb9d
|