Exemplo n.º 1
0
 void readAtoms(int atomCount, boolean iHaveCharges) throws Exception {
   // 1 Cs 0.0000 4.1230 0.0000 Cs 1 RES1 0.0000
   // 1 C1 7.0053 11.3096 -1.5429 C.3 1 <0> -0.1912
   // free format, but no blank lines
   for (int i = 0; i < atomCount; ++i) {
     Atom atom = atomSetCollection.addNewAtom();
     String[] tokens = getTokens(readLine());
     // Logger.debug(tokens.length + " -" + tokens[5] + "- " + line);
     atom.atomName = tokens[1];
     setAtomCoord(atom, parseFloat(tokens[2]), parseFloat(tokens[3]), parseFloat(tokens[4]));
     String elementSymbol = tokens[5];
     if (elementSymbol.length() > 1 && elementSymbol.charAt(1) == '.')
       elementSymbol = elementSymbol.substring(0, 1);
     if (elementSymbol.length() > 2) elementSymbol = elementSymbol.substring(0, 2);
     atom.elementSymbol = elementSymbol;
     // apparently "NO_CHARGES" is not strictly enforced
     // if (iHaveCharges)
     if (tokens.length > 8) atom.partialCharge = parseFloat(tokens[8]);
   }
 }