Exemplo n.º 1
0
 private void addDihedralType(String line) {
   List<Dihedral> dihedralTypes = structure.getDihedralTypes();
   List<String> split = reworkLine(line);
   DihedralImpl dt = new DihedralImpl();
   int length = split.size();
   if (length == 6) {
     dt.setAi(split.get(0));
     dt.setAj(split.get(1));
     dt.setFuncType(Integer.parseInt(split.get(2)));
     dt.setC1(new BigDecimal(split.get(3)));
     dt.setC2(new BigDecimal(split.get(4)));
     dt.setC3(new BigDecimal(split.get(5)));
   } else if (length >= 7) {
     dt.setAi(split.get(0));
     dt.setAj(split.get(1));
     dt.setAk(split.get(2));
     dt.setAl(split.get(3));
     dt.setFuncType(Integer.parseInt(split.get(4)));
     dt.setC1(new BigDecimal(split.get(5)));
     dt.setC2(new BigDecimal(split.get(6)));
   }
   if (length >= 8) {
     dt.setC3(new BigDecimal(split.get(7)));
   }
   if (length >= 9) {
     dt.setC4(new BigDecimal(split.get(8)));
   }
   if (length >= 10) {
     dt.setC5(new BigDecimal(split.get(9)));
   }
   if (length == 11) {
     dt.setC6(new BigDecimal(split.get(10)));
   }
   if (length < 6 || length > 11) {
     ch.printErrorln(String.format("some DIHEDRALTYPES values are lost! --> %s", line));
   } else {
     dihedralTypes.add(dt);
   }
 }
Exemplo n.º 2
0
 private void addDihedral(String line, Section actualSection) {
   if (actualSection != null) {
     List<Dihedral> dihedrals = actualSection.getDihedrals();
     List<String> split = reworkLine(line);
     DihedralImpl dh = new DihedralImpl();
     int length = split.size();
     if (length >= 5) {
       dh.setAi(split.get(0));
       dh.setAj(split.get(1));
       dh.setAk(split.get(2));
       dh.setAl(split.get(3));
       dh.setFuncType(Integer.parseInt(split.get(4)));
     }
     if (length >= 7) {
       dh.setC1(new BigDecimal(split.get(5)));
       dh.setC2(new BigDecimal(split.get(6)));
     }
     if (length >= 8) {
       dh.setC3(new BigDecimal(split.get(7)));
     }
     if (length >= 9) {
       dh.setC4(new BigDecimal(split.get(8)));
     }
     if (length >= 10) {
       dh.setC5(new BigDecimal(split.get(9)));
     }
     if (length == 11) {
       dh.setC6(new BigDecimal(split.get(10)));
     }
     if (length < 5 || length > 11) {
       ch.printErrorln(String.format("some DIHEDRALS values are lost! --> %s", line));
     } else {
       dihedrals.add(dh);
     }
   }
 }