| 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 |
+ |
if (args_info.gb_given) { |
| 119 |
+ |
linearVisitor->addGayBerneAtomType(args_info.gb_arg); |
| 120 |
+ |
} |
| 121 |
|
|
| 122 |
< |
//creat default atom visitor |
| 122 |
> |
GBLipidAtomVisitor* gbLipidVisitor = new GBLipidAtomVisitor(info); |
| 123 |
> |
compositeVisitor->addVisitor(gbLipidVisitor, 740); |
| 124 |
> |
|
| 125 |
> |
//create default atom visitor |
| 126 |
|
DefaultAtomVisitor* defaultAtomVisitor = new DefaultAtomVisitor(info); |
| 127 |
|
compositeVisitor->addVisitor(defaultAtomVisitor, 700); |
| 128 |
|
|
| 129 |
< |
//creat waterType visitor |
| 129 |
> |
//create waterType visitor |
| 130 |
|
if(args_info.watertype_flag){ |
| 131 |
|
WaterTypeVisitor* waterTypeVisitor = new WaterTypeVisitor; |
| 132 |
|
compositeVisitor->addVisitor(waterTypeVisitor, 600); |
| 133 |
|
} |
| 134 |
+ |
|
| 135 |
+ |
if (args_info.basetype_flag) { |
| 136 |
+ |
AtomNameVisitor* atomNameVisitor = new AtomNameVisitor(info); |
| 137 |
+ |
compositeVisitor->addVisitor(atomNameVisitor, 550); |
| 138 |
+ |
|
| 139 |
+ |
} |
| 140 |
|
|
| 141 |
|
//create ZconsVisitor |
| 142 |
|
if(args_info.zconstraint_flag){ |
| 150 |
|
} |
| 151 |
|
} |
| 152 |
|
|
| 153 |
< |
//creat wrapping visitor |
| 153 |
> |
//create wrapping visitor |
| 154 |
|
|
| 155 |
< |
if(args_info.periodicBox_flag){ |
| 156 |
< |
WrappingVisitor* wrappingVisitor = new WrappingVisitor(info); |
| 157 |
< |
compositeVisitor->addVisitor(wrappingVisitor, 400); |
| 158 |
< |
} |
| 159 |
< |
|
| 160 |
< |
//creat replicate visitor |
| 155 |
> |
//if(args_info.periodicBox_flag){ |
| 156 |
> |
// WrappingVisitor* wrappingVisitor = new WrappingVisitor(info); |
| 157 |
> |
// compositeVisitor->addVisitor(wrappingVisitor, 400); |
| 158 |
> |
//} |
| 159 |
> |
|
| 160 |
> |
//create replicate visitor |
| 161 |
|
if(args_info.repeatX_given > 0 || args_info.repeatY_given > 0 ||args_info.repeatY_given > 0){ |
| 162 |
|
Vector3i replicateOpt(args_info.repeatX_arg, args_info.repeatY_arg, args_info.repeatZ_arg); |
| 163 |
|
ReplicateVisitor* replicateVisitor = new ReplicateVisitor(info, replicateOpt); |
| 164 |
|
compositeVisitor->addVisitor(replicateVisitor, 300); |
| 165 |
|
} |
| 166 |
< |
|
| 167 |
< |
//creat xyzVisitor |
| 168 |
< |
XYZVisitor* xyzVisitor = new XYZVisitor(info); |
| 166 |
> |
|
| 167 |
> |
|
| 168 |
> |
//create rotation visitor |
| 169 |
> |
if (args_info.refsele_given&& args_info.originsele_given) { |
| 170 |
> |
compositeVisitor->addVisitor(new LipidTransVisitor(info, args_info.originsele_arg, args_info.refsele_arg), 250); |
| 171 |
> |
} else if (args_info.refsele_given || args_info.originsele_given) { |
| 172 |
> |
std::cerr << "Both of --refsele and --originsele should appear by pair" << std::endl; |
| 173 |
> |
exit(1); |
| 174 |
> |
} |
| 175 |
> |
|
| 176 |
> |
//create xyzVisitor |
| 177 |
> |
XYZVisitor* xyzVisitor; |
| 178 |
> |
if (args_info.selection_given) { |
| 179 |
> |
xyzVisitor = new XYZVisitor(info, args_info.selection_arg); |
| 180 |
> |
} else { |
| 181 |
> |
xyzVisitor = new XYZVisitor(info); |
| 182 |
> |
} |
| 183 |
|
compositeVisitor->addVisitor(xyzVisitor, 200); |
| 184 |
|
|
| 185 |
|
std::cout << compositeVisitor->toString(); |
| 186 |
|
|
| 187 |
< |
//creat prepareVisitor |
| 187 |
> |
//create prepareVisitor |
| 188 |
|
PrepareVisitor* prepareVisitor = new PrepareVisitor(); |
| 189 |
|
|
| 190 |
|
//open dump file |
| 202 |
|
Molecule* mol; |
| 203 |
|
StuntDouble* integrableObject; |
| 204 |
|
RigidBody* rb; |
| 205 |
< |
|
| 206 |
< |
if (evaluator && !evaluator->isDynamic()) { |
| 207 |
< |
info->getSelectionManager()->setSelectionSet(evaluator->evaluate()); |
| 208 |
< |
} |
| 209 |
< |
|
| 205 |
> |
Vector3d molCom; |
| 206 |
> |
Vector3d newMolCom; |
| 207 |
> |
Vector3d displacement; |
| 208 |
> |
Mat3x3d hmat; |
| 209 |
> |
Snapshot* currentSnapshot; |
| 210 |
> |
|
| 211 |
|
for (int i = 0; i < nframes; i += args_info.frame_arg){ |
| 212 |
|
dumpReader->readFrame(i); |
| 213 |
< |
|
| 213 |
> |
|
| 214 |
> |
//wrapping the molecule |
| 215 |
> |
if(args_info.periodicBox_flag) { |
| 216 |
> |
currentSnapshot = info->getSnapshotManager()->getCurrentSnapshot(); |
| 217 |
> |
for (mol = info->beginMolecule(miter); mol != NULL; mol = info->nextMolecule(miter)) { |
| 218 |
> |
molCom = mol->getCom(); |
| 219 |
> |
newMolCom = molCom; |
| 220 |
> |
currentSnapshot->wrapVector(newMolCom); |
| 221 |
> |
displacement = newMolCom - molCom; |
| 222 |
> |
for (integrableObject = mol->beginIntegrableObject(iiter); integrableObject != NULL; |
| 223 |
> |
integrableObject = mol->nextIntegrableObject(iiter)) { |
| 224 |
> |
integrableObject->setPos(integrableObject->getPos() + displacement); |
| 225 |
> |
} |
| 226 |
> |
} |
| 227 |
> |
} |
| 228 |
|
//update atoms of rigidbody |
| 229 |
|
for (mol = info->beginMolecule(miter); mol != NULL; mol = info->nextMolecule(miter)) { |
| 230 |
|
|
| 245 |
|
//update visitor |
| 246 |
|
compositeVisitor->update(); |
| 247 |
|
|
| 248 |
< |
//if dynamic, we need to re-evaluate the selection |
| 243 |
< |
if (evaluator && evaluator->isDynamic()) { |
| 244 |
< |
info->getSelectionManager()->setSelectionSet(evaluator->evaluate()); |
| 245 |
< |
} |
| 246 |
< |
|
| 248 |
> |
|
| 249 |
|
//visit stuntdouble |
| 250 |
|
for (mol = info->beginMolecule(miter); mol != NULL; mol = info->nextMolecule(miter)) { |
| 251 |
|
for (integrableObject = mol->beginIntegrableObject(iiter); integrableObject != NULL; |
| 261 |
|
|
| 262 |
|
xyzStream.close(); |
| 263 |
|
|
| 264 |
< |
|
| 264 |
> |
delete prepareVisitor; |
| 265 |
|
delete compositeVisitor; |
| 266 |
|
delete info; |
| 267 |
|
|