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 3116 by chuckv, Tue Jan 16 22:18:04 2007 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 290 | Line 289 | namespace oopse {
289          return;
290      } else
291        return;
292 +
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 <        sprintf(buffer,
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 <                atomInfo->atomTypeName.c_str(),
311 <                atomInfo->pos[0],
312 <                atomInfo->pos[1],
313 <                atomInfo->pos[2]);
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 <                atomInfo->atomTypeName.c_str(),
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      }
# Line 350 | 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