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

Comparing trunk/src/applications/atom2md/openmdformat.cpp (file contents):
Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
Revision 2071 by gezelter, Sat Mar 7 21:41:51 2015 UTC

# Line 1 | Line 1 | Copyright (C) 2000 by OpenEye Scientific Software, Inc
1   /**********************************************************************
2   Copyright (C) 2000 by OpenEye Scientific Software, Inc.
3 < Some portions Copyright (C) 2001-2005 by Geoffrey R. Hutchison
3 > Some portions Copyright (C) 2001-2006 by Geoffrey R. Hutchison
4   Some portions Copyright (C) 2004 by Chris Morley
5 < Some portions Copyright (C) 2008 by J. Daniel Gezelter
5 > Some portions Copyright (C) 2008-2009 by J. Daniel Gezelter
6  
7   This program is free software; you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
# Line 40 | Line 40 | namespace OpenBabel
40      virtual const char* Description() //required
41      {
42        return
43 <        "OpenMD combined meta-data / cartesian coordinates format\nNo comments yet\n";
43 >        "OpenMD combined meta-data / cartesian coordinates format\n\
44 >        No comments yet\n";
45      };
46      
47      virtual const char* SpecificationURL()
48 <    {return "http://www.openmd.net";}; //optional
48 >    {return "http://www.openmd.org";}; //optional
49      
50      virtual const char* GetMIMEType()
51      {return "chemical/x-md"; };
# Line 82 | Line 83 | namespace OpenBabel
83      vector<bool> used(fragmentLists.size(), 0);
84      vector<vector<int> > molecules;
85      vector<int> indices;
86 <    for(int i =0; i < used.size(); ++i) {
86 >    for(std::size_t i =0; i < used.size(); ++i) {
87        if (used[i])
88          continue;
89  
# Line 91 | Line 92 | namespace OpenBabel
92        sameMolTypes.push_back(i);
93        indices.insert(indices.end(), fragmentLists[i].begin(),
94                       fragmentLists[i].end());
95 <      for (int j = i + 1;j < used.size(); ++j) {
95 >      for (std::size_t j = i + 1; j < used.size(); ++j) {
96          if (used[j])
97            continue;
98                  
# Line 128 | 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 170 | 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 194 | Line 198 | namespace OpenBabel
198      const int BUFFLEN = 1024;
199      char buffer[BUFFLEN];
200      string str, str1, str2, str3;
197    OBAtom *a, *b, *c, *d;    
201      bool molIsWater = false;
202      OBResidue *r;
200    int resKey, myserial;
201    char type_name[10];
202    char *element_name;
203    int res_num;
204    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  
214      chainParser->PerceiveChains(*pmol, false);
212        molIsWater = false;
213        FOR_RESIDUES_OF_MOL(residue, *pmol) {
217        std::cerr << "residue = " << residue->GetName() << "\n";
214          if (residue->GetName().compare("HOH") == 0) {
215            molIsWater = true;
216          }
# Line 227 | 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 350 | 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() << ");";
353            os << "}\n";
354            atomMap[&(*atom)] = ai++;
355          }        
# Line 388 | 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 414 | Line 411 | namespace OpenBabel
411      os << buffer << endl;
412      os << "    </FrameData>" << endl;
413      os << "    <StuntDoubles>" << endl;
414 <    
414 >        
415      OBAtom *atom;
416 <    
420 <    // still to do: intercept waters and recompute pvqj lines
421 <
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 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
Revision 2071 by gezelter, Sat Mar 7 21:41:51 2015 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines