public static Universe Build(string pdbpath, string toppath, ITextLogger logger) { Pdb pdb = Pdb.FromFile(pdbpath); Top top = Top.FromFile(toppath); return(Build(pdb, top, logger)); }
public static bool GetModesSelftest() { if (GetModesSelftest_DoTest == false) { return(true); } GetModesSelftest_DoTest = false; string pdbpath = @"C:\Users\htna\htnasvn_htna\VisualStudioSolutions\Library2\HTLib2.Bioinfo\Bioinfo.Data\pdb\1MJC.pdb"; if (HFile.Exists(pdbpath) == false) { return(false); } Pdb pdb = Pdb.FromFile(pdbpath); for (int i = 0; i < pdb.atoms.Length; i++) { HDebug.Assert(pdb.atoms[0].altLoc == pdb.atoms[i].altLoc); HDebug.Assert(pdb.atoms[0].chainID == pdb.atoms[i].chainID); } List <Vector> coords = pdb.atoms.ListCoord(); double cutoff = 13; Matrix hess = Hess.GetHessAnm(coords.ToArray(), cutoff).ToArray(); Matrix modes; Vector freqs; GetModes(hess, out modes, out freqs); return(true); }
public static void Align(string pdbpath1, string pdbpath2, string alignedpath2) { Pdb pdb1 = Pdb.FromFile(pdbpath1); List <Pdb.Atom> atoms1 = pdb1.atoms.SelectByChainID().SelectByAltLoc(); Pdb pdb2 = Pdb.FromFile(pdbpath2); List <Pdb.Atom> atoms2 = pdb2.atoms.SelectByChainID().SelectByAltLoc(); Align(atoms1, ref atoms2); Pdb.ToFile(alignedpath2, atoms2); }
public static AlignData FromFiles(string path_pdb, string path_hess, IList <double> masses, string cachebase = null) { AlignData data = new AlignData(); data.pdb = Pdb.FromFile(path_pdb); data.coords = data.pdb.atoms.ListCoord(); data.cachebase = cachebase; int n = data.coords.Count; { // data.hess List <string> lines = HFile.ReadLines(path_hess).ToList(); int row, col; { string[] tokens = lines[1].Split(new char[] { ' ', ',', '\t' }, StringSplitOptions.RemoveEmptyEntries); HDebug.Assert(tokens.Length == 2); row = int.Parse(tokens[0]); col = int.Parse(tokens[1]); HDebug.Assert(row == col); } HDebug.Assert(row == n * 3, col == n * 3); MatrixByArr[,] hess = new MatrixByArr[n, n]; for (int c = 0; c < n; c++) { for (int r = 0; r < n; r++) { hess[c, r] = new double[3, 3]; } } for (int c = 0; c < col; c++) { string line = lines[c + 2]; string[] tokens = line.Split(new char[] { ' ', ',', '\t' }, StringSplitOptions.RemoveEmptyEntries); HDebug.Assert(tokens.Length == row); for (int r = 0; r < row; r++) { double val = double.Parse(tokens[r]); hess[c / 3, r / 3][c % 3, r % 3] += val; hess[r / 3, c / 3][r % 3, c % 3] += val; } } for (int c = 0; c < n; c++) { for (int r = 0; r < n; r++) { hess[c, r] /= 2; } } data.hess = hess; } data.masses = masses.ToArray(); return(data); }
public static void SelfTest(string rootpath, string[] args) { { Pdb pdb = Pdb.FromFile(rootpath + @"\Sample\alanin.pdb"); List <Vector> coords = pdb.atoms.ListCoord(); coords[0] = new Vector(0, 1, 2); pdb.ToFile(rootpath + @"\Sample\alanin.updated.pdb", coords); } { Pdb pdb = Pdb.FromFile(rootpath + @"\Sample\1a6g.pdb"); //pdb.CollectResidues(); } }
public static Pdb FromPdbid (string pdbid , string cachebase // null or @"K:\PdbUnzippeds\$PDBID$.pdb" , bool?download // null or false ) { if (cachebase == null) { cachebase = @"K:\PdbUnzippeds\$PDBID$.pdb"; } if (download == null) { download = false; } string pdbpath = cachebase.Replace("$PDBID$", pdbid); if (HFile.Exists(pdbpath)) { var pdb = Pdb.FromFile(pdbpath); var last = pdb.elements.Last(); if (last is Pdb.End) { return(pdb); } if (last.line.Length == 80) { return(pdb); } if (download.Value) { // redownload pdb = Pdb.FromPdbid(pdbid); pdb.ToFile(pdbpath); } return(pdb); } else if (download.Value) { Pdb pdb = Pdb.FromPdbid(pdbid); if (pdb != null) { pdb.ToFile(pdbpath); return(pdb); } } return(null); }
public static bool GetBFactorSelfTest(string pdbpath, double cutoff, double corr, int round, InfoPack extra) { if (HFile.Exists(pdbpath) == false) { return(false); } Pdb pdb = Pdb.FromFile(pdbpath); for (int i = 0; i < pdb.atoms.Length; i++) { HDebug.Assert(pdb.atoms[0].altLoc == pdb.atoms[i].altLoc); HDebug.Assert(pdb.atoms[0].chainID == pdb.atoms[i].chainID); } List <Pdb.Atom> atoms = new List <Pdb.Atom>(); for (int i = 0; i < pdb.atoms.Length; i++) { Pdb.Atom atom = pdb.atoms[i]; if (atom.name.Trim().ToUpper() == "CA") { atoms.Add(atom); } } List <Vector> coords = atoms.ListCoord(); Matrix hess = Hess.GetHessAnm(coords, cutoff); InfoPack lextra = new InfoPack(); Vector bfactor = GetBFactor(hess, 0.00000001, null, lextra); if (extra != null) { extra["num_zero_eigvals"] = lextra["num_zero_eigvals"]; extra["eigenvalues"] = lextra["eigenvalues"]; } double corr_comp = pdb.CorrBFactor(atoms.ListName(), atoms.ListResSeq(), bfactor.ToArray()); corr_comp = Math.Round(corr_comp, round); HDebug.Assert(corr == corr_comp); return(corr == corr_comp); }
public static Top FromPdb(string pdbpath , string ff = "charmm27" , string water = "none" , HPack <Pdb> optout_confout = null ) { Top top; FileInfo pdbinfo = new FileInfo(pdbpath); string currdir = HEnvironment.CurrentDirectory; DirectoryInfo temproot = HDirectory.CreateTempDirectory(); HEnvironment.CurrentDirectory = temproot.FullName; { HFile.Copy(pdbinfo.FullName, "protein.pdb"); RunPdb2gmx(f: "protein.pdb" , o: "confout.pdb" , p: "topol.top" , q: "clean.pdb" , ff: ff , water: water , merge: "all" , lineStderr: null , lineStdout: null ); top = Top.FromFile("topol.top"); if (optout_confout != null) { optout_confout.value = Pdb.FromFile("confout.pdb"); } } HEnvironment.CurrentDirectory = currdir; Thread.Sleep(100); try{ temproot.Delete(true); } catch (Exception) {} return(top); }
public bool LoadCoordsFromPdb(string path) { Pdb pdb = Pdb.FromFile(path); HDebug.Assert(this.pdb.atoms.Length == pdb.atoms.Length); HDebug.Assert(this.size == pdb.atoms.Length); Vector[] coords = new Vector[size]; for (int i = 0; i < size; i++) { if (this.pdb.atoms[i].name != pdb.atoms[i].name) { return(false); } if (this.pdb.atoms[i].resName != pdb.atoms[i].resName) { return(false); } coords[i] = pdb.atoms[i].coord; } SetCoords(coords); return(true); }
public static Universe Build(string xyzpath, bool loadxyzLatest, string prmpath, string pdbpath) { Tinker.Xyz xyz = Tinker.Xyz.FromFile(xyzpath, false); Tinker.Xyz xyz1 = Tinker.Xyz.FromFile(xyzpath, loadxyzLatest); Tinker.Prm prm = Tinker.Prm.FromFile(prmpath); Pdb pdb = Pdb.FromFile(pdbpath); Universe univ = Build(xyz, prm, pdb, 0.002); if (HDebug.IsDebuggerAttached) { HDebug.Assert(xyz.atoms.Length == univ.size); Vector[] xyzcoords = xyz.atoms.HListCoords(); Vector[] unvcoords = univ.GetCoords(); for (int i = 0; i < univ.size; i++) { Vector dcoord = xyzcoords[i] - unvcoords[i]; HDebug.AssertTolerance(0.00000001, dcoord); } } univ.SetCoords(xyz1.atoms.HListCoords()); return(univ); }
public static void GetPotential_SelfTest(string rootpath, string[] args) { if (GetPotential_SelfTest_do == false) { return; } GetPotential_SelfTest_do = false; Namd.Psf psf = Namd.Psf.FromFile(rootpath + @"\Sample\alanin.psf"); Pdb pdb = Pdb.FromFile(rootpath + @"\Sample\alanin.pdb"); Namd.Prm prm = Namd.Prm.FromFileXPlor(rootpath + @"\Sample\alanin.params", new TextLogger()); Universe univ = Universe.Build(psf, prm, pdb, false); List <ForceField.IForceField> frcflds = ForceField.GetMindyForceFields(); Vector[] forces = univ.GetVectorsZero(); MatrixByArr hessian = null; Dictionary <string, object> cache = new Dictionary <string, object>(); double energy = univ.GetPotential(frcflds, ref forces, ref hessian, cache); double toler = 0.000005; HDebug.AssertTolerance(toler, SelfTest_alanin_energy - energy); HDebug.AssertTolerance(toler, SelfTest_alanin_energy_bonds - (double)cache["energy_bonds "]); HDebug.AssertTolerance(toler, SelfTest_alanin_energy_angles - (double)cache["energy_angles "]); HDebug.AssertTolerance(toler, SelfTest_alanin_energy_dihedrals - (double)cache["energy_dihedrals "]); HDebug.AssertTolerance(toler, SelfTest_alanin_energy_impropers - (double)cache["energy_impropers "]); HDebug.AssertTolerance(toler, SelfTest_alanin_energy_nonbondeds - (double)cache["energy_nonbondeds"]); HDebug.AssertTolerance(toler, SelfTest_alanin_energy_unknowns - (double)cache["energy_customs "]); HDebug.AssertTolerance(toler, SelfTest_alanin_forces.GetLength(0) - forces.Length); for (int i = 0; i < forces.Length; i++) { HDebug.Assert(forces[i].Size == 3); HDebug.AssertTolerance(toler, SelfTest_alanin_forces[i, 0] - forces[i][0]); HDebug.AssertTolerance(toler, SelfTest_alanin_forces[i, 1] - forces[i][1]); HDebug.AssertTolerance(toler, SelfTest_alanin_forces[i, 2] - forces[i][2]); } }
public static List <string> Convert_PdbWaterBox_To_XyzWaterBox (string path_solvbox_pdb //= @"K:\Temp\solvate\solvbox100.pdb"; ) { Pdb pdb = Pdb.FromFile(path_solvbox_pdb); var atoms = pdb.atoms; HDebug.Assert(atoms.Length == 783_198); string format_id = " {0,6}"; string format_coord = " {0,11:0.000000}"; List <string> lines = new List <string>(); lines.Add(string.Format(format_id, atoms.Length)); for (int i = 0; i < atoms.Length; i++) { var atom = atoms[i]; int id = i + 1; //Tinker.Xyz.Atom string sId = string.Format(format_id, id); string sAtomType = null; string sCoord = string.Format(format_coord, atom.x) + string.Format(format_coord, atom.y) + string.Format(format_coord, atom.z); string sAtomId = null; string sBondedId = null; switch (i % 3) { case 0: { HDebug.Assert(atom.name == " OH2"); sAtomType = " OT "; sAtomId = " 101"; sBondedId = string.Format(format_id, id + 1) + string.Format(format_id, id + 2); //ATOM 1 OH2 TIP3W 1 -39.757 -43.987 -44.549 1.00 0.00 WT1 O //ATOM 2 H1 TIP3W 1 -38.939 -43.594 -44.737 1.00 0.00 WT1 H //ATOM 3 H2 TIP3W 1 -39.487 -44.929 -44.474 1.00 0.00 WT1 H // 36944 OT 26.427752 -2.676966 -11.003556 101 36945 36946 // 36945 HT 25.722690 -1.988586 -10.960428 88 36944 // 36946 HT 25.928766 -3.441458 -11.365251 88 36944 } break; case 1: { HDebug.Assert(atom.name == " H1 "); sAtomType = " HT "; sAtomId = " 88"; sBondedId = string.Format(format_id, id - 1); } break; case 2: { HDebug.Assert(atom.name == " H2 "); sAtomType = " HT "; sAtomId = " 88"; sBondedId = string.Format(format_id, id - 2); } break; } HDebug.Assert(sId != null); HDebug.Assert(sAtomType != null); HDebug.Assert(sCoord != null); HDebug.Assert(sAtomId != null); HDebug.Assert(sBondedId != null); string line = sId + sAtomType + sCoord + sAtomId + sBondedId; lines.Add(line); } //HFile.WriteAllLines(path_solvbox_pdb.Replace(".pdb",".xyz"), lines); return(lines); }
public static void Main (string[] args , string[] hesstypes , double[] threszeroblks ) { string cachebase = @"K:\cache\CoarseGraining-20150111\proteins-177\"; string lockbase = cachebase + @"lock\"; if (HDirectory.Exists(lockbase) == false) { HDirectory.CreateDirectory(lockbase); } Dictionary <string, List <Tuple <double, double, double[]> > > data = new Dictionary <string, List <Tuple <double, double, double[]> > >(); foreach (string pdbid in pdbids) { if (locks.ContainsKey(pdbid) == false) { var filelock = HFile.LockFile(lockbase + pdbid); if (filelock == null) { System.Console.WriteLine("{0} is locked", pdbid); continue; } locks.Add(pdbid, filelock); } string pathbase = cachebase + pdbid + @"\"; // load univ var pdb0 = Pdb.FromFile(pathbase + "xry-struc.pdb"); var xyz0 = Tinker.Xyz.FromFile(pathbase + "xry-struc.xyz", false); var xyz1 = Tinker.Xyz.FromFile(pathbase + "min-struc-charmm22.xyz", false); var prm = Tinker.Prm.FromFile(cachebase + "charmm22.prm"); if (HFile.Exists(pathbase + "min-struc-charmm22-screened.xyz") == false) { var newton = Tinker.Run.Newton (xyz1, prm, tempbase , null // copytemp , "A 0.0001" // param , null // atomsToFix , false , "CUTOFF 9", "TAPER" ); newton.minxyz.ToFile(pathbase + "min-struc-charmm22-screened.xyz", false); } var xyz2 = Tinker.Xyz.FromFile(pathbase + "min-struc-charmm22-screened.xyz", false); Universe univ = Universe.BuilderTinker.Build(xyz1, prm, pdb0, xyz0, 0.001); Universe univ_scrn = Universe.BuilderTinker.Build(xyz2, prm, pdb0, xyz0, 0.001); if (HDebug.IsDebuggerAttached) { var grad = Tinker.Run.Testgrad(xyz1, prm, tempbase); var forc = grad.anlyts.GetForces(xyz1.atoms); var mforc = forc.Dist().Max(); HDebug.Assert(mforc < 0.1); grad = Tinker.Run.Testgrad(xyz2, prm, tempbase, new string[] { "CUTOFF 9", "TAPER" } , optOutSource: null ); forc = grad.anlyts.GetForces(xyz1.atoms); mforc = forc.Dist().Max(); HDebug.Assert(mforc < 0.1); } System.Console.Write(pdbid + " : "); foreach (string hesstype in hesstypes) { foreach (double threszeroblk in threszeroblks) { double GetHessCoarseResiIter_thres_zeroblk = threszeroblk; Tuple <double, double, double[]> corr_wovlp_ovlps = GetQuality(pathbase, univ, univ_scrn, hesstype, GetHessCoarseResiIter_thres_zeroblk); if (corr_wovlp_ovlps == null) { System.Console.Write(hesstype + "(Unknown exception ), "); continue; } System.Console.Write(hesstype + "("); System.Console.Write("thod " + threszeroblk + " : "); System.Console.Write("corr {0,6:0.0000}, ", corr_wovlp_ovlps.Item1); System.Console.Write("wovlp {0,6:0.0000} : ", corr_wovlp_ovlps.Item2); System.Console.Write("{0}), ", corr_wovlp_ovlps.Item3.HToStringSeparated("{0,4:0.00}", ",")); string datakey = hesstype + "-" + threszeroblk; if (data.ContainsKey(datakey) == false) { data.Add(datakey, new List <Tuple <double, double, double[]> >()); } data[datakey].Add(corr_wovlp_ovlps); } } System.Console.WriteLine(); } System.Console.WriteLine("================================================================================================="); System.Console.Write("avg : "); foreach (string hesstype in hesstypes) { foreach (double threszeroblk in threszeroblks) { string datakey = hesstype + "-" + threszeroblk; List <Tuple <double, double, double[]> > datai = data[datakey]; double[] lst_corr = datai.HListItem1().ToArray(); double[] lst_wovlp = datai.HListItem2().ToArray(); double[][] lst_ovlps = datai.HListItem3().ToArray(); double corr = lst_corr.HRemoveAll(double.NaN).Average(); double wovlp = lst_wovlp.HRemoveAll(double.NaN).Average(); double[] ovlps = new double[10]; for (int i = 0; i < 10; i++) { double[] lst_ovlpsi = new double[lst_ovlps.Length]; for (int j = 0; j < lst_ovlps.Length; j++) { lst_ovlpsi[j] = lst_ovlps[j][i]; } ovlps[i] = lst_ovlpsi.HRemoveAll(double.NaN).Average(); } System.Console.Write(hesstype + "("); System.Console.Write("thod " + threszeroblk + " : "); System.Console.Write("corr {0,6:0.0000}, ", corr); System.Console.Write("wovlp {0,6:0.0000} : ", wovlp); System.Console.Write("{0}), ", ovlps.HToStringSeparated("{0,4:0.00}", ",")); } } System.Console.WriteLine(); System.Console.Write("min : "); foreach (string hesstype in hesstypes) { foreach (double threszeroblk in threszeroblks) { string datakey = hesstype + "-" + threszeroblk; List <Tuple <double, double, double[]> > datai = data[datakey]; double[] lst_corr = datai.HListItem1().ToArray(); double[] lst_wovlp = datai.HListItem2().ToArray(); double[][] lst_ovlps = datai.HListItem3().ToArray(); double corr = lst_corr.HRemoveAll(double.NaN).Min(); double wovlp = lst_wovlp.HRemoveAll(double.NaN).Min(); double[] ovlps = new double[10]; for (int i = 0; i < 10; i++) { double[] lst_ovlpsi = new double[lst_ovlps.Length]; for (int j = 0; j < lst_ovlps.Length; j++) { lst_ovlpsi[j] = lst_ovlps[j][i]; } ovlps[i] = lst_ovlpsi.HRemoveAll(double.NaN).Min(); } System.Console.Write(hesstype + "("); System.Console.Write("thod " + threszeroblk + " : "); System.Console.Write("corr {0,6:0.0000}, ", corr); System.Console.Write("wovlp {0,6:0.0000} : ", wovlp); System.Console.Write("{0}), ", ovlps.HToStringSeparated("{0,4:0.00}", ",")); } } System.Console.WriteLine(); System.Console.Write("#miss: "); foreach (string hesstype in hesstypes) { foreach (double threszeroblk in threszeroblks) { string datakey = hesstype + "-" + threszeroblk; List <Tuple <double, double, double[]> > datai = data[datakey]; double[] lst_corr = datai.HListItem1().ToArray(); double[] lst_wovlp = datai.HListItem2().ToArray(); double[][] lst_ovlps = datai.HListItem3().ToArray(); int cnt_corr = lst_corr.Length - lst_corr.HRemoveAll(double.NaN).Length; int cnt_wovlp = lst_wovlp.Length - lst_wovlp.HRemoveAll(double.NaN).Length; int[] cnt_ovlps = new int[10]; for (int i = 0; i < 10; i++) { double[] lst_ovlpsi = new double[lst_ovlps.Length]; for (int j = 0; j < lst_ovlps.Length; j++) { lst_ovlpsi[j] = lst_ovlps[j][i]; } cnt_ovlps[i] = lst_ovlpsi.Length - lst_ovlpsi.HRemoveAll(double.NaN).Length; } System.Console.Write(hesstype + "("); System.Console.Write("thod " + threszeroblk + " : "); System.Console.Write("corr {0,6}, ", cnt_corr); System.Console.Write("wovlp {0,6} : ", cnt_wovlp); System.Console.Write("{0}), ", cnt_ovlps.HToStringSeparated("{0,4}", ",")); } } System.Console.WriteLine(); }
public static void SelfTest(string pdbname, string psfname, string prmname, string xyzname) { using (var temp = new HTempDirectory(@"C:\temp\", null)) { temp.EnterTemp(); { string resbase = "HTLib2.Bioinfo.HTLib2.Bioinfo.External.Tinker.Resources.selftest."; HResource.CopyResourceTo <Tinker>(resbase + pdbname, pdbname); HResource.CopyResourceTo <Tinker>(resbase + psfname, psfname); HResource.CopyResourceTo <Tinker>(resbase + "par_all27_prot_lipid.inp", prmname); if (xyzname != null) { HResource.CopyResourceTo <Tinker>(resbase + xyzname, xyzname); } HResource.CopyResourceTo <Tinker>(resbase + "charmm22.prm", "charmm22.prm"); { var pdb = Pdb.FromFile(pdbname); var psf = Namd.Psf.FromFile(psfname); var prm = Namd.Prm.FromFile(prmname); var xyz_prm = BuildFromNamd(pdb, psf, prm); xyz_prm.Item1.ToFile("TinkFromNamd.xyz", false); xyz_prm.Item2.ToFile("TinkFromNamd.prm"); } if (xyzname != null) { var xyz0 = Xyz.FromFile("TinkFromNamd.xyz", false); var prm0 = Prm.FromFile("TinkFromNamd.prm"); var grad0 = Run.Testgrad(xyz0, prm0, @"C:\temp\" //, "VDWTERM NONE" //, "CHARGETERM NONE" //, "BONDTERM NONE" //, "ANGLETERM NONE" //, "UREYTERM NONE" //, "IMPROPTERM NONE" //, "TORSIONTERM NONE" ); var forc0 = grad0.anlyts.GetForces(xyz0.atoms); var xyz1 = Xyz.FromFile(xyzname, false); var prm1 = Prm.FromFile("charmm22.prm"); var grad1 = Run.Testgrad(xyz1, prm1, @"C:\temp\" //, "VDWTERM NONE" //, "CHARGETERM NONE" //, "BONDTERM NONE" //, "ANGLETERM NONE" //, "UREYTERM NONE" //, "IMPROPTERM NONE" //, "TORSIONTERM NONE" ); var forc1 = grad1.anlyts.GetForces(xyz1.atoms); { KDTree.KDTree <object> kdtree = new KDTree.KDTree <object>(3); var atoms0 = xyz0.atoms; for (int i = 0; i < atoms0.Length; i++) { kdtree.insert(atoms0[i].Coord, i); } var atoms1 = xyz1.atoms; int[] idx1to0 = new int[atoms1.Length]; for (int i1 = 0; i1 < atoms1.Length; i1++) { Vector coord1 = atoms1[i1].Coord; int i0 = (int)kdtree.nearest(coord1); Vector coord0 = atoms0[i0].Coord; kdtree.delete(coord0); idx1to0[i0] = i1; } atoms1 = atoms1.HSelectByIndex(idx1to0); forc1 = forc1.HSelectByIndex(idx1to0); } Vector[] dforc = VectorBlock.PwSub(forc0, forc1).ToArray(); double[] dforcl = dforc.Dist(); double max_dforc = dforc.Dist().Max(); HDebug.Exception(max_dforc < 1); // 0.72682794387667848 { double EB = Math.Abs(grad0.enrgCmpnt.EB - grad1.enrgCmpnt.EB); HDebug.Exception(EB < 0.1); double EA = Math.Abs(grad0.enrgCmpnt.EA - grad1.enrgCmpnt.EA); HDebug.Exception(EA < 0.1); double EBA = Math.Abs(grad0.enrgCmpnt.EBA - grad1.enrgCmpnt.EBA); HDebug.Exception(EBA < 0.1); double EUB = Math.Abs(grad0.enrgCmpnt.EUB - grad1.enrgCmpnt.EUB); HDebug.Exception(EUB < 0.1); double EAA = Math.Abs(grad0.enrgCmpnt.EAA - grad1.enrgCmpnt.EAA); HDebug.Exception(EAA < 0.1); double EOPB = Math.Abs(grad0.enrgCmpnt.EOPB - grad1.enrgCmpnt.EOPB); HDebug.Exception(EOPB < 0.1); double EOPD = Math.Abs(grad0.enrgCmpnt.EOPD - grad1.enrgCmpnt.EOPD); HDebug.Exception(EOPD < 0.1); double EID = Math.Abs(grad0.enrgCmpnt.EID - grad1.enrgCmpnt.EID); HDebug.Exception(EID < 0.1); // 0.0019000000000000128 : N-terminus (and C-terminus) information is/are inconsistent betweeen namd-charmm and tink-charmm22 double EIT = Math.Abs(grad0.enrgCmpnt.EIT - grad1.enrgCmpnt.EIT); HDebug.Exception(EIT < 0.1); double ET = Math.Abs(grad0.enrgCmpnt.ET - grad1.enrgCmpnt.ET); HDebug.Exception(ET < 0.5); // 0.33029999999999404 : N-terminus (and C-terminus) information is/are inconsistent betweeen namd-charmm and tink-charmm22 double EPT = Math.Abs(grad0.enrgCmpnt.EPT - grad1.enrgCmpnt.EPT); HDebug.Exception(EPT < 0.1); double EBT = Math.Abs(grad0.enrgCmpnt.EBT - grad1.enrgCmpnt.EBT); HDebug.Exception(EBT < 0.1); double ETT = Math.Abs(grad0.enrgCmpnt.ETT - grad1.enrgCmpnt.ETT); HDebug.Exception(ETT < 0.1); double EV = Math.Abs(grad0.enrgCmpnt.EV - grad1.enrgCmpnt.EV); HDebug.Exception(EV < 0.1); double EC = Math.Abs(grad0.enrgCmpnt.EC - grad1.enrgCmpnt.EC); HDebug.Exception(EC < 0.5); // 0.37830000000002428 double ECD = Math.Abs(grad0.enrgCmpnt.ECD - grad1.enrgCmpnt.ECD); HDebug.Exception(ECD < 0.1); double ED = Math.Abs(grad0.enrgCmpnt.ED - grad1.enrgCmpnt.ED); HDebug.Exception(ED < 0.1); double EM = Math.Abs(grad0.enrgCmpnt.EM - grad1.enrgCmpnt.EM); HDebug.Exception(EM < 0.1); double EP = Math.Abs(grad0.enrgCmpnt.EP - grad1.enrgCmpnt.EP); HDebug.Exception(EP < 0.1); double ER = Math.Abs(grad0.enrgCmpnt.ER - grad1.enrgCmpnt.ER); HDebug.Exception(ER < 0.1); double ES = Math.Abs(grad0.enrgCmpnt.ES - grad1.enrgCmpnt.ES); HDebug.Exception(ES < 0.1); double ELF = Math.Abs(grad0.enrgCmpnt.ELF - grad1.enrgCmpnt.ELF); HDebug.Exception(ELF < 0.1); double EG = Math.Abs(grad0.enrgCmpnt.EG - grad1.enrgCmpnt.EG); HDebug.Exception(EG < 0.1); double EX = Math.Abs(grad0.enrgCmpnt.EX - grad1.enrgCmpnt.EX); HDebug.Exception(EX < 0.1); } } } temp.QuitTemp(); } //{ // //string pathbase = @"C:\Users\htna.IASTATE\svn\htnasvn_htna\Research.bioinfo.prog.NAMD\1A6G\New folder\"; // string pathbase = @"C:\Users\htna.IASTATE\svn\htnasvn_htna\Research.bioinfo.prog.NAMD\1A6G\"; // string toplbase = @"C:\Users\htna.IASTATE\svn\htnasvn_htna\Research.bioinfo.prog.NAMD\top_all27_prot_lipid\"; // var pdb = Pdb .FromFile(pathbase+"1A6G.psfgen.pdb"); // var psf = Namd.Psf.FromFile(pathbase+"1A6G.psfgen.psf"); // var prm = Namd.Prm.FromFile(toplbase+"par_all27_prot_na.prm"); // // pdb = Pdb .FromFile(@"K:\Tim-8TIM,1TPH,1M6J\Tim-1M6J\1M6J.psfgen.pdb"); // psf = Namd.Psf.FromFile(@"K:\Tim-8TIM,1TPH,1M6J\Tim-1M6J\1M6J.psfgen.psf"); // prm = Namd.Prm.FromFile(@"K:\Tim-8TIM,1TPH,1M6J\Tim-1M6J\par_all27_prot_lipid.inp"); // var xyz_prm = BuildFromNamd(pdb, psf, prm); // xyz_prm.Item1.ToFile(@"C:\temp\TinkFromNamd.xyz", false); // xyz_prm.Item2.ToFile(@"C:\temp\TinkFromNamd.prm"); //} }
public static void SelfTest(string rootpath, string[] args) { //{ // Pdb pdb = Pdb.FromFile(rootpath + @"\Sample\1a6g.pdb"); // HTLib2.Bioinfo.Universe.Build(pdb); //} GetPotential_SelfTest(rootpath, args); Universe univ = null; string sample = null; //sample = "1a6g_autopsf.unfolded"; //sample = "1a6g_autopsf"; switch (sample) { case "alanin": { List <ForceField.IForceField> frcflds = ForceField.GetMindyForceFields(); double k = 0.0001; double threshold = 0.001; //int iter = univ.Minimize_ConjugateGradient_v0(frcflds, k, threshold); int randomPurturb = 0; // no random purturbation bool[] atomsMovable = null; // update all atoms int iter_conjgrad; { Namd.Psf psf = Namd.Psf.FromFile(rootpath + @"\Sample\alanin.psf"); Pdb pdb = Pdb.FromFile(rootpath + @"\Sample\alanin.pdb"); Namd.Prm prm = Namd.Prm.FromFileXPlor(rootpath + @"\Sample\alanin.params", new TextLogger()); univ = Universe.Build(psf, prm, pdb, false); //frcflds = new List<ForceField.IForceField>(); //frcflds.Add(new ForceField.MindyBond()); //frcflds.Add(new ForceField.MindyAngle()); //frcflds.Add(new ForceField.MindyDihedral()); //frcflds.Add(new ForceField.MindyImproper()); //frcflds.Add(new ForceField.MindyNonbondedLennardJones()); //frcflds.Add(new ForceField.MindyNonbondedElectrostatic()); //iter_conjgrad = univ.Minimize_ConjugateGradient_v1(0, frcflds, k, 0.1, null, threshold, randomPurturb, atomsMovable, new MinimizeLogger_PrintEnergyForceMag(), null, null); //frcflds = new List<ForceField.IForceField>(); //frcflds.Add(new ForceField.MindyBond()); //frcflds.Add(new ForceField.MindyAngle()); //frcflds.Add(new ForceField.MindyImproper()); //frcflds.Add(new ForceField.MindyNonbondedLennardJones()); //frcflds.Add(new ForceField.MindyNonbondedElectrostatic()); //iter_conjgrad = univ.Minimize_ConjugateGradient_v1(0, frcflds, k*0.1, 0.1, null, threshold, randomPurturb, atomsMovable, new MinimizeLogger_PrintEnergyForceMag(), null, null); frcflds = new List <ForceField.IForceField>(); if (HDebug.False) { frcflds.Add(new ForceField.MindyBond()); } else { frcflds.Add(new ForceField.PwBond()); } if (HDebug.False) { frcflds.Add(new ForceField.MindyAngle()); } else { frcflds.Add(new ForceField.PwAngle()); } frcflds.Add(new ForceField.MindyDihedral()); if (HDebug.False) { frcflds.Add(new ForceField.MindyImproper()); } else { frcflds.Add(new ForceField.PwImproper()); } if (HDebug.False) { frcflds.Add(new ForceField.MindyNonbondedElectrostatic()); } else { frcflds.Add(new ForceField.PwElec()); } if (HDebug.False) { frcflds.Add(new ForceField.MindyNonbondedLennardJones()); } else { frcflds.Add(new ForceField.PwVdw()); } univ.LoadCoords(@"D:\xxxx.coords"); iter_conjgrad = univ.Minimize_ConjugateGradient_v1(0, frcflds, k, 0.01, null, threshold, randomPurturb, atomsMovable, new MinimizeLogger_PrintEnergyForceMag(), null, null); univ.SaveCoords(@"D:\xxxx.coords"); System.Console.WriteLine("======================================================================="); System.Console.WriteLine("======================================================================="); System.Console.WriteLine("======================================================================="); } { //Psf psf = Psf.FromFile(rootpath + @"\Sample\alanin.psf"); //Pdb pdb = Pdb.FromFile(rootpath + @"\Sample\alanin.pdb"); //Prm prm = Prm.FromFileXPlor(rootpath + @"\Sample\alanin.params", new TextLogger()); //univ = Universe.Build(psf, prm, pdb); //frcflds = new List<ForceField.IForceField>(); //if(true) frcflds.Add(new ForceField.MindyBond()); else frcflds.Add(new ForceField.PwBond()); //if(true) frcflds.Add(new ForceField.MindyAngle()); else frcflds.Add(new ForceField.PwAngle()); //frcflds.Add(new ForceField.MindyDihedral()); //if(true) frcflds.Add(new ForceField.MindyImproper()); else frcflds.Add(new ForceField.PwImproper()); //if(true) frcflds.Add(new ForceField.MindyNonbondedElectrostatic()); else frcflds.Add(new ForceField.PwElec()); //if(true) frcflds.Add(new ForceField.MindyNonbondedLennardJones()); else frcflds.Add(new ForceField.PwVdw()); univ.atoms[0].Coord += new Vector(0.1, 0.1, 0.1); //iter_conjgrad = univ.Minimize_ConjugateGradient_v1(0, frcflds, k, 0.001, null, threshold, randomPurturb, atomsMovable, new MinimizeLogger_PrintEnergyForceMag(), null, null); iter_conjgrad = univ.Minimize_ConjugateGradient_AtomwiseUpdate(frcflds, threshold: threshold, k: k, max_atom_movement: 0.001, max_iteration: null, atomsMovable: atomsMovable, logger: new MinimizeLogger_PrintEnergyForceMag() ); } k = 0.0005; HDebug.Assert(false); //int iter_stepdsnt = univ.Minimize_SteepestDescent(frcflds, k, threshold, System.Console.Error); } break; case "1a6g_autopsf": { Namd.Psf psf = Namd.Psf.FromFile(rootpath + @"\Sample\1a6g_autopsf.psf"); Pdb pdb = Pdb.FromFile(rootpath + @"\Sample\1a6g_autopsf.pdb"); Namd.Prm prm = Namd.Prm.FromFile(rootpath + @"\Sample\1a6g_autopsf.prm", new TextLogger()); univ = Universe.Build(psf, prm, pdb, false); List <ForceField.IForceField> frcflds = ForceField.GetMindyForceFields(); double threshold = 0.001; string minimize_ver = "v1"; switch (minimize_ver) { //case "v2": // { // double atom_max_move = 0.03; // int iter_conjgrad = univ.Minimize_ConjugateGradient_v2(frcflds, atom_max_move, threshold, System.Console.Error); // break; // } case "v1": { double k = 0.0001; int randomPurturb = 0; // no random purturbation bool[] atomsMovable = null; // update all atoms int iter_conjgrad = univ.Minimize_ConjugateGradient_v1(0, frcflds, k, 0.1, null, threshold, randomPurturb, atomsMovable, new MinimizeLogger_PrintEnergyForceMag(), null, null); break; } default: goto case "v1"; } //atom_max_move = 0.03; //int iter_stepdsnt = univ.Minimize_SteepestDescent(frcflds, atom_max_move, threshold, System.Console.Error); } break; case "1a6g_autopsf.unfolded": { Namd.Psf psf = Namd.Psf.FromFile(rootpath + @"\Sample\1a6g_autopsf.psf"); Pdb pdb = Pdb.FromFile(rootpath + @"\Sample\1a6g_autopsf.pdb"); { Random rand = new Random(1); List <Vector> coords = pdb.atoms.ListCoord(); for (int i = 0; i < coords.Count; i++) { double x = i * 0.1 + rand.NextDouble() * 0.01; double y = i * 0.1 + rand.NextDouble() * 0.01; double z = i * 0.1 + rand.NextDouble() * 0.01; coords[i] = new Vector(x, y, z); } pdb.ToFile(rootpath + @"\Sample\1a6g_autopsf.unfolded.pdb", coords); pdb = Pdb.FromFile(rootpath + @"\Sample\1a6g_autopsf.unfolded.pdb"); } Namd.Prm prm = Namd.Prm.FromFile(rootpath + @"\Sample\1a6g_autopsf.prm", new TextLogger()); univ = Universe.Build(psf, prm, pdb, false); List <ForceField.IForceField> frcflds = ForceField.GetMindyForceFields(); double threshold = 0.01; string minimize_ver = "v1"; switch (minimize_ver) { //case "v2": // { // double atom_max_move = 0.1; // int iter_conjgrad = univ.Minimize_ConjugateGradient_v2(frcflds, atom_max_move, threshold, System.Console.Error); // break; // } case "v1": { double k = 0.0001; int randomPurturb = 100; bool[] atomsMovable = null; // updates all atoms int iter_conjgrad = univ.Minimize_ConjugateGradient_v1(0, frcflds, k, 0.1, null, threshold, randomPurturb, atomsMovable, new MinimizeLogger_PrintEnergyForceMag(), null, null); break; } default: goto case "v1"; } //atom_max_move = 0.03; //int iter_stepdsnt = univ.Minimize_SteepestDescent(frcflds, atom_max_move, threshold, System.Console.Error); } break; default: goto case "alanin"; } }
public static bool Main(string[] args, ILinAlg la) { string cachebase = @"K:\cache\CoarseGraining-20150111\proteins-177\"; foreach (var pdbid_corr_ovlps in lst_pdbid_corr_ovlps) { string pdbid = pdbid_corr_ovlps.Item1; string pathbase = cachebase + pdbid + @"\"; // load univ var pdb0 = Pdb.FromFile(pathbase + "xry-struc.pdb"); var xyz0 = Tinker.Xyz.FromFile(pathbase + "xry-struc.xyz", false); var xyz1 = Tinker.Xyz.FromFile(pathbase + "min-struc-charmm22.xyz", false); var prm = Tinker.Prm.FromFile(cachebase + "charmm22.prm"); var xyz2 = Tinker.Xyz.FromFile(pathbase + "min-struc-charmm22-screened.xyz", false); #region generating "min-struc-charmm22-screened.xyz" //if(HFile.Exists(pathbase + "min-struc-charmm22-screened.xyz") == false) //{ // var newton = Tinker.Run.Newton // ( xyz1, prm, tempbase // , null // copytemp // , "A 0.0001" // param // , null // atomsToFix // , false // , "CUTOFF 9", "TAPER" // ); // newton.minxyz.ToFile(pathbase + "min-struc-charmm22-screened.xyz", false); //} #endregion Universe univ = Universe.BuilderTinker.Build(xyz1, prm, pdb0, xyz0, 0.001); System.Console.Write("{0}: ", pdbid); HessInfo NMA_hessinfo = GetHessNMA(xyz1, prm, tempbase); Mode[] NMA_modes = NMA_hessinfo.GetModesMassReduced(); Mode[] NMA_nzmodes = NMA_modes.HSelectFrom(6); Vector NMA_bfactor = NMA_nzmodes.GetBFactor().ToArray(); HessInfo sbNMA_hessinfo = GetHessSbNMA(univ, xyz1.atoms.HListCoords(), 12, null, true, true, true, true, true, true, null, null, null, null, null, null, null, null, null, null, null, null); Mode[] sbNMA_modes = sbNMA_hessinfo.GetModesMassReduced(); Mode[] sbNMA_nzmodes = sbNMA_modes.HSelectFrom(6); Vector sbNMA_bfactor = sbNMA_nzmodes.GetBFactor().ToArray(); double corr = HBioinfo.BFactor.Corr(NMA_bfactor, sbNMA_bfactor); double ovlp0 = Math.Abs(LinAlg.VtV(NMA_nzmodes[0].eigvec.UnitVector(), sbNMA_nzmodes[0].eigvec.UnitVector())); double ovlp1 = Math.Abs(LinAlg.VtV(NMA_nzmodes[1].eigvec.UnitVector(), sbNMA_nzmodes[1].eigvec.UnitVector())); double ovlp2 = Math.Abs(LinAlg.VtV(NMA_nzmodes[2].eigvec.UnitVector(), sbNMA_nzmodes[2].eigvec.UnitVector())); double ovlp3 = Math.Abs(LinAlg.VtV(NMA_nzmodes[3].eigvec.UnitVector(), sbNMA_nzmodes[3].eigvec.UnitVector())); double ovlp4 = Math.Abs(LinAlg.VtV(NMA_nzmodes[4].eigvec.UnitVector(), sbNMA_nzmodes[4].eigvec.UnitVector())); double ovlp5 = Math.Abs(LinAlg.VtV(NMA_nzmodes[5].eigvec.UnitVector(), sbNMA_nzmodes[5].eigvec.UnitVector())); double ovlp6 = Math.Abs(LinAlg.VtV(NMA_nzmodes[6].eigvec.UnitVector(), sbNMA_nzmodes[6].eigvec.UnitVector())); double ovlp7 = Math.Abs(LinAlg.VtV(NMA_nzmodes[7].eigvec.UnitVector(), sbNMA_nzmodes[7].eigvec.UnitVector())); double ovlp8 = Math.Abs(LinAlg.VtV(NMA_nzmodes[8].eigvec.UnitVector(), sbNMA_nzmodes[8].eigvec.UnitVector())); double ovlp9 = Math.Abs(LinAlg.VtV(NMA_nzmodes[9].eigvec.UnitVector(), sbNMA_nzmodes[9].eigvec.UnitVector())); System.Console.Write("corr {0:0.0000}, ", corr); System.Console.Write("ovlp0 {0:0.0000}, ", ovlp0); System.Console.Write("ovlp1 {0:0.0000}, ", ovlp1); System.Console.Write("ovlp2 {0:0.0000}, ", ovlp2); System.Console.Write("ovlp3 {0:0.0000}, ", ovlp3); System.Console.Write("ovlp4 {0:0.0000}, ", ovlp4); System.Console.Write("ovlp5 {0:0.0000}, ", ovlp5); System.Console.Write("ovlp6 {0:0.0000}, ", ovlp6); System.Console.Write("ovlp7 {0:0.0000}, ", ovlp7); System.Console.Write("ovlp8 {0:0.0000}, ", ovlp8); System.Console.Write("ovlp9 {0:0.0000}, ", ovlp9); System.Console.WriteLine(); } return(true); }
public static bool GetHessAnmSelfTest() { if (HDebug.Selftest() == false) { return(true); } string pdbpath = @"C:\Users\htna\svn\htnasvn_htna\VisualStudioSolutions\Library2\HTLib2.Bioinfo\Bioinfo.Data\pdb\1MJC.pdb"; if (HFile.Exists(pdbpath) == false) { return(false); } Pdb pdb = Pdb.FromFile(pdbpath); for (int i = 0; i < pdb.atoms.Length; i++) { HDebug.Assert(pdb.atoms[0].altLoc == pdb.atoms[i].altLoc); HDebug.Assert(pdb.atoms[0].chainID == pdb.atoms[i].chainID); } List <Vector> coords = pdb.atoms.ListCoord(); double cutoff = 13; Matlab.Execute("clear"); Matlab.PutMatrix("x", Matrix.FromRowVectorList(coords).ToArray()); Matlab.PutValue("cutoffR", cutoff); Matlab.Execute(@"% function cx = contactsNew(x, cutoffR) % Contact matrix within cutoff distance. % Author: Guang Song % New: 10/25/2006 % %n = size(x,1); % Method 1: slow %for i=1:n % center = x(i,:); % distSqr(:,i) = sum((x-center(ones(n,1),:)).^2,2); %end %cx = sparse(distSqr<=cutoffR^2); % Method 2: fast! about 28 times faster when array size is 659x3 %tot = zeros(n,n); %for i=1:3 % xi = x(:,ones(n,1)*i); % %tmp = (xi - xi.').^2; % %tot = tot + tmp; % tot = tot + (xi - xi.').^2; %end %cx = sparse(tot<=cutoffR^2); % Method 3: this implementation is the shortest! but sligtly slower than % method 2 %xn = x(:,:,ones(n,1)); % create n copy x %xnp = permute(xn,[3,2,1]); %tot = sum((xn-xnp).^2,2); % sum along x, y, z %cx = sparse(permute(tot,[1,3,2])<=cutoffR^2); % put it into one line like below actually slows it down. Don't do that. %cx = sparse(permute(sum((xn-permute(xn,[3,2,1])).^2,2),[1,3,2])<=cutoffR^2); %Method 4: using function pdist, which I just know % this one line implementation is even faster. 2 times than method 2. cx = sparse(squareform(pdist(x)<=cutoffR)); "); Matlab.Execute(@"% function [anm,xij,normxij] = baseHess(x,cx) % Basic Hessian Matrix % Author: Guang Song % Created: Feb 23, 2005 % Rev: 11/09/06 % % cx is the contact map. Also with gama info (new! 02/23/05) dim = size(x,1); nx = x(:,:,ones(1,dim)); xij = permute(nx,[3,1,2]) - permute(nx,[1,3,2]); % xj - xi for any i j normxij = squareform(pdist(x)) + diag(ones(1,dim)); % + diag part added to avoid divided by zero. anm = zeros(3*dim,3*dim); for i=1:3 for j=1:3 tmp = xij(:,:,i).*xij(:,:,j).*cx./normxij.^2; tmp = diag(sum(tmp)) - tmp; anm(i:3:3*dim,j:3:3*dim) = tmp; end end % if dR is scalar, then dR = 1, back to GNM. %if abs(i-j) == 1 % virtual bonds. should stay around 3.81 A % K33 = K33*100; %end anm = (anm+anm')/2; % make sure return matrix is symmetric (fix numeric error) "); Matrix anm_gsong = Matlab.GetMatrix("anm"); Matlab.Execute("clear;"); Matrix anm = GetHessAnm(coords.ToArray(), cutoff); if (anm_gsong.RowSize != anm.RowSize) { HDebug.Assert(false); return(false); } if (anm_gsong.ColSize != anm.ColSize) { HDebug.Assert(false); return(false); } for (int c = 0; c < anm.ColSize; c++) { for (int r = 0; r < anm.RowSize; r++) { if (Math.Abs(anm_gsong[c, r] - anm[c, r]) >= 0.00000001) { HDebug.Assert(false); return(false); } } } return(true); }
public static Vector[] MinimizeLBfgs(IList <Pdb.Atom> atoms , IList <Vector> coords = null , string ff = null // -ff string select Force field, interactive by default. Use -h for information. // "charmm27", ... , string water = null // -water enum select Water model to use: select, none, spc, spce, tip3p, tip4p or tip5p , double mdp_emtol = 0.001 // the minimization is converged when the maximum force is smaller than this value , double mdp_emstep = 0.001 // initial step-size ) { Vector[] confout; { string currdir = HEnvironment.CurrentDirectory; System.IO.DirectoryInfo temproot = HDirectory.CreateTempDirectory(); HEnvironment.CurrentDirectory = temproot.FullName; { if (coords != null) { HDebug.Assert(atoms.Count == coords.Count); } Pdb.ToFile("conf.pdb", atoms, coords: coords , headers: new string[] { "CRYST1 " } ); HFile.WriteAllLines("grompp-nm.mdp" , new string[] { "; Parameters describing what to do, when to stop and what to save " , "integrator = l-bfgs " , "emtol = 0.001 " , "emstep = 0.001 ; Energy step size " , "nsteps = 5000000000 ; Maximum number of (minimization) steps to perform " , " ; Parameters describing how to find the neighbors of each atom and how to calculate the interactions " , "nstlist = 1 ; Frequency to update the neighbor list and long range forces " , "ns_type = grid ; Method to determine neighbor list (simple, grid) " , "rlist = 1.0 ; Cut-off for making neighbor list (short range forces) ; htna 1.0-1.2 " , "coulombtype = Shift " , "rcoulomb = 1.0 " , "rcoulomb_switch = 0.7 " , "vdwtype = Shift " , "rvdw = 1.0 " , "rvdw_switch = 0.7 " //," " //," " //,"nstxout = 1; (100) [steps] frequency to write coordinates to output trajectory file, the last coordinates are always written" //,"nstvout = 1; (100) [steps] frequency to write velocities to output trajectory, the last velocities are always written " //,"nstfout = 1; ( 0) [steps] frequency to write forces to output trajectory. " }); RunPdb2gmx(f: "conf.pdb" , o: "confout.pdb" , p: "topol.top" , i: "posre.itp" , n: "clean.ndx" , q: "clean.pdb" , ff: "charmm27" , water: "none" , merge: "all" , lineStderr: null , lineStdout: null ); RunGrompp(f: "grompp-nm.mdp" , p: "topol.top" , o: "topol-nm.tpr" , c: "confout.pdb" , lineStderr: null , lineStdout: null ); RunMdrun(s: "topol-nm.tpr" , c: "confout.pdb" , o: "traj.trr" , g: "md.log" //, mtx:"hessian.mtx" //, pf:"pullf.xvg" //, px:"pullx.xvg" //, nt:"3" , lineStderr: null , lineStdout: null ); Pdb pdbout = Pdb.FromFile("confout.pdb"); confout = pdbout.atoms.ListCoord().ToArray(); } HEnvironment.CurrentDirectory = currdir; Thread.Sleep(100); try{ temproot.Delete(true); } catch (Exception) {} } HDebug.Assert(confout.Length == atoms.Count); return(confout); }