# | Line 6 | Line 6 | |
---|---|---|
6 | * redistribute this software in source and binary code form, provided | |
7 | * that the following conditions are met: | |
8 | * | |
9 | < | * 1. Acknowledgement of the program authors must be made in any |
10 | < | * publication of scientific results based in part on use of the |
11 | < | * program. An acceptable form of acknowledgement is citation of |
12 | < | * the article in which the program was described (Matthew |
13 | < | * A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 | < | * J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 | < | * Parallel Simulation Engine for Molecular Dynamics," |
16 | < | * J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 | < | * |
18 | < | * 2. Redistributions of source code must retain the above copyright |
9 | > | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | |
11 | * | |
12 | < | * 3. Redistributions in binary form must reproduce the above copyright |
12 | > | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the | |
15 | * distribution. | |
# | Line 37 | Line 28 | |
28 | * arising out of the use of or inability to use software, even if the | |
29 | * University of Notre Dame has been advised of the possibility of | |
30 | * such damages. | |
31 | + | * |
32 | + | * SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your |
33 | + | * research, please cite the appropriate papers when you publish your |
34 | + | * work. Good starting points are: |
35 | + | * |
36 | + | * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
37 | + | * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
38 | + | * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
39 | + | * [4] Vardeman & Gezelter, in progress (2009). |
40 | */ | |
41 | ||
42 | #include <stack> | |
# | Line 47 | Line 47 | |
47 | #include "primitives/Molecule.hpp" | |
48 | #include "io/basic_ifstrstream.hpp" | |
49 | ||
50 | < | namespace oopse { |
50 | > | namespace OpenMD { |
51 | ||
52 | ||
53 | SelectionEvaluator::SelectionEvaluator(SimInfo* si) | |
# | Line 67 | Line 67 | namespace oopse { | |
67 | ||
68 | sprintf( painCave.errMsg, | |
69 | "SelectionCompiler Error: %s\n", errorMessage.c_str()); | |
70 | < | painCave.severity = OOPSE_ERROR; |
70 | > | painCave.severity = OPENMD_ERROR; |
71 | painCave.isFatal = 1; | |
72 | simError(); | |
73 | return false; | |
# | Line 122 | Line 122 | namespace oopse { | |
122 | return loadScript(filename, script); | |
123 | } | |
124 | ||
125 | < | void SelectionEvaluator::instructionDispatchLoop(OOPSEBitSet& bs){ |
125 | > | void SelectionEvaluator::instructionDispatchLoop(OpenMDBitSet& bs){ |
126 | ||
127 | while ( pc < aatoken.size()) { | |
128 | statement = aatoken[pc++]; | |
# | Line 143 | Line 143 | namespace oopse { | |
143 | ||
144 | } | |
145 | ||
146 | < | OOPSEBitSet SelectionEvaluator::expression(const std::vector<Token>& code, |
146 | > | OpenMDBitSet SelectionEvaluator::expression(const std::vector<Token>& code, |
147 | int pcStart) { | |
148 | < | OOPSEBitSet bs; |
149 | < | std::stack<OOPSEBitSet> stack; |
148 | > | OpenMDBitSet bs; |
149 | > | std::stack<OpenMDBitSet> stack; |
150 | ||
151 | for (int pc = pcStart; pc < code.size(); ++pc) { | |
152 | Token instruction = code[pc]; | |
# | Line 157 | Line 157 | namespace oopse { | |
157 | case Token::expressionEnd: | |
158 | break; | |
159 | case Token::all: | |
160 | < | bs = OOPSEBitSet(nStuntDouble); |
160 | > | bs = OpenMDBitSet(nStuntDouble); |
161 | bs.setAll(); | |
162 | stack.push(bs); | |
163 | break; | |
164 | case Token::none: | |
165 | < | bs = OOPSEBitSet(nStuntDouble); |
165 | > | bs = OpenMDBitSet(nStuntDouble); |
166 | stack.push(bs); | |
167 | break; | |
168 | case Token::opOr: | |
# | Line 213 | Line 213 | namespace oopse { | |
213 | ||
214 | ||
215 | ||
216 | < | OOPSEBitSet SelectionEvaluator::comparatorInstruction(const Token& instruction) { |
216 | > | OpenMDBitSet SelectionEvaluator::comparatorInstruction(const Token& instruction) { |
217 | int comparator = instruction.tok; | |
218 | int property = instruction.intValue; | |
219 | float comparisonValue = boost::any_cast<float>(instruction.value); | |
220 | float propertyValue; | |
221 | < | OOPSEBitSet bs(nStuntDouble); |
221 | > | OpenMDBitSet bs(nStuntDouble); |
222 | bs.clearAll(); | |
223 | ||
224 | SimInfo::MoleculeIterator mi; | |
# | Line 244 | Line 244 | namespace oopse { | |
244 | return bs; | |
245 | } | |
246 | ||
247 | < | void SelectionEvaluator::compareProperty(StuntDouble* sd, OOPSEBitSet& bs, |
247 | > | void SelectionEvaluator::compareProperty(StuntDouble* sd, OpenMDBitSet& bs, |
248 | int property, int comparator, | |
249 | float comparisonValue) { | |
250 | RealType propertyValue = 0.0; | |
# | Line 305 | Line 305 | namespace oopse { | |
305 | } | |
306 | ||
307 | void SelectionEvaluator::withinInstruction(const Token& instruction, | |
308 | < | OOPSEBitSet& bs){ |
308 | > | OpenMDBitSet& bs){ |
309 | ||
310 | boost::any withinSpec = instruction.value; | |
311 | float distance; | |
# | Line 362 | Line 362 | namespace oopse { | |
362 | } | |
363 | } | |
364 | ||
365 | < | void SelectionEvaluator::select(OOPSEBitSet& bs){ |
365 | > | void SelectionEvaluator::select(OpenMDBitSet& bs){ |
366 | bs = expression(statement, 1); | |
367 | } | |
368 | ||
369 | < | OOPSEBitSet SelectionEvaluator::lookupValue(const std::string& variable){ |
369 | > | OpenMDBitSet SelectionEvaluator::lookupValue(const std::string& variable){ |
370 | ||
371 | < | OOPSEBitSet bs(nStuntDouble); |
371 | > | OpenMDBitSet bs(nStuntDouble); |
372 | std::map<std::string, boost::any>::iterator i = variables.find(variable); | |
373 | ||
374 | if (i != variables.end()) { | |
375 | < | if (i->second.type() == typeid(OOPSEBitSet)) { |
376 | < | return boost::any_cast<OOPSEBitSet>(i->second); |
375 | > | if (i->second.type() == typeid(OpenMDBitSet)) { |
376 | > | return boost::any_cast<OpenMDBitSet>(i->second); |
377 | } else if (i->second.type() == typeid(std::vector<Token>)){ | |
378 | bs = expression(boost::any_cast<std::vector<Token> >(i->second), 2); | |
379 | i->second = bs; /**@todo fixme */ | |
# | Line 386 | Line 386 | namespace oopse { | |
386 | return bs; | |
387 | } | |
388 | ||
389 | < | OOPSEBitSet SelectionEvaluator::nameInstruction(const std::string& name){ |
389 | > | OpenMDBitSet SelectionEvaluator::nameInstruction(const std::string& name){ |
390 | return nameFinder.match(name); | |
391 | } | |
392 | ||
# | Line 407 | Line 407 | namespace oopse { | |
407 | //predefine(); | |
408 | } | |
409 | ||
410 | < | OOPSEBitSet SelectionEvaluator::evaluate() { |
411 | < | OOPSEBitSet bs(nStuntDouble); |
410 | > | OpenMDBitSet SelectionEvaluator::evaluate() { |
411 | > | OpenMDBitSet bs(nStuntDouble); |
412 | if (isLoaded_) { | |
413 | pc = 0; | |
414 | instructionDispatchLoop(bs); | |
# | Line 417 | Line 417 | namespace oopse { | |
417 | return bs; | |
418 | } | |
419 | ||
420 | < | OOPSEBitSet SelectionEvaluator::indexInstruction(const boost::any& value) { |
421 | < | OOPSEBitSet bs(nStuntDouble); |
420 | > | OpenMDBitSet SelectionEvaluator::indexInstruction(const boost::any& value) { |
421 | > | OpenMDBitSet bs(nStuntDouble); |
422 | ||
423 | if (value.type() == typeid(int)) { | |
424 | int index = boost::any_cast<int>(value); | |
# | Line 455 | Line 455 | namespace oopse { | |
455 | } else { | |
456 | sprintf( painCave.errMsg, | |
457 | "Can not cast GenericData to DoubleGenericData\n"); | |
458 | < | painCave.severity = OOPSE_ERROR; |
458 | > | painCave.severity = OPENMD_ERROR; |
459 | painCave.isFatal = 1; | |
460 | simError(); | |
461 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |