1 |
< |
/* |
1 |
> |
/* |
2 |
|
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
|
* |
4 |
|
* The University of Notre Dame grants you ("Licensee") a |
54 |
|
#include "visitors/RigidBodyVisitor.hpp" |
55 |
|
#include "visitors/OtherVisitor.hpp" |
56 |
|
#include "visitors/ZconsVisitor.hpp" |
57 |
– |
#include "visitors/SelectionVisitor.hpp" |
57 |
|
#include "selection/SelectionEvaluator.hpp" |
58 |
+ |
#include "selection/SelectionManager.hpp" |
59 |
+ |
#include "visitors/LipidTransVisitor.hpp" |
60 |
+ |
#include "visitors/AtomNameVisitor.hpp" |
61 |
+ |
|
62 |
|
using namespace oopse; |
63 |
|
|
64 |
|
int main(int argc, char* argv[]){ |
100 |
|
|
101 |
|
|
102 |
|
|
103 |
< |
//creat visitor list |
103 |
> |
//create visitor list |
104 |
|
CompositeVisitor* compositeVisitor = new CompositeVisitor(); |
102 |
– |
|
103 |
– |
//creat ignore visitor |
104 |
– |
if(args_info.ignore_given ||args_info.water_flag){ |
105 |
|
|
106 |
< |
IgnoreVisitor* ignoreVisitor = new IgnoreVisitor(info); |
107 |
< |
|
108 |
< |
for(int i = 0; i < args_info.ignore_given; i++) |
109 |
< |
ignoreVisitor->addIgnoreType(args_info.ignore_arg[i]); |
110 |
< |
|
111 |
< |
//ignore water |
112 |
< |
if(args_info.water_flag){ |
113 |
< |
ignoreVisitor->addIgnoreType("SSD"); |
114 |
< |
ignoreVisitor->addIgnoreType("SSD1"); |
115 |
< |
ignoreVisitor->addIgnoreType("SSD_E"); |
116 |
< |
ignoreVisitor->addIgnoreType("SSD_RF"); |
117 |
< |
ignoreVisitor->addIgnoreType("TIP3P_RB_0"); |
118 |
< |
ignoreVisitor->addIgnoreType("TIP4P_RB_0"); |
119 |
< |
ignoreVisitor->addIgnoreType("TIP5P_RB_0"); |
120 |
< |
ignoreVisitor->addIgnoreType("SPCE_RB_0"); |
121 |
< |
ignoreVisitor->addIgnoreType("DPD_RB_0"); |
122 |
< |
} |
123 |
< |
|
124 |
< |
compositeVisitor->addVisitor(ignoreVisitor, 1000); |
125 |
< |
} |
126 |
< |
|
127 |
< |
//creat RigidBody Visitor |
106 |
> |
//create RigidBody Visitor |
107 |
|
if(args_info.rigidbody_flag){ |
108 |
|
RBCOMVisitor* rbCOMVisitor = new RBCOMVisitor(info); |
109 |
|
compositeVisitor->addVisitor(rbCOMVisitor, 900); |
110 |
|
} |
111 |
|
|
112 |
< |
//create selection visitor |
134 |
< |
//if (args_info.selection_given){ |
135 |
< |
// SelectionVisitor* selectionVisitor = new SelectionVisitor(info, args_info.selection_arg); |
136 |
< |
// compositeVisitor->addVisitor(selectionVisitor, 850); |
137 |
< |
//} |
138 |
< |
|
139 |
< |
SelectionEvaluator* evaluator = NULL; |
140 |
< |
if (args_info.selection_given) { |
141 |
< |
evaluator = new SelectionEvaluator(info); |
142 |
< |
assert(evaluator); |
143 |
< |
evaluator->loadScriptString( args_info.selection_arg); |
144 |
< |
|
145 |
< |
} |
146 |
< |
|
147 |
< |
//creat SSD atom visitor |
112 |
> |
//create SSD atom visitor |
113 |
|
SSDAtomVisitor* ssdVisitor = new SSDAtomVisitor(info); |
114 |
|
compositeVisitor->addVisitor(ssdVisitor, 800); |
115 |
|
|
116 |
|
LinearAtomVisitor* linearVisitor = new LinearAtomVisitor(info); |
117 |
|
compositeVisitor->addVisitor(linearVisitor, 750); |
118 |
|
|
119 |
< |
//creat default atom visitor |
119 |
> |
//create default atom visitor |
120 |
|
DefaultAtomVisitor* defaultAtomVisitor = new DefaultAtomVisitor(info); |
121 |
|
compositeVisitor->addVisitor(defaultAtomVisitor, 700); |
122 |
|
|
123 |
< |
//creat waterType visitor |
123 |
> |
//create waterType visitor |
124 |
|
if(args_info.watertype_flag){ |
125 |
|
WaterTypeVisitor* waterTypeVisitor = new WaterTypeVisitor; |
126 |
|
compositeVisitor->addVisitor(waterTypeVisitor, 600); |
127 |
|
} |
128 |
+ |
|
129 |
+ |
if (args_info.basetype_flag) { |
130 |
+ |
AtomNameVisitor* atomNameVisitor = new AtomNameVisitor(info); |
131 |
+ |
compositeVisitor->addVisitor(atomNameVisitor, 550); |
132 |
+ |
|
133 |
+ |
} |
134 |
|
|
135 |
|
//create ZconsVisitor |
136 |
|
if(args_info.zconstraint_flag){ |
144 |
|
} |
145 |
|
} |
146 |
|
|
147 |
< |
//creat wrapping visitor |
147 |
> |
//create wrapping visitor |
148 |
|
|
149 |
|
if(args_info.periodicBox_flag){ |
150 |
|
WrappingVisitor* wrappingVisitor = new WrappingVisitor(info); |
151 |
|
compositeVisitor->addVisitor(wrappingVisitor, 400); |
152 |
|
} |
153 |
< |
|
154 |
< |
//creat replicate visitor |
153 |
> |
|
154 |
> |
//create replicate visitor |
155 |
|
if(args_info.repeatX_given > 0 || args_info.repeatY_given > 0 ||args_info.repeatY_given > 0){ |
156 |
|
Vector3i replicateOpt(args_info.repeatX_arg, args_info.repeatY_arg, args_info.repeatZ_arg); |
157 |
|
ReplicateVisitor* replicateVisitor = new ReplicateVisitor(info, replicateOpt); |
158 |
|
compositeVisitor->addVisitor(replicateVisitor, 300); |
159 |
|
} |
160 |
< |
|
161 |
< |
//creat xyzVisitor |
162 |
< |
XYZVisitor* xyzVisitor = new XYZVisitor(info); |
160 |
> |
|
161 |
> |
|
162 |
> |
//create rotation visitor |
163 |
> |
if (args_info.refsele_given&& args_info.originsele_given) { |
164 |
> |
compositeVisitor->addVisitor(new LipidTransVisitor(info, args_info.originsele_arg, args_info.refsele_arg), 250); |
165 |
> |
} else if (args_info.refsele_given || args_info.originsele_given) { |
166 |
> |
std::cerr << "Both of --refsele and --originsele should appear by pair" << std::endl; |
167 |
> |
exit(1); |
168 |
> |
} |
169 |
> |
|
170 |
> |
//create xyzVisitor |
171 |
> |
XYZVisitor* xyzVisitor; |
172 |
> |
if (args_info.selection_given) { |
173 |
> |
xyzVisitor = new XYZVisitor(info, args_info.selection_arg); |
174 |
> |
} else { |
175 |
> |
xyzVisitor = new XYZVisitor(info); |
176 |
> |
} |
177 |
|
compositeVisitor->addVisitor(xyzVisitor, 200); |
178 |
|
|
179 |
|
std::cout << compositeVisitor->toString(); |
180 |
|
|
181 |
< |
//creat prepareVisitor |
181 |
> |
//create prepareVisitor |
182 |
|
PrepareVisitor* prepareVisitor = new PrepareVisitor(); |
183 |
|
|
184 |
|
//open dump file |
196 |
|
Molecule* mol; |
197 |
|
StuntDouble* integrableObject; |
198 |
|
RigidBody* rb; |
199 |
< |
|
215 |
< |
if (evaluator && !evaluator->isDynamic()) { |
216 |
< |
info->getSelectionManager()->setSelectionSet(evaluator->evaluate()); |
217 |
< |
} |
218 |
< |
|
199 |
> |
|
200 |
|
for (int i = 0; i < nframes; i += args_info.frame_arg){ |
201 |
|
dumpReader->readFrame(i); |
202 |
|
|
220 |
|
//update visitor |
221 |
|
compositeVisitor->update(); |
222 |
|
|
223 |
< |
//if dynamic, we need to re-evaluate the selection |
243 |
< |
if (evaluator && evaluator->isDynamic()) { |
244 |
< |
info->getSelectionManager()->setSelectionSet(evaluator->evaluate()); |
245 |
< |
} |
246 |
< |
|
223 |
> |
|
224 |
|
//visit stuntdouble |
225 |
|
for (mol = info->beginMolecule(miter); mol != NULL; mol = info->nextMolecule(miter)) { |
226 |
|
for (integrableObject = mol->beginIntegrableObject(iiter); integrableObject != NULL; |
236 |
|
|
237 |
|
xyzStream.close(); |
238 |
|
|
239 |
< |
|
239 |
> |
delete prepareVisitor; |
240 |
|
delete compositeVisitor; |
241 |
|
delete info; |
242 |
|
|