54 |
|
#include "visitors/RigidBodyVisitor.hpp" |
55 |
|
#include "visitors/OtherVisitor.hpp" |
56 |
|
#include "visitors/ZconsVisitor.hpp" |
57 |
+ |
#include "selection/SelectionEvaluator.hpp" |
58 |
|
using namespace oopse; |
59 |
|
|
60 |
|
int main(int argc, char* argv[]){ |
82 |
|
|
83 |
|
mdFileName = dumpFileName; |
84 |
|
mdFileName = mdFileName.substr(0, mdFileName.rfind(".")) + ".md"; |
85 |
< |
|
85 |
> |
|
86 |
|
if (args_info.output_given){ |
87 |
|
xyzFileName = args_info.output_arg; |
88 |
|
} else { |
92 |
|
|
93 |
|
//parse md file and set up the system |
94 |
|
SimCreator creator; |
95 |
< |
SimInfo* info = creator.createSim(mdFileName); |
95 |
> |
SimInfo* info = creator.createSim(mdFileName, false); |
96 |
|
|
97 |
|
|
98 |
|
|
102 |
|
//creat ignore visitor |
103 |
|
if(args_info.ignore_given ||args_info.water_flag){ |
104 |
|
|
105 |
< |
IgnoreVisitor* ignoreVisitor = new IgnoreVisitor(); |
105 |
> |
IgnoreVisitor* ignoreVisitor = new IgnoreVisitor(info); |
106 |
|
|
107 |
|
for(int i = 0; i < args_info.ignore_given; i++) |
108 |
|
ignoreVisitor->addIgnoreType(args_info.ignore_arg[i]); |
129 |
|
compositeVisitor->addVisitor(rbCOMVisitor, 900); |
130 |
|
} |
131 |
|
|
132 |
< |
//compositeVisitor->addVisitor(lipidVisitor, 900); |
132 |
> |
//create selection visitor |
133 |
> |
//if (args_info.selection_given){ |
134 |
> |
// SelectionVisitor* selectionVisitor = new SelectionVisitor(info, args_info.selection_arg); |
135 |
> |
// compositeVisitor->addVisitor(selectionVisitor, 850); |
136 |
> |
//} |
137 |
> |
|
138 |
> |
SelectionEvaluator* evaluator = NULL; |
139 |
> |
if (args_info.selection_given) { |
140 |
> |
evaluator = new SelectionEvaluator(info); |
141 |
> |
assert(evaluator); |
142 |
> |
evaluator->loadScriptString( args_info.selection_arg); |
143 |
> |
|
144 |
> |
} |
145 |
|
|
146 |
|
//creat SSD atom visitor |
147 |
|
SSDAtomVisitor* ssdVisitor = new SSDAtomVisitor(info); |
148 |
|
compositeVisitor->addVisitor(ssdVisitor, 800); |
149 |
|
|
150 |
< |
LinearVisitor* linearVisitor = new LinearAtomVisitor(info); |
150 |
> |
LinearAtomVisitor* linearVisitor = new LinearAtomVisitor(info); |
151 |
|
compositeVisitor->addVisitor(linearVisitor, 750); |
152 |
|
|
153 |
|
//creat default atom visitor |
210 |
|
Molecule* mol; |
211 |
|
StuntDouble* integrableObject; |
212 |
|
RigidBody* rb; |
213 |
+ |
|
214 |
+ |
if (evaluator && !evaluator->isDynamic()) { |
215 |
+ |
info->getSelectionManager()->setSelectionSet(evaluator->evaluate()); |
216 |
+ |
} |
217 |
|
|
218 |
|
for (int i = 0; i < nframes; i += args_info.frame_arg){ |
219 |
|
dumpReader->readFrame(i); |
237 |
|
|
238 |
|
//update visitor |
239 |
|
compositeVisitor->update(); |
240 |
+ |
|
241 |
+ |
//if dynamic, we need to re-evaluate the selection |
242 |
+ |
if (evaluator && evaluator->isDynamic()) { |
243 |
+ |
info->getSelectionManager()->setSelectionSet(evaluator->evaluate()); |
244 |
+ |
} |
245 |
|
|
246 |
|
//visit stuntdouble |
247 |
|
for (mol = info->beginMolecule(miter); mol != NULL; mol = info->nextMolecule(miter)) { |