Exemplo n.º 1
0
 private void addAtom(String line, Section actualSection) {
   if (actualSection != null) {
     List<String> split = reworkLine(line);
     List<Atom> atoms = actualSection.getAtoms();
     AtomImpl a = new AtomImpl();
     int length = split.size();
     if (length >= 7) {
       a.setNr(Integer.parseInt(split.get(0)));
       a.setType(split.get(1));
       a.setResNr(Integer.parseInt(split.get(2)));
       a.setResName(split.get(3));
       a.setAtomName(split.get(4));
       a.setChargeGroupNr(Integer.parseInt(split.get(5)));
       a.setC1(new BigDecimal(split.get(6)));
     }
     if (length >= 8) {
       a.setC2(new BigDecimal(split.get(7)));
     }
     if (length == 11) {
       a.setTypeB(split.get(8));
       a.setC3(new BigDecimal(split.get(9)));
       a.setC4(new BigDecimal(split.get(10)));
     }
     if (length < 7 || length > 11) {
       ch.printErrorln(String.format("some ATOMS values are lost! --> %s", line));
     } else {
       atoms.add(a);
     }
   }
 }
Exemplo n.º 2
0
  private void removeUnnecessaryData() {
    Set<AtomType> clear = Sets.newHashSet();
    List<Atom> atoms = Lists.newArrayList();
    List<AtomType> atomTypes = structure.getAtomTypes();

    for (Section section : structure.getSections()) {
      if (section.getSectionType().equals(SectionType.STRUCTUREDATA)) {
        atoms.addAll(section.getAtoms());
      }
    }
    for (AtomType atomType : atomTypes) {
      AtomType delete = atomType;
      for (Atom atom : atoms) {
        if (atomType.getName().contains(atom.getType())) {
          delete = null;
        }
      }
      if (delete != null) {
        clear.add(delete);
      }
    }
    clear.forEach(atomTypes::remove);
  }