54 |
|
#include "visitors/RigidBodyVisitor.hpp" |
55 |
|
#include "visitors/OtherVisitor.hpp" |
56 |
|
#include "visitors/ZconsVisitor.hpp" |
57 |
+ |
#include "selection/SelectionEvaluator.hpp" |
58 |
+ |
#include "selection/SelectionManager.hpp" |
59 |
+ |
#include "visitors/LipidTransVisitor.hpp" |
60 |
+ |
|
61 |
|
using namespace oopse; |
62 |
|
|
63 |
|
int main(int argc, char* argv[]){ |
85 |
|
|
86 |
|
mdFileName = dumpFileName; |
87 |
|
mdFileName = mdFileName.substr(0, mdFileName.rfind(".")) + ".md"; |
88 |
< |
|
88 |
> |
|
89 |
|
if (args_info.output_given){ |
90 |
|
xyzFileName = args_info.output_arg; |
91 |
|
} else { |
95 |
|
|
96 |
|
//parse md file and set up the system |
97 |
|
SimCreator creator; |
98 |
< |
SimInfo* info = creator.createSim(mdFileName); |
98 |
> |
SimInfo* info = creator.createSim(mdFileName, false); |
99 |
|
|
100 |
|
|
101 |
|
|
105 |
|
//creat ignore visitor |
106 |
|
if(args_info.ignore_given ||args_info.water_flag){ |
107 |
|
|
108 |
< |
IgnoreVisitor* ignoreVisitor = new IgnoreVisitor(); |
108 |
> |
IgnoreVisitor* ignoreVisitor = new IgnoreVisitor(info); |
109 |
|
|
110 |
|
for(int i = 0; i < args_info.ignore_given; i++) |
111 |
|
ignoreVisitor->addIgnoreType(args_info.ignore_arg[i]); |
132 |
|
compositeVisitor->addVisitor(rbCOMVisitor, 900); |
133 |
|
} |
134 |
|
|
135 |
< |
//compositeVisitor->addVisitor(lipidVisitor, 900); |
135 |
> |
//create selection visitor |
136 |
> |
//if (args_info.selection_given){ |
137 |
> |
// SelectionVisitor* selectionVisitor = new SelectionVisitor(info, args_info.selection_arg); |
138 |
> |
// compositeVisitor->addVisitor(selectionVisitor, 850); |
139 |
> |
//} |
140 |
> |
|
141 |
> |
SelectionEvaluator* evaluator = NULL; |
142 |
> |
if (args_info.selection_given) { |
143 |
> |
evaluator = new SelectionEvaluator(info); |
144 |
> |
assert(evaluator); |
145 |
> |
evaluator->loadScriptString( args_info.selection_arg); |
146 |
> |
|
147 |
> |
} |
148 |
|
|
149 |
|
//creat SSD atom visitor |
150 |
|
SSDAtomVisitor* ssdVisitor = new SSDAtomVisitor(info); |
181 |
|
WrappingVisitor* wrappingVisitor = new WrappingVisitor(info); |
182 |
|
compositeVisitor->addVisitor(wrappingVisitor, 400); |
183 |
|
} |
184 |
< |
|
184 |
> |
|
185 |
|
//creat replicate visitor |
186 |
|
if(args_info.repeatX_given > 0 || args_info.repeatY_given > 0 ||args_info.repeatY_given > 0){ |
187 |
|
Vector3i replicateOpt(args_info.repeatX_arg, args_info.repeatY_arg, args_info.repeatZ_arg); |
188 |
|
ReplicateVisitor* replicateVisitor = new ReplicateVisitor(info, replicateOpt); |
189 |
|
compositeVisitor->addVisitor(replicateVisitor, 300); |
190 |
|
} |
191 |
< |
|
191 |
> |
|
192 |
> |
|
193 |
> |
//create rotation visitor |
194 |
> |
if (args_info.refsele_given&& args_info.originsele_given) { |
195 |
> |
compositeVisitor->addVisitor(new LipidTransVisitor(info, args_info.originsele_arg, args_info.refsele_arg), 250); |
196 |
> |
} else if (args_info.refsele_given || args_info.originsele_given) { |
197 |
> |
std::cerr << "Both of --refsele and --originselc should appear by pair" << std::endl; |
198 |
> |
exit(1); |
199 |
> |
} |
200 |
> |
|
201 |
|
//creat xyzVisitor |
202 |
|
XYZVisitor* xyzVisitor = new XYZVisitor(info); |
203 |
|
compositeVisitor->addVisitor(xyzVisitor, 200); |
222 |
|
Molecule* mol; |
223 |
|
StuntDouble* integrableObject; |
224 |
|
RigidBody* rb; |
225 |
+ |
|
226 |
+ |
if (evaluator && !evaluator->isDynamic()) { |
227 |
+ |
info->getSelectionManager()->setSelectionSet(evaluator->evaluate()); |
228 |
+ |
} |
229 |
|
|
230 |
|
for (int i = 0; i < nframes; i += args_info.frame_arg){ |
231 |
|
dumpReader->readFrame(i); |
249 |
|
|
250 |
|
//update visitor |
251 |
|
compositeVisitor->update(); |
252 |
+ |
|
253 |
+ |
//if dynamic, we need to re-evaluate the selection |
254 |
+ |
if (evaluator && evaluator->isDynamic()) { |
255 |
+ |
info->getSelectionManager()->setSelectionSet(evaluator->evaluate()); |
256 |
+ |
} |
257 |
|
|
258 |
|
//visit stuntdouble |
259 |
|
for (mol = info->beginMolecule(miter); mol != NULL; mol = info->nextMolecule(miter)) { |