-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
205 lines (155 loc) · 4.7 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
using namespace std;
#include "read_inp.h"
#include "icoord.h"
#include "genetic.h"
#include "simple_genetic.h"
#include "mol2xyz.h"
int main() {
cout.setf(ios::fixed, ios::floatfield);
/*
string molfile = "1.mol";
MOL2XYZ mol2xyz;
unique_ptr<OpenBabel::OBMol> mol(mol2xyz.readMOL(molfile));
cout << "finish reading and manipulating" << endl;
mol2xyz.title = "1";
string dir = "/export/zimmerman/yzhao/S-Generator/runs/MOL2XYZ/";
mol2xyz.writeXYZ(mol,dir);
cout << "finish writing xyz file" << endl;
exit(-1);
*/
readinp* pInp = new readinp();
// LinkedList* pList = new LinkedList();
pInp->read_all();
#if 0
string ga_inp;
ga_inp="ga.inp";
cout << "*****************************" << endl;
cout << "** Reading Input Files **" << endl;
cout << "*****************************" << endl;
pInp->read_ga(ga_inp);
cout << "\n" << endl;
pInp->read_refxyzf(pInp->ref_f);
cout << "\n" << endl;
pInp->read_tempxyzf(pInp->temp_f);
cout << "\n" << endl;
pInp->get_basisfile(pInp->rfolder);
cout << "totally " << pInp->n_rfiles << " R basis" << endl;
#endif
#if 0
xyznode* pRef = new xyznode();
pRef->charge = pInp->xyzf_ref.charge;
pRef->multi = pInp->xyzf_ref.multi;
pRef->natoms = unsigned(pInp->xyzf_ref.natoms);
pRef->element = pInp->xyzf_ref.element;
pRef->coords = pInp->xyzf_ref.coords;
pRef->ntemp = 0;
pRef->next = NULL;
pRef->comment = "Ref";
cout << "*******All about reference cat*******" << endl;
cout << "Charge: " << pRef->charge << endl;
cout << "Multiplicity: " << pRef->multi << endl;
cout << "Number of Atoms: " << pRef->natoms << endl;
cout << "Cartesian coordinate: " << endl;
for (size_t i = 0; i < pRef->natoms; i++)
{
cout << pRef->element[i] << " " << pRef->coords[3*i+0] << " " << pRef->coords[3*i+1] << " " << pRef->coords[3*i+2] << endl;
}
cout << endl;
// pList->addnode(pRef);
#endif
// string filename;
// filename = "DFT.inp";
// pInp->read_dft(filename);
// filename = "MOPAC.inp";
// pInp->read_mopac(filename);
#if 0
Fitness fitness(pList,pInp);
fitness.read_fitness(pInp->fitness_f);
cout << "**************************" << endl;
cout << "Done reading fitness_f.inp" << endl;
cout << "**************************" << endl;
fitness.geninp_Binding(pRef);
fitness.geninp_Haffinity(pRef);
fitness.geninp_Hydricity(pRef);
#endif
S_Genetic sgenetic(pInp);
sgenetic.run_ga();
#if 0
//test case : 3 branches on seed, 1 socket on each adding block, 2 layers
int i;
int j;
int m;
int n;
int x;
int y;
int nfrags = pInp->inp_sgen.nblocks;
int ncaps = pInp->inp_sgen.nblocks_endp;
string code;
int count=0;
// gTree gtree(pInp);
for (i=0; i< nfrags; i++)
{
string istr = StringTools::int2str(i+1,1,"0");
for (j=0; j < ncaps; j++)
{
string jstr = StringTools::int2str(j+1+nfrags,1,"0");
// for (m=0; m < nfrags; m++)
// {
// string mstr = StringTools::int2str(m+1, 1, "0");
// for (n=0; n < ncaps ; n++)
// {
// string nstr = StringTools::int2str(n+1, 1, "0");
// for (x=0; x < nfrags; x++)
// {
// string xstr =StringTools::int2str(x+1, 1, "0");
// for (y=0; y < ncaps; y++)
// {
// gTree gtree(pInp);
// string ystr = StringTools::int2str(y+1, 1, "0");
code = "0(" + istr + "-1(" + jstr + "-1))";
// code = "0("+ istr + "-1(" + jstr + "-1))(" + mstr + "-2(" + nstr + "-1))(" + xstr + "-3(" +ystr + "-1))";
count++;
gTree gtree(pInp);
gtree.genecode = code;
string cwd = StringTools::getcwd_str();
string mmopt_folder = cwd + "/Scratch/MMOPT/";
mkdir(mmopt_folder.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
string nstr = StringTools::int2str(count, 4, "0");
string cname = mmopt_folder + "mmff94.xyz" + nstr;
ofstream xyzfile(cname.c_str());
gtree.gene2struc(gtree.genecode,xyzfile);
xyzfile.close();
ifstream output(cname.c_str());
// gtree.get_xyz(output);
GANode
// gtree.print_xyz("sgentest.xyz");
// }
// }
// }
// }
}
}
// gtree.installation();
// gtree.gene2struc(gtree.genecode,cname);
#endif
// xyznode* pNode = new xyznode();
// pNode->natoms = 163;
// pNode->comment = "0001";
// pNode->element.resize(pNode->natoms);
// pNode->coords.resize(3*pNode->natoms);
// string filedir = "./";
// DFT::save_opted_xyz_energy(filedir,pNode);
cout << "Done here" << endl;
// pList->print_xyzfile();
// pList->clear();
delete pInp;
// delete pNode;
// delete pList;
// delete pRef;
return 0;
}