ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/UseTheForce/DUFF.cpp
(Generate patch)

Comparing branches/new_design/OOPSE-3.0/src/UseTheForce/DUFF.cpp (file contents):
Revision 1765 by tim, Mon Nov 22 20:55:52 2004 UTC vs.
Revision 1770 by tim, Tue Nov 23 17:53:43 2004 UTC

# Line 39 | Line 39 | ForceFieldFactory::getInstance()->registerForceField("
39   //register createDUFF to ForceFieldFactory
40   ForceFieldFactory::getInstance()->registerForceField("DUFF", createDUFF);
41  
42 + DUFF::DUFF(){
43  
44 +    //the order of adding section parsers are important
45 +    //DirectionalAtomTypesSectionParser should be added before AtomTypesSectionParser Since
46 +    //These two section parsers will actually create "real" AtomTypes (AtomTypesSectionParser will create
47 +    //AtomType and DirectionalAtomTypesSectionParser will creat DirectionalAtomType which is a subclass
48 +    //of AtomType, therefore it should come first). Other AtomTypes Section Parser will not create the
49 +    //"real" AtomType, they only add and set some attribute of the AtomType. Thus their order are not
50 +    //important. AtomTypesSectionParser should be added before other atom type section parsers.
51 +    //Make sure they are added after DirectionalAtomTypesSectionParser and AtomTypesSectionParser.
52 +    //The order of BondTypesSectionParser, BendTypesSectionParser and TorsionTypesSectionParser are
53 +    //not important.
54 +    spMan_.push_back(new DirectionalAtomTypesSectionParser());
55 +    spMan_.push_back(new AtomTypesSectionParser());
56 +    spMan_.push_back(new LennardJonesAtomTypesSectionParser());
57 +    spMan_.push_back(new ElectrostaticAtomTypesSectionParser());
58 +    spMan_.push_back(new EAMAtomTypesSectionParser());
59 +    spMan_.push_back(new StickyAtomTypesSectionParser());
60 +    spMan_.push_back(new BondTypesSectionParser());
61 +    spMan_.push_back(new BendTypesSectionParser());
62 +    spMan_.push_back(new TorsionTypesSectionParser());
63 +    
64 + }
65 +
66 + void DUFF::parse(const std::string& filename) {
67 +    ifstrstream* ffStream;
68 +    ffStream = openForceFiledFile(filename);
69 +
70 +    spMan_.parse(*ffStream, *this);
71 +
72 +    typename ForceField::AtomTypeContainer::MapTypeIterator i;
73 +    AtomType* at;
74 +
75 +    for (at = atomTypeCont_.beginType(i); at != NULL; at = atomTypeCont_.nextType(i)) {
76 +        at->makeFortranAtomType();
77 +    }
78 +
79 +    for (at = atomTypeCont_.beginType(i); at != NULL; at = atomTypeCont_.nextType(i)) {
80 +        at->complete();
81 +    }
82 +    
83 + }
84 +
85 + /*
86   ParseState DUFF::getSection(const std::string& section) {
87      ParseState result;
88      
# Line 358 | Line 401 | void DUFF::parseBondType(const std::string& line, int
401  
402      //switch is a maintain nightmare
403      switch(bt) {
404 <        case "FixedBondType" :
404 >        case "Fixed" :
405              bondType = new FixedBondType();
406              break;
407              
408 <        case "HarmonicBondType" :
408 >        case "Harmonic" :
409              if (nTokens < 1) {
410  
411              } else {
# Line 373 | Line 416 | void DUFF::parseBondType(const std::string& line, int
416  
417              break;
418  
419 <        case "CubicBondType" :
419 >        case "Cubic" :
420              if (nTokens < 4) {
421  
422              } else {
# Line 387 | Line 430 | void DUFF::parseBondType(const std::string& line, int
430              }
431              break;
432              
433 <        case "QuadraticBondType" :
433 >        case "Quartic" :
434              if (nTokens < 5) {
435  
436              } else {
# Line 403 | Line 446 | void DUFF::parseBondType(const std::string& line, int
446              }
447              break;
448  
449 <        case "PolynomialBondType " :
449 >        case "Polynomial" :
450              if (nTokens < 2 || nTokens % 2 != 0) {
451  
452              } else {
# Line 456 | Line 499 | void DUFF::parseBendType(const std::string& line, int
499      //switch is a maintain nightmare
500      switch(bt) {
501              
502 <        case "HarmonicBendType" :
502 >        case "Harmonic" :
503              
504              if (nTokens < 1) {
505  
# Line 466 | Line 509 | void DUFF::parseBendType(const std::string& line, int
509                  bendType = new HarmonicBendType(theta0, ktheta);
510              }
511              break;
512 <        case "GhostBendType" :
512 >        case "GhostBend" :
513              if (nTokens < 1) {
514  
515              } else {
# Line 475 | Line 518 | void DUFF::parseBendType(const std::string& line, int
518              }
519              break;            
520  
521 <        case "UreyBradleyBendType" :
521 >        case "UreyBradley" :
522              if (nTokens < 3) {
523  
524              } else {
# Line 486 | Line 529 | void DUFF::parseBendType(const std::string& line, int
529              }
530              break;
531              
532 <        case "CubicBendType" :
532 >        case "Cubic" :
533              if (nTokens < 4) {
534  
535              } else {
# Line 500 | Line 543 | void DUFF::parseBendType(const std::string& line, int
543              }
544              break;
545              
546 <        case "QuadraticBendType" :
546 >        case "Quartic" :
547              if (nTokens < 5) {
548  
549              } else {
# Line 516 | Line 559 | void DUFF::parseBendType(const std::string& line, int
559              }
560              break;
561  
562 <        case "PolynomialBendType " :
562 >        case "Polynomial" :
563              if (nTokens < 2 || nTokens % 2 != 0) {
564  
565              } else {
# Line 551 | Line 594 | void DUFF::parseTorsionType(const std::string& line, i
594      std::string at3;
595      std::string at4;
596      std::string tt;
597 <    TorsionType* bendType = NULL;
597 >    TorsionType* torsionType = NULL;
598  
599      int nTokens = tokenizer.countTokens();
600  
# Line 570 | Line 613 | void DUFF::parseTorsionType(const std::string& line, i
613  
614      switch(tt) {
615              
616 <        case "CubicTorsionType" :
616 >        case "Cubic" :
617              if (nTokens < 4) {
618  
619              } else {
# Line 584 | Line 627 | void DUFF::parseTorsionType(const std::string& line, i
627              }
628              break;
629              
630 <        case "QuadraticTorsionType" :
630 >        case "Quartic" :
631              if (nTokens < 5) {
632  
633              } else {
# Line 600 | Line 643 | void DUFF::parseTorsionType(const std::string& line, i
643              }
644              break;
645  
646 <        case "PolynomialTorsionType " :
646 >        case "Polynomial" :
647              if (nTokens < 2 || nTokens % 2 != 0) {
648  
649              } else {
# Line 617 | Line 660 | void DUFF::parseTorsionType(const std::string& line, i
660              }
661              
662              break;
663 <        case "CharmmTorsionType" :
663 >        case "Charmm" :
664              
665              if (nTokens < 3 || nTokens % 3 != 0) {
666  
# Line 638 | Line 681 | void DUFF::parseTorsionType(const std::string& line, i
681              
682      }
683  
684 <    if (bendType != NULL) {
685 <        addTorsionType(at1, at2, at3, bendType);
684 >    if (torsionType != NULL) {
685 >        addTorsionType(at1, at2, at3, at4, torsionType);
686      }
687   }
688 <
688 > */
689   } //end namespace oopse

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines