예제 #1
0
 private void addBondType(String line) {
   List<String> split = reworkLine(line);
   List<Bond> bondTypes = structure.getBondTypes();
   int length = split.size();
   BondImpl bt = new BondImpl();
   if (length >= 3) {
     bt.setAi(split.get(0));
     bt.setAj(split.get(1));
     bt.setFuncType(Integer.parseInt(split.get(2)));
   }
   if (length >= 5) {
     bt.setC1(new BigDecimal(split.get(3)));
     bt.setC2(new BigDecimal(split.get(4)));
   }
   if (length >= 6) {
     bt.setC3(new BigDecimal(split.get(5)));
   }
   if (length >= 7) {
     bt.setC4(new BigDecimal(split.get(6)));
   }
   if (length < 3 || length > 7) {
     ch.printErrorln(String.format("some BONDTYPES values are lost! --> %s", line));
   } else {
     bondTypes.add(bt);
   }
 }
예제 #2
0
 private void addBond(String line, Section actualSection) {
   if (actualSection != null) {
     List<String> split = reworkLine(line);
     List<Bond> bonds = actualSection.getBonds();
     int length = split.size();
     BondImpl b = new BondImpl();
     if (length >= 3) {
       b.setAi(split.get(0));
       b.setAj(split.get(1));
       b.setFuncType(Integer.parseInt(split.get(2)));
     }
     if (length >= 5) {
       b.setC1(new BigDecimal(split.get(3)));
       b.setC2(new BigDecimal(split.get(4)));
     }
     if (length >= 6) {
       b.setC3(new BigDecimal(split.get(5)));
     }
     if (length >= 7) {
       b.setC4(new BigDecimal(split.get(6)));
     }
     if (length < 3 || length > 7) {
       ch.printErrorln(String.format("some BONDS values are lost! --> %s", line));
     } else {
       bonds.add(b);
     }
   }
 }