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[]){ |
101 |
|
|
102 |
|
//creat visitor list |
103 |
|
CompositeVisitor* compositeVisitor = new CompositeVisitor(); |
101 |
– |
|
102 |
– |
//creat ignore visitor |
103 |
– |
if(args_info.ignore_given ||args_info.water_flag){ |
104 |
|
|
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]); |
109 |
– |
|
110 |
– |
//ignore water |
111 |
– |
if(args_info.water_flag){ |
112 |
– |
ignoreVisitor->addIgnoreType("SSD"); |
113 |
– |
ignoreVisitor->addIgnoreType("SSD1"); |
114 |
– |
ignoreVisitor->addIgnoreType("SSD_E"); |
115 |
– |
ignoreVisitor->addIgnoreType("SSD_RF"); |
116 |
– |
ignoreVisitor->addIgnoreType("TIP3P_RB_0"); |
117 |
– |
ignoreVisitor->addIgnoreType("TIP4P_RB_0"); |
118 |
– |
ignoreVisitor->addIgnoreType("TIP5P_RB_0"); |
119 |
– |
ignoreVisitor->addIgnoreType("SPCE_RB_0"); |
120 |
– |
ignoreVisitor->addIgnoreType("DPD_RB_0"); |
121 |
– |
} |
122 |
– |
|
123 |
– |
compositeVisitor->addVisitor(ignoreVisitor, 1000); |
124 |
– |
} |
125 |
– |
|
105 |
|
//creat RigidBody Visitor |
106 |
|
if(args_info.rigidbody_flag){ |
107 |
|
RBCOMVisitor* rbCOMVisitor = new RBCOMVisitor(info); |
108 |
|
compositeVisitor->addVisitor(rbCOMVisitor, 900); |
109 |
|
} |
110 |
|
|
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 |
– |
|
111 |
|
//creat SSD atom visitor |
112 |
|
SSDAtomVisitor* ssdVisitor = new SSDAtomVisitor(info); |
113 |
|
compositeVisitor->addVisitor(ssdVisitor, 800); |
143 |
|
WrappingVisitor* wrappingVisitor = new WrappingVisitor(info); |
144 |
|
compositeVisitor->addVisitor(wrappingVisitor, 400); |
145 |
|
} |
146 |
< |
|
146 |
> |
|
147 |
|
//creat replicate visitor |
148 |
|
if(args_info.repeatX_given > 0 || args_info.repeatY_given > 0 ||args_info.repeatY_given > 0){ |
149 |
|
Vector3i replicateOpt(args_info.repeatX_arg, args_info.repeatY_arg, args_info.repeatZ_arg); |
150 |
|
ReplicateVisitor* replicateVisitor = new ReplicateVisitor(info, replicateOpt); |
151 |
|
compositeVisitor->addVisitor(replicateVisitor, 300); |
152 |
|
} |
153 |
< |
|
153 |
> |
|
154 |
> |
|
155 |
> |
//create rotation visitor |
156 |
> |
if (args_info.refsele_given&& args_info.originsele_given) { |
157 |
> |
compositeVisitor->addVisitor(new LipidTransVisitor(info, args_info.originsele_arg, args_info.refsele_arg), 250); |
158 |
> |
} else if (args_info.refsele_given || args_info.originsele_given) { |
159 |
> |
std::cerr << "Both of --refsele and --originsele should appear by pair" << std::endl; |
160 |
> |
exit(1); |
161 |
> |
} |
162 |
> |
|
163 |
|
//creat xyzVisitor |
164 |
< |
XYZVisitor* xyzVisitor = new XYZVisitor(info); |
164 |
> |
XYZVisitor* xyzVisitor; |
165 |
> |
if (args_info.selection_given) { |
166 |
> |
xyzVisitor = new XYZVisitor(info, args_info.selection_arg); |
167 |
> |
} else { |
168 |
> |
xyzVisitor = new XYZVisitor(info); |
169 |
> |
} |
170 |
|
compositeVisitor->addVisitor(xyzVisitor, 200); |
171 |
|
|
172 |
|
std::cout << compositeVisitor->toString(); |
189 |
|
Molecule* mol; |
190 |
|
StuntDouble* integrableObject; |
191 |
|
RigidBody* rb; |
192 |
< |
|
214 |
< |
if (evaluator && !evaluator->isDynamic()) { |
215 |
< |
info->getSelectionManager()->setSelectionSet(evaluator->evaluate()); |
216 |
< |
} |
217 |
< |
|
192 |
> |
|
193 |
|
for (int i = 0; i < nframes; i += args_info.frame_arg){ |
194 |
|
dumpReader->readFrame(i); |
195 |
|
|
213 |
|
//update visitor |
214 |
|
compositeVisitor->update(); |
215 |
|
|
216 |
< |
//if dynamic, we need to re-evaluate the selection |
242 |
< |
if (evaluator && evaluator->isDynamic()) { |
243 |
< |
info->getSelectionManager()->setSelectionSet(evaluator->evaluate()); |
244 |
< |
} |
245 |
< |
|
216 |
> |
|
217 |
|
//visit stuntdouble |
218 |
|
for (mol = info->beginMolecule(miter); mol != NULL; mol = info->nextMolecule(miter)) { |
219 |
|
for (integrableObject = mol->beginIntegrableObject(iiter); integrableObject != NULL; |