ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/visitors/OtherVisitor.cpp
(Generate patch)

Comparing trunk/OOPSE-4/src/visitors/OtherVisitor.cpp (file contents):
Revision 2240 by tim, Thu May 26 22:45:00 2005 UTC vs.
Revision 3446 by cli2, Wed Sep 10 19:51:45 2008 UTC

# Line 5 | Line 5
5   * non-exclusive, royalty free, license to use, modify and
6   * redistribute this software in source and binary code form, provided
7   * that the following conditions are met:
8 *
8   * 1. Acknowledgement of the program authors must be made in any
9   *    publication of scientific results based in part on use of the
10   *    program.  An acceptable form of acknowledgement is citation of
# Line 235 | Line 234 | namespace oopse {
234        if (!evaluator.isDynamic()) {
235          seleMan.setSelectionSet(evaluator.evaluate());
236        }
237 <
237 >      posOnly_ = false;
238      }
239  
240    XYZVisitor::XYZVisitor(SimInfo *info, const std::string& script) :
# Line 248 | Line 247 | namespace oopse {
247        if (!evaluator.isDynamic()) {
248          seleMan.setSelectionSet(evaluator.evaluate());
249        }
250 <          
250 >      posOnly_ = false;
251      }
252      
253    void XYZVisitor::visit(Atom *atom) {
# Line 291 | Line 290 | namespace oopse {
290      } else
291        return;
292  
293 <    for( atomInfo = atomData->beginAtomInfo(i); atomInfo;
294 <         atomInfo = atomData->nextAtomInfo(i) ) {
295 <      sprintf(buffer,
296 <              "%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f",
297 <              atomInfo->atomTypeName.c_str(),
298 <              atomInfo->pos[0],
299 <              atomInfo->pos[1],
300 <              atomInfo->pos[2],
301 <              atomInfo->dipole[0],
302 <              atomInfo->dipole[1],
303 <              atomInfo->dipole[2]);
304 <      frame.push_back(buffer);
293 >    AtomType* at = dynamic_cast<Atom *>(sd)->getAtomType();
294 >    std::string bn = baseTypeName(at);
295 >
296 >    if (posOnly_){
297 >      for( atomInfo = atomData->beginAtomInfo(i); atomInfo;
298 >           atomInfo = atomData->nextAtomInfo(i) ) {
299 >        if (atomInfo->hasCharge) {
300 >          sprintf(buffer,
301 >                  "%s%15.8f%15.8f%15.8f%15.8f",
302 >                  bn.c_str(),
303 >                  atomInfo->pos[0],
304 >                  atomInfo->pos[1],
305 >                  atomInfo->pos[2],
306 >                  atomInfo->charge);
307 >        } else {
308 >          sprintf(buffer,
309 >                "%s%15.8f%15.8f%15.8f",
310 >                  bn.c_str(),
311 >                  atomInfo->pos[0],
312 >                  atomInfo->pos[1],
313 >                  atomInfo->pos[2]);
314 >        }
315 >        frame.push_back(buffer);
316 >      }
317 >    }else{
318 >      for( atomInfo = atomData->beginAtomInfo(i); atomInfo;
319 >           atomInfo = atomData->nextAtomInfo(i) ) {
320 >        if (atomInfo->hasCharge) {
321 >        sprintf(buffer,
322 >                "%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f",
323 >                bn.c_str(),
324 >                atomInfo->pos[0],
325 >                atomInfo->pos[1],
326 >                atomInfo->pos[2],
327 >                atomInfo->charge,
328 >                atomInfo->dipole[0],
329 >                atomInfo->dipole[1],
330 >                atomInfo->dipole[2]);
331 >        } else {
332 >        sprintf(buffer,
333 >                "%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f",
334 >                bn.c_str(),
335 >                atomInfo->pos[0],
336 >                atomInfo->pos[1],
337 >                atomInfo->pos[2],
338 >                atomInfo->dipole[0],
339 >                atomInfo->dipole[1],
340 >                atomInfo->dipole[2]);
341 >        }
342 >        frame.push_back(buffer);
343 >      }
344      }
345    }
346  
# Line 337 | Line 375 | namespace oopse {
375        outStream << *i << std::endl;
376    }
377  
378 +  std::string XYZVisitor::trimmedName(const std::string&atomTypeName) {    
379 +    return atomTypeName.substr(0, atomTypeName.find('-'));
380 +  }
381 +
382 +  std::string XYZVisitor::baseTypeName(AtomType* at) {
383 +    std::vector<AtomType*> ayb = at->allYourBase();
384 +    return ayb[ayb.size()-1]->getName();
385 +  }
386 +
387    const std::string XYZVisitor::toString() {
388      char        buffer[65535];
389      std::string result;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines