public static void main(String[] args) throws MinimizerException, LineSearchException {
   init(args);
   CommandList commands = new CommandList(commandsFileName);
   Protein prot = new Protein(new AtomList(modelFileName), new ResidueExtendedAtoms(ADD_ATOMS));
   for (int cc = 0; cc < prot.atoms().size(); cc++) prot.atoms().atomAt(cc).setChain(" ");
   PutHydrogens.adjustHydrogens(commands, prot);
   AtomList shiftedList = createShiftedThreading(commands, prot, delta);
   try {
     shiftedList.print(new MeshiWriter(outputFileName));
   } catch (Exception e) {
     System.out.print("\nThere was a problem writing the PDB:\n" + e + "\n\nContinuing...\n\n");
   }
 }
  public static void main(String[] args) {
    init(args);

    Protein model = new ExtendedAtomsProtein(modelFileName, DO_NOT_ADD_ATOMS);
    boolean[] goodRes = new boolean[model.residues().size() + 1];
    for (int c = 0; c < goodRes.length; c++) goodRes[c] = false;
    Protein compareTo = new ExtendedAtomsProtein(compareToFileName, DO_NOT_ADD_ATOMS);
    String[] gaps = File2StringArray.f2a(gapsFileName);
    for (int gapC = 0; gapC < gaps.length; gapC++) {
      StringTokenizer st = new StringTokenizer(gaps[gapC]);
      int gapFrom = (new Integer(st.nextToken())).intValue();
      int gapTo = (new Integer(st.nextToken())).intValue();
      for (int predC = 0; predC < NumPredToConsider; predC++) {
        if ((new File(loopDirPath + "/Loop_" + gapFrom + "_" + gapTo + "/phase2/" + predC + ".pdb"))
            .exists()) {
          boolean[] goodInLoop = new boolean[gapTo + 1];
          AtomList gapAtoms =
              new AtomList(
                  loopDirPath + "/Loop_" + gapFrom + "_" + gapTo + "/phase2/" + predC + ".pdb");
          // Finding consistent atoms between loop and the 'compareTo' protein
          for (int resInLoop = gapFrom; resInLoop <= gapTo; resInLoop++) {
            if (compareTo.atoms().findAtomInList("CA", resInLoop) == null) {
              goodInLoop[resInLoop] = false;
            } else {
              goodInLoop[resInLoop] = false;
              if (compareTo.atoms().findAtomInList("CB", resInLoop) != null) { // NOT a Glycin
                if ((compareTo
                            .atoms()
                            .findAtomInList("CA", resInLoop)
                            .distanceFrom(gapAtoms.findAtomInList("CA", resInLoop))
                        < goodCutoff)
                    && (compareTo
                            .atoms()
                            .findAtomInList("CB", resInLoop)
                            .distanceFrom(gapAtoms.findAtomInList("CB", resInLoop))
                        < goodCutoff)) {
                  goodInLoop[resInLoop] = true;
                } else {
                  goodInLoop[resInLoop] = false;
                }
              } else {
                if (compareTo
                        .atoms()
                        .findAtomInList("CA", resInLoop)
                        .distanceFrom(gapAtoms.findAtomInList("CA", resInLoop))
                    < goodCutoff) {
                  goodInLoop[resInLoop] = true;
                } else {
                  goodInLoop[resInLoop] = false;
                }
              }
            }
          }

          // Analyzing data - is there a consistent pattern between the loops and the 'compareTo'
          // Protein.
          for (int resInLoop = gapFrom + 4; resInLoop <= (gapTo - 4); resInLoop++) {
            if (goodInLoop[resInLoop - 1] && goodInLoop[resInLoop] && goodInLoop[resInLoop + 1]) {
              goodRes[resInLoop - 1] = true;
              goodRes[resInLoop] = true;
              goodRes[resInLoop + 1] = true;
              System.out.println(
                  "The residues "
                      + (resInLoop - 1)
                      + " "
                      + (resInLoop)
                      + " "
                      + (resInLoop + 1)
                      + " were indicated by model "
                      + predC
                      + " from loop: "
                      + gapFrom
                      + "_"
                      + gapTo);
            }
          }
        }
      }
    }

    AtomList finalList = new AtomList();
    for (int c = 0; c < compareTo.atoms().size(); c++) {
      if (goodRes[compareTo.atoms().atomAt(c).residueNumber()])
        finalList.add(compareTo.atoms().atomAt(c));
    }

    try {
      finalList.print(new MeshiWriter(modelFileName + ".common.pdb"));
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }