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 AtomList createShiftedThreading(CommandList commands, Protein prot, int delta) { AtomList newList = new AtomList(); Protein newProt; DistanceMatrix dm; DunbrackLib lib = new DunbrackLib(commands, 1.0, 90); // Copying the coordiantes to the new atoms. for (int resNum = Math.max( prot.residues().firstNonDummyResidueNumber(), prot.residues().firstNonDummyResidueNumber() - delta); resNum <= Math.min( ((Residue) prot.residues().last()).number, ((Residue) prot.residues().last()).number - delta); resNum++) { Atom atom = prot.atoms().findAtomInList("N", resNum + delta); if (atom != null) { Atom newAtom = new Atom( atom.x(), atom.y(), atom.z(), "N", prot.residue(resNum).nameThreeLetters(), resNum, -1); newList.add(newAtom); } atom = prot.atoms().findAtomInList("CA", resNum + delta); if (atom != null) { Atom newAtom = new Atom( atom.x(), atom.y(), atom.z(), "CA", prot.residue(resNum).nameThreeLetters(), resNum, -1); newList.add(newAtom); } atom = prot.atoms().findAtomInList("C", resNum + delta); if (atom != null) { Atom newAtom = new Atom( atom.x(), atom.y(), atom.z(), "C", prot.residue(resNum).nameThreeLetters(), resNum, -1); newList.add(newAtom); } atom = prot.atoms().findAtomInList("O", resNum + delta); if (atom != null) { Atom newAtom = new Atom( atom.x(), atom.y(), atom.z(), "O", prot.residue(resNum).nameThreeLetters(), resNum, -1); newList.add(newAtom); } atom = prot.atoms().findAtomInList("H", resNum + delta); if (atom != null) { Atom newAtom = new Atom( atom.x(), atom.y(), atom.z(), "H", prot.residue(resNum).nameThreeLetters(), resNum, -1); newList.add(newAtom); } } // Filling the atoms newProt = new Protein(newList, new ResidueExtendedAtoms(ADD_ATOMS)); // adjusting hydrogens and SCMODing dm = new DistanceMatrix(newProt.atoms(), 5.5, 2.0, 4); double[][] pp = RotamericTools.putIntoRot1(newProt, dm, lib); PutHydrogens.adjustHydrogens(commands, prot); newProt.defrost(); try { newProt.atoms().print(new MeshiWriter(outputFileName + ".rot1.pdb")); } catch (Exception e) { System.out.print("\nThere was a problem writing the PDB:\n" + e + "\n\nContinuing...\n\n"); } SCMOD.scmod(commands, lib, newProt, 2, 0.0, pp); // Final minimzation EnergyCreator[] energyCreators = { new BondCreator(1.0), new AngleCreator(1.0), new PlaneCreator(10.0), new OutOfPlaneCreator(1.0), new LennardJonesCreator(0.4), new SimpleHydrogenBond_Dahiyat_HighAccuracy_Creator(3.0), new RamachandranSidechainEnergyCreator(1.0) }; newProt.atoms().freeze(new AtomList.BackboneFilter()); dm = new DistanceMatrix(newProt.atoms(), 5.5, 2.0, 4); TotalEnergy energy = new TotalEnergy(newProt, dm, energyCreators, commands); Minimizer minimizer = new LBFGS(energy, 0.001, 50000, 1000); try { System.out.println(minimizer.minimize()); } catch (Exception e) { throw new RuntimeException("ERROR in minimization"); } // printing a LJ values histogram - Start // -------------------------------------- double firstBin = -1.0; double lastBin = 4.0; double binSpacing = 0.05; int[] bins = new int[(int) Math.ceil((lastBin - firstBin) / binSpacing)]; for (int c = 0; c < bins.length; c++) bins[c] = 0; energy.resetAtomEnergies(); LennardJones lj = (LennardJones) energy.getEnergyTerm(new LennardJones()); lj.evaluateAtoms(); double Elj = 0.0; int ind = 0; for (int at = 0; at < newProt.atoms().size(); at++) { Elj = newProt.atoms().atomAt(at).energy(); ind = (int) Math.round((Elj - firstBin) / binSpacing); if (ind < 0) ind = 0; if (ind >= bins.length) ind = bins.length - 1; bins[ind]++; } Elj = firstBin; for (int c = 0; c < bins.length; c++) { System.out.println("000 " + Elj + " " + bins[c]); Elj += binSpacing; } // -------------------------------------- // printing the LJ values histogram - END return newProt.atoms(); }