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

Comparing trunk/OOPSE-4/src/applications/atom2md/oopseformat.cpp (file contents):
Revision 3445 by gezelter, Mon Jul 14 12:35:58 2008 UTC vs.
Revision 3446 by cli2, Wed Sep 10 19:51:45 2008 UTC

# Line 19 | Line 19 | GNU General Public License for more details.
19   #include <openbabel/obiter.h>
20   #include <openbabel/mol.h>
21   #include <openbabel/chains.h>
22 + #include <openbabel/data.h>
23   #include <fstream>
24  
25   #include "utils/StringUtils.hpp"
# Line 192 | Line 193 | namespace OpenBabel
193      unsigned int i;
194      const int BUFFLEN = 1024;
195      char buffer[BUFFLEN];
196 <    string str, str1;
196 >    string str, str1, str2, str3;
197      OBAtom *a, *b, *c, *d;    
198      bool molIsWater = false;
199      OBResidue *r;
200 <    int resKey;
200 >    int resKey, myserial;
201      char type_name[10];
202      char *element_name;
203      int res_num;
# Line 252 | Line 253 | namespace OpenBabel
253              
254              // If we know what residue we've got, the specific atom name can
255              // be used to help specify partial charges.
256 +
257 +            //resdat.SetResName(resName);
258              
259 +            // atom type from residue:
260              str = r->GetAtomID(&*atom);
261 +          
262 +            // arginine has separate indices for chemically-identical
263 +            // nitrogen atoms:
264 +            if (resName.compare("ARG") == 0) {
265 +              if (str.compare("NH1") == 0 || str.compare("NH2") == 0) {
266 +                str = "NH";
267 +              }
268 +            }
269 +            if (resName.compare("VAL") == 0) {
270 +              if (str.compare("CG1") == 0 || str.compare("CG2") == 0) {
271 +                str = "CG";
272 +              }
273 +            }
274 +            if (resName.compare("LEU") == 0) {
275 +              if (str.compare("CD1") == 0 || str.compare("CD2") == 0) {
276 +                str = "CD";
277 +              }
278 +            }
279 +            if (resName.compare("ASP") == 0) {
280 +              if (str.compare("OD1") == 0 || str.compare("OD2") == 0) {
281 +                str = "OD";
282 +              }
283 +            }
284 +            if (resName.compare("GLU") == 0) {
285 +              if (str.compare("OE1") == 0 || str.compare("OE2") == 0) {
286 +                str = "OE";
287 +              }
288 +            }
289 +            if (resName.compare("TYR") == 0) {
290 +              if (str.compare("CD1") == 0 || str.compare("CD2") == 0) {
291 +                str = "CD";
292 +              }
293 +              if (str.compare("CE1") == 0 || str.compare("CE2") == 0) {
294 +                str = "CE";
295 +              }
296 +            }
297 +            
298 +
299 +            if ((&*atom)->IsHydrogen()) {
300 +               FOR_NBORS_OF_ATOM(nbr, *atom) {
301 +                 str2 = r->GetAtomID(&*nbr);
302 +                 size_t startpos = str2.find_first_not_of(" ");
303 +                 size_t endpos = str2.find_last_not_of(" ");
304 +                 if ((endpos - startpos) < 1) {
305 +                   // if the bonded atom type has only one character (i.e. N)
306 +                   // then the hydrogen will be labeled "HN" to show what
307 +                   // kind of proton it is:
308 +                   str3 = str2;
309 +                 } else {
310 +                   if (str2.compare("OH") == 0) {
311 +                      str3 = "O";
312 +                   } else {
313 +                     // When the bonded atom type is more specific, we drop
314 +                     // the first character:  i.e. H bonded to OG1 is HG1 type:
315 +                     str3 = str2.substr(startpos+1, endpos-startpos);
316 +                   }
317 +                 }
318 +                str = "H" + str3;
319 +               }
320 +               // same problem with arginine NH atoms, but now for connected hydrogens
321 +               if (resName.compare("ARG") == 0) {
322 +                 if (str.compare("HH1") == 0 || str.compare("HH2") == 0) {
323 +                   str = "HH";
324 +                 }
325 +               }
326 +               if (resName.compare("VAL") == 0) {
327 +                 if (str.compare("HG1") == 0 || str.compare("HG2") == 0) {
328 +                   str = "HG";
329 +                 }
330 +               }
331 +               if (resName.compare("LEU") == 0) {
332 +                 if (str.compare("HD1") == 0 || str.compare("HD2") == 0) {
333 +                   str = "HD";
334 +                 }
335 +               }
336 +               if (resName.compare("TYR") == 0) {
337 +                 if (str.compare("HD1") == 0 || str.compare("HD2") == 0) {
338 +                   str = "HD";
339 +                 }
340 +                 if (str.compare("HE1") == 0 || str.compare("HE2") == 0) {
341 +                   str = "HE";
342 +                 }
343 +               }
344 +
345 +            }
346 +
347 +            // atom type from residue table:
348 +            //resdat.LookupType(str, str2, hyb);
349              size_t startpos = str.find_first_not_of(" ");
350              size_t endpos = str.find_last_not_of(" ");
351              str = str.substr( startpos, endpos-startpos+1 );

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines