ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/applications/atom2md/openmdformat.cpp
(Generate patch)

Comparing:
trunk/src/applications/atom2md/openmdformat.cpp (file contents), Revision 1399 by gezelter, Thu Dec 24 05:45:30 2009 UTC vs.
branches/development/src/applications/atom2md/openmdformat.cpp (file contents), Revision 1874 by gezelter, Wed May 15 15:09:35 2013 UTC

# Line 129 | Line 129 | namespace OpenBabel
129          return false;
130      }
131      
132 +
133 +
134      WriteMDFile(mdMols, numMols, ofs, *pmol, indices);
135      
136      for(vector<OBMol*>::iterator  i = mdMols.begin(); i != mdMols.end(); ++i) {
# Line 171 | Line 173 | namespace OpenBabel
173                                              vector<int>& fragment) {
174      
175      OBMol* newMol = new OBMol();
176 +
177      newMol->ReserveAtoms(fragment.size());
178      newMol->BeginModify();
179      for(vector<int>::iterator i = fragment.begin(); i != fragment.end(); ++i) {
# Line 195 | Line 198 | namespace OpenBabel
198      const int BUFFLEN = 1024;
199      char buffer[BUFFLEN];
200      string str, str1, str2, str3;
198    OBAtom *a, *b, *c, *d;    
201      bool molIsWater = false;
202      OBResidue *r;
201    int resKey, myserial;
202    char type_name[10];
203    char *element_name;
204    int res_num;
205    OBChainsParser* chainParser = new OBChainsParser();  
203      double min_x, max_x, min_y, max_y, min_z, max_z; /* Edges of bounding box */
204      
205 <    os << "<OpenMD version=1>" << endl;
205 >    os << "<OpenMD version=2>" << endl;
206      os << "  <MetaData>" << endl << endl;
207      
208      for(i = 0; i < mols.size(); ++i) {
209        OBMol* pmol = mols[i];
210        map<OBAtom*, int> atomMap;
211  
215      //chainParser->PerceiveChains(*pmol, false);
212        molIsWater = false;
213        FOR_RESIDUES_OF_MOL(residue, *pmol) {
218        std::cerr << "residue = " << residue->GetName() << "\n";
214          if (residue->GetName().compare("HOH") == 0) {
215            molIsWater = true;
216          }
# Line 228 | Line 223 | namespace OpenBabel
223        } else {
224  
225          os << "molecule {\n";
226 <        sprintf(buffer, "%d", i);
226 >        sprintf(buffer, "%u", i);
227          os << "  name = \"" << molPrefix << buffer << "\";\n";
228          
229          int ai = 0;
# Line 351 | Line 346 | namespace OpenBabel
346              size_t endpos = str.find_last_not_of(" ");
347              str = str.substr( startpos, endpos-startpos+1 );
348              str1 = resName + "-" + str;
349 <          }      
349 >          }      
350            os << "  atom[" << ai << "] { ";
351            os << "type = " << "\"" << str1 << "\"" << "; ";
352            os << "position( " << (&*atom)->GetX() << ", " << (&*atom)->GetY() << ", " << (&*atom)->GetZ() << ");";
# Line 390 | Line 385 | namespace OpenBabel
385        OBMol* pmol = mols[i];      
386        os << "component{" << endl;
387        if (std::string(pmol->GetTitle()).compare("HOH") == 0) {
388 <        os << "  type = " << "HOH" << ";" << endl;
388 >        os << "  type = " << "\"HOH\"" << "; // change to appropriate water model" << endl;
389        } else {
390 <        sprintf(buffer, "%d", i);
390 >        sprintf(buffer, "%u", i);
391          os << "  type = " << molPrefix << buffer << ";" << endl;
392        }
393        os << "  nMol = " << numMols[i]<< ";" << endl;
# Line 416 | Line 411 | namespace OpenBabel
411      os << buffer << endl;
412      os << "    </FrameData>" << endl;
413      os << "    <StuntDoubles>" << endl;
414 <    
414 >        
415      OBAtom *atom;
416 <    
422 <    // still to do: intercept waters and recompute pvqj lines
423 <
416 >        
417      for(vector<int>::iterator i = indices.begin();i != indices.end(); ++i) {    
418 +      
419        atom = mol.GetAtom(*i);
420        sprintf(buffer, "%10d %7s %18.10g %18.10g %18.10g %13e %13e %13e", *i - 1,
421                "pv", atom->GetX(), atom->GetY(), atom->GetZ(), 0.0, 0.0, 0.0);

Comparing:
trunk/src/applications/atom2md/openmdformat.cpp (property svn:keywords), Revision 1399 by gezelter, Thu Dec 24 05:45:30 2009 UTC vs.
branches/development/src/applications/atom2md/openmdformat.cpp (property svn:keywords), Revision 1874 by gezelter, Wed May 15 15:09:35 2013 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines