/// <summary> /// Salva em arquivo o contato topológico de vizinhos de primeiro contato /// </summary> /// <param name="isem"></param> public void NeighborsSave(long isem, ref int numberNeighborTopological) { string file = isem.ToString(); //Members.initialIsem = Members.isem string dir = IO.Directory.SubDirNeighbors; string pathFile = dir + @"\" + file + Consts.extensionOfFile; ExtendedStreamWriter sw = new ExtendedStreamWriter(Config.Crypt); sw.CreateText(pathFile, Config.CurrentGuid); int numberContact = 0; numberNeighborTopological = 0; //sw.WriteLine("Residuo | 1o.Vz.| 2o.Vz.| 3o.Vz.| 4o.Vz.| 5o.Vz.| 6o.Vz.|"); List <BasicStructs.Point> points = this.r; //foreach (Structs.Point temp in points) for (int i = 0; i < points.Count; i++) { BasicStructs.Point temp = points[i]; sw.Write("{0}\t", i); if (temp.neighbors != null) { bool ocuredContact = false; for (int j = 0; j < temp.neighbors.Length; j++) { if (temp.neighbors[j].classification == NeighborsType.neighborTopological) { numberContact++; ocuredContact = true; sw.Write("{0}\t", temp.neighbors[j].classification.ToString() + "(" + temp.neighbors[j].contacResidue.ToString() + ")"); } } if (ocuredContact) { numberNeighborTopological++; } } sw.WriteLine(); } sw.WriteLine(); sw.WriteLine("numberContact:" + numberContact); sw.WriteLine("numberNeighborTopological:" + numberNeighborTopological); //this.numberNeighborTopological = numberNeighborTopological; sw.Flush(); sw.Close(); }
/// <summary> /// Save a classificação do tipo de Movimento possível /// </summary> public static void SaveClassificationOfMotion(string file) { string dir = IO.Directory.SubDirClassificationOfMotion; string pathFile = dir + @"\" + file + Consts.extensionOfFile; ExtendedStreamWriter sw = new ExtendedStreamWriter(Config.Crypt); sw.CreateText(pathFile, Config.CurrentGuid); for (int i = 0; i < GCPS.chain.r.Count; i++) { Structs.BasicStructs.Point temp = GCPS.chain.r[i]; sw.Write("{0}\t", i); sw.Write("{0}", temp.classificationMotion.ends == true ? "E " : string.Empty); sw.Write("{0}", temp.classificationMotion.stretched == true ? "S " : string.Empty); sw.Write("{0}", temp.classificationMotion.kink == true ? "T " : string.Empty); sw.Write("{0}", temp.classificationMotion.crankShaft__R0 == true ? "CR0 " : string.Empty); sw.Write("{0}", temp.classificationMotion.crankShaft__R1 == true ? "CR1 " : string.Empty); sw.Write("{0}", temp.classificationMotion.crankShaft__R2 == true ? "CR2 " : string.Empty); sw.Write("{0}", temp.classificationMotion.crankShaft__R3 == true ? "CR3 " : string.Empty); sw.WriteLine(); } sw.Flush(); sw.Close(); }
/// <summary> /// Metodo o qual efetua geração do arquivo texto com os Monomeros baseados em um dado Isem /// </summary> /// <param name="mList">Lista de Monomeros</param> /// <param name="breakLine">Pula linha entre as interações</param> /// <param name="overrideFile">Se o arquivo existir, o mesmo é sobreposto</param> public static void RecTrajectoryFileCalcSpinningRay_MIN(long mCStep, long totalMoviments, long numberOfMovementsApplied, List <Structs.BasicStructs.Point> mList, bool breakLine, Guid guid) { string fileName = GCPS.initialIsem + "_calcSpinningRay_MIN_" + GCPS.chain.contMoves.SumOfAcceptedAndRejectedMovement + Directory.FileExtension; bool append = false; ExtendedStreamWriter tw = new ExtendedStreamWriter(Directory.SubDirTrajectorySet + @"\" + fileName, append, Config.CurrentGuid, Config.Crypt); StringBuilder output = new StringBuilder(); for (int xFor = 0; xFor < mList.Count; xFor++) { output.Append(mList[xFor].x.ToString() + "\t" + mList[xFor].y.ToString() + "\t" + mList[xFor].z.ToString()); tw.Write(output.ToString()); if (breakLine) { tw.WriteLine(); } output.Length = 0; } output = null; try { tw.Flush(); tw.Close(); } finally { tw = null; } }
private static void WriteFrequencyPeerInterval(string fileName, string extFileName, BasicEnums.HistTypes histType, BasicEnums.ChainTypes chainType) { StringBuilder sb = Maths4Simulation.FrequencyPeerInterval(fileName + extFileName, histType, chainType); if (sb != null) { string dir = IO.Directory.SubDirHistogram; string pathFile = dir + @"\" + fileName + histogram + extFileName + Directory.FileExtension; string[] ret = Regex.Split(sb.ToString(), "\n"); ExtendedStreamWriter sw = new ExtendedStreamWriter(Config.Crypt); sw.CreateText(pathFile, Config.CurrentGuid); for (int i = 0; i < ret.Count(); i++) { string retPrinter = ret[i]; sw.WriteLine(retPrinter); } sw.Flush(); sw.Close(); } return; }
//static string Server = "Server"; //static string Web = "Web"; private void DecrypAllFiles(string[] diretories, string destination) { foreach (string path in diretories) { //string newWebFolder = path.Replace(Server, Web); Directory.CreateDirIfNotExist(destination); foreach (string tempFile in Directory.GetFilesOfDir(path)) { string newWebFile = string.Empty; //newWebFile = tempFile.Replace(Server, Web); newWebFile = destination + Path.GetFileName(tempFile); string extensionFile = Path.GetExtension(tempFile); if (extensionFile == ".xls") { File.Copy(tempFile, newWebFile, true); } else { if (param.dataToProcess.crypt) { //DADOS string line; using (ExtendedStreamReader fileReader = new ExtendedStreamReader(tempFile, this.param.dataToProcess.Guid, AppConfigClient.Crypt)) { ExtendedStreamWriter fileWriter = new ExtendedStreamWriter(newWebFile, false, this.param.dataToProcess.Guid, false); while ((line = fileReader.ReadLine()) != null) { if (String.IsNullOrEmpty(line)) { break; } fileWriter.WriteLine(line); } fileReader.Close(); //fileReader = null; fileWriter.Flush(); fileWriter.Close(); fileWriter = null; fileReader.Dispose(); } //FIM DADOS } else { File.Copy(tempFile, newWebFile, true); } } } } }
/// <summary> /// Save as coordenadas geradas da SEMENTE /// </summary> private static void SaveSeedCoordAtDirSeed() { string dir = GridProteinFolding.Process.IO.Directory.DirSeed; string pathFile = dir + @"\" + GCPS.chain.isem + Consts.extensionOfFile; ExtendedStreamWriter sw = new ExtendedStreamWriter(); sw.CreateText(pathFile, Config.currentGuid); sw.WriteLine("{0}", GCPS.chain.isem); for (int i = 0; i < GCPS.chain.r.Count; i++) { BasicStructs.Point temp = GCPS.chain.r[i]; sw.WriteLine("{0}\t{1}\t{2}", temp.x, temp.y, temp.z); } sw.Flush(); sw.Close(); }
public static void TrajectoryFileSandBox(long mCStep, List <Structs.BasicStructs.Point> mList) { string fileName = "TrajectorySandBox" + Directory.FileExtension; StringBuilder output = new StringBuilder(); ExtendedStreamWriter tw; string currentFileName = string.Empty; if (StateControl.extensionfile == 0) { currentFileName = fileName; } else { currentFileName = "Trajectory" + StateControl.extensionfile + Directory.FileExtension; } tw = new ExtendedStreamWriter(@"C:\" + @"\" + currentFileName, true, Config.CurrentGuid, Config.Crypt); tw.AutoFlush = true; //Layout MCS M1x M1y M1z M2x M2y M2z M3x M3y M3z ... M27x M27y M27z output.Append(mCStep + "\t"); // + totalMoviments + "\t" + NumberOfMovementsApplied + "\t"); tw.Write(output.ToString()); output.Length = 0; for (int xFor = 0; xFor < mList.Count; xFor++) { output.Append(mList[xFor].x.ToString() + "\t" + mList[xFor].y.ToString() + "\t" + mList[xFor].z.ToString()); if (xFor < (mList.Count - 1)) { output.Append("\t"); } tw.Write(output.ToString()); output.Length = 0; } tw.WriteLine(""); output = null; try { tw.Flush(); tw.Close(); } finally { tw = null; } }
/// <summary> /// Salva em arquivo os valores da "Matriz energética" /// </summary> public static void SaveEnergeticMatrix() { string file = GCPS.chain.isem.ToString(); string dir = IO.Directory.SubDirNeighbors; string pathFile = dir + @"\Me_" + file + Consts.extensionOfFile; ExtendedStreamWriter sw = new ExtendedStreamWriter(Config.Crypt); sw.CreateText(pathFile, Config.CurrentGuid); for (int i = 0; i < GCPS.chain.r.Count; i++) { for (int j = 0; j < GCPS.chain.r.Count; j++) { sw.Write(String.Format(@"{0}", GCPS.energeticMatrix[i, j]).ToString() + "\t"); } sw.WriteLine(); } sw.Flush(); sw.Close(); }
public static void StreamRecCalcSpinningRay(long sumOfAcceptedAndRejectedMovement, double calcSpinningRay, string fileName) { bool append = true; ExtendedStreamWriter tw = new ExtendedStreamWriter(Directory.SubDirTrajectorySet + @"\" + fileName, append, Config.CurrentGuid, Config.Crypt); StringBuilder output = new StringBuilder(); output.Append(sumOfAcceptedAndRejectedMovement + "\t" + calcSpinningRay); tw.WriteLine(output.ToString()); output = null; try { tw.Flush(); tw.Close(); } finally { tw = null; } }
public void EvolutionValueMediumOfEnergy() { string readerFile = dirBaseWeb.FullName() + this.param.dataToProcess.Guid + @"\Result\Debug.dat"; string writerFile = @dirBaseWeb.FullName() + this.param.dataToProcess.Guid + @"\Result\EvolutionEnergy.dat"; //Data string line; List <ColsForEnergy> energy = new List <ColsForEnergy>(); using (ExtendedStreamReader souceFile = new ExtendedStreamReader(readerFile, this.param.dataToProcess.Guid, false)) { ExtendedStreamWriter destinationFile = new ExtendedStreamWriter(writerFile, false, this.param.dataToProcess.Guid, false); string[] cols = null; int i = 0; while ((line = souceFile.ReadLine()) != null) { if (String.IsNullOrEmpty(line)) { break; } //pulas cabeçalho e o número de discartes if (i < 1) { for (int k = 0; k < this.valueDiscard; k++) { line = souceFile.ReadLine(); } } else { cols = line.Split('\t').ToArray(); Int32 _mcSteps = Convert.ToInt32(cols[0]); double _newE = Convert.ToDouble(cols[2]); energy.Add(new ColsForEnergy() { mcSteps = _mcSteps, e = _newE }); //pula o Delta for (int k = 0; k < this.delta; k++) { line = souceFile.ReadLine(); } } i++; } souceFile.Close(); //souceFile = null; //Write result file destinationFile.WriteLine("mcStep: {0}", this.mcSteps); destinationFile.WriteLine("valueDiscard: {0}", this.valueDiscard); destinationFile.WriteLine("delta: {0}", this.delta); destinationFile.WriteLine("temperature: {0}", param.dataToProcess.temperature); destinationFile.WriteLine("model: {0}", TranslateModel(param.dataToProcess.modelType)); destinationFile.WriteLine("idx" + "\t" + "_mcSteps" + "\t" + "energy"); for (int z = 0; z < energy.Count(); z++) { destinationFile.WriteLine(z + "\t" + energy[z].mcSteps + "\t" + energy[z].e); } destinationFile.Flush(); destinationFile.Close(); souceFile.Dispose(); } }
public void ConfigurationOutPut() { string[] files = Directory.GetFilesOfDir(dirBaseWeb.FullName() + this.param.dataToProcess.Guid + @"\Result", "Trajectory*.dat"); Array.Sort <string>(files); Array.Reverse(files); string readerLastFile = files[0]; Array.Sort <string>(files); //Data string line; List <string> configurations = new List <string>(); //FILEs - lê arquivo por arquivo efetuando o SALTO de MCTSP efetuado string readerFirstFile = string.Empty; ExtendedStreamReader souceFirstFile; int i = 0; for (int numberOfFile = 0; numberOfFile < files.Length; numberOfFile++) { readerFirstFile = files[numberOfFile]; using (souceFirstFile = new ExtendedStreamReader(readerFirstFile, this.param.dataToProcess.Guid, false)) { bool readHeader = false; while ((line = souceFirstFile.ReadLine()) != null) { if (String.IsNullOrEmpty(line)) { break; } //cabeçalho do primeiro arquivo if (!readHeader) { configurations.Add(line); readHeader = true; line = souceFirstFile.ReadLine(); } if (i == 0) { //for (int k = 0; k < this.valueDiscard; k++) //{ // line = souceFirstFile.ReadLine(); //} configurations.Add(line); } else { //if (i == param.output.configurationJumpStep) //{ // i = 0; configurations.Add(line); //} } i++; } souceFirstFile.Close(); souceFirstFile.Dispose(); } } //LAST FILE string writerConfigurationFile = dirBaseWeb.FullName() + this.param.dataToProcess.Guid + @"\Result\Configuration.dat"; ExtendedStreamWriter destinationFile = new ExtendedStreamWriter(writerConfigurationFile, false, this.param.dataToProcess.Guid, false); line = string.Empty; string last = File.ReadLastLineOfFile(readerLastFile); configurations.Add(last); souceFirstFile = null; //Write result file foreach (string data in configurations) { destinationFile.WriteLine(data); } destinationFile.Flush(); destinationFile.Close(); //Após consolidar arquivo de CONFIGURATION.DAT, os arquivos de TRAJETORY* devem ser descartados foreach (string file in files) { File.Delete(file); } }
public void Distribution() { try { string readerFile = dirBaseWeb.FullName() + this.param.dataToProcess.Guid + @"\Result\Debug.dat"; string writerFile = dirBaseWeb.FullName() + this.param.dataToProcess.Guid + @"\Result\Distribution.dat"; Guid guid = param.dataToProcess.Guid; int isem = param.dataToProcess.isem; int sitios = param.dataToProcess.totalSitio; //Data string line; List <ColsForDepedentModel> md = new List <ColsForDepedentModel>(); using (ExtendedStreamReader souceFile = new ExtendedStreamReader(readerFile, this.param.dataToProcess.Guid, false)) { ExtendedStreamWriter destinationFile = new ExtendedStreamWriter(writerFile, false, this.param.dataToProcess.Guid, false); string[] cols = null; int i = 0; while ((line = souceFile.ReadLine()) != null) { if (String.IsNullOrEmpty(line)) { break; } //pulas cabeçalho & faz o discarte o número de discartes if (i == 0) { for (int k = 0; k < this.valueDiscard; k++) { line = souceFile.ReadLine(); } } else { cols = line.Split('\t').ToArray(); Int32 _mcSteps = Convert.ToInt32(cols[0]); double _rg = Convert.ToDouble(cols[3]); double _e = Convert.ToDouble(cols[2]); double _U = Convert.ToDouble(cols[8]); md.Add(new ColsForDepedentModel() { mcSteps = _mcSteps, rg = _rg, e = _e, U = _U }); //pula o Delta for (int k = 0; k < this.delta; k++) { line = souceFile.ReadLine(); } } i++; } souceFile.Close(); //souceFile = null; //Write result file destinationFile.WriteLine("simulation id: {0}", guid.ToString()); destinationFile.WriteLine("isem: {0}", isem); destinationFile.WriteLine("sitios: {0}", sitios); destinationFile.WriteLine("model: {0}", TranslateModel(param.dataToProcess.modelType)); destinationFile.WriteLine("mcStep: {0}", this.mcSteps); destinationFile.WriteLine("temperature: {0}", param.dataToProcess.temperature); destinationFile.WriteLine("valueDiscard: {0}", this.valueDiscard); destinationFile.WriteLine("delta: {0}", this.delta); destinationFile.WriteLine("idx\t mcSteps\t rg2\t rg2(accumulated)\t <rg2>\t e\t e(accumulated)\t <e>\t U\t U(accumulated)\t <U>"); double aRG2, eRG2, previousRG2, actualRG2; aRG2 = eRG2 = previousRG2 = actualRG2 = 0; double aE, eE, previousE, actualE; aE = eE = previousE = actualE = 0; double aU, eU, previousU, actualU; aU = eU = previousU = actualU = 0; Int64 idx = 0; for (int z = 0; z < md.Count(); z++) { idx = (z + 1); //Acumulado aRG2 += md[z].rg; aE += md[z].e; aU += md[z].U; //Evolução do RAIO DE GIRAÇÃO actualRG2 = md[z].rg; eRG2 = aRG2 / idx; previousRG2 = eRG2; //Evolução do E actualE = md[z].e; eE = aE / idx; previousE = eE; //Evolução do U actualU = md[z].U; eU = aU / idx; previousE = eU; destinationFile.WriteLine(z + "\t" + md[z].mcSteps + "\t" + actualRG2 + "\t" + aRG2 + "\t" + eRG2 + "\t" + actualE + "\t" + aE + "\t" + eE + "\t" + actualU + "\t" + aU + "\t" + eU); } destinationFile.Flush(); destinationFile.Close(); souceFile.Dispose(); } } catch (Exception ex) { GICO.WriteLine(ex); throw; } }
/// <summary> /// Metodo o qual efetua geração do arquivo texto com os Monomeros baseados em um dado Isem /// </summary> /// <param name="mList">Lista de Monomeros</param> /// <param name="breakLine">Pula linha entre as interações</param> /// <param name="overrideFile">Se o arquivo existir, o mesmo é sobreposto</param> public static void TrajectoryFile(long mCStep, long totalMoviments, long numberOfMovementsApplied, List <Structs.BasicStructs.Point> mList, Guid guid, Int32 splitFileEvery, bool firstStep = false) { StateControl.splitFileEvery = splitFileEvery; string fileName = "Trajectory" + Directory.FileExtension; StringBuilder output = new StringBuilder(); ExtendedStreamWriter tw; string currentFileName = string.Empty; if (firstStep) { StateControl.numberOfLines = 0; tw = new ExtendedStreamWriter(Directory.SubDirTrajectorySet + @"\" + fileName, false, Config.CurrentGuid, Config.Crypt); output.Append("mCStep" + "\t");// + "totalMoviments" + "\t" + "NumberOfMovementsApplied" + "\t"); for (int xFor = 0; xFor < mList.Count; xFor++) { output.Append("x" + xFor + "\t" + "y" + xFor + "\t" + "z" + xFor); if (xFor < (mList.Count - 1)) { output.Append("\t"); } tw.Write(output.ToString()); output.Length = 0; } tw.WriteLine(""); } else { if (StateControl.extensionfile == 0) { currentFileName = fileName; } else { currentFileName = "Trajectory" + StateControl.extensionfile + Directory.FileExtension; } tw = new ExtendedStreamWriter(Directory.SubDirTrajectorySet + @"\" + currentFileName, true, Config.CurrentGuid, Config.Crypt); StateControl.numberOfLines++; if (StateControl.numberOfLines == StateControl.splitFileEvery) { StateControl.numberOfLines = 0; StateControl.extensionfile++; } } tw.AutoFlush = true; //Layout MCS M1x M1y M1z M2x M2y M2z M3x M3y M3z ... M27x M27y M27z output.Append(mCStep + "\t"); // + totalMoviments + "\t" + NumberOfMovementsApplied + "\t"); tw.Write(output.ToString()); output.Length = 0; for (int xFor = 0; xFor < mList.Count; xFor++) { output.Append(mList[xFor].x.ToString() + "\t" + mList[xFor].y.ToString() + "\t" + mList[xFor].z.ToString()); if (xFor < (mList.Count - 1)) { output.Append("\t"); } tw.Write(output.ToString()); output.Length = 0; } tw.WriteLine(""); output = null; try { tw.Flush(); tw.Close(); } finally { tw = null; } }
public static void RecMoveSet(Guid guid, string fileName) { bool append = false; StringBuilder output = new StringBuilder(); output.Append("MOVES in GENERAL" + System.Environment.NewLine); output.Append("\tTotal Accept movements:\t" + GCPS.chain.contMoves.NumberOfMovementsApplied.ToString() + System.Environment.NewLine); output.Append("\tTotal Reject movements:\t" + GCPS.chain.contMoves.NumberOfMovementsRejected.ToString() + System.Environment.NewLine); output.Append("\tTotal attempts:\t" + GCPS.chain.contMoves.SumOfAcceptedAndRejectedMovement.ToString() + System.Environment.NewLine); output.Append("CRANKSHAFT" + System.Environment.NewLine); output.Append("\tcrankshaft 1 accepted:\t" + GCPS.chain.contMoves.moveSetCrankshaft.crankshaftAccept_1 + System.Environment.NewLine); output.Append("\tcrankshaft 1 rejected:\t" + GCPS.chain.contMoves.moveSetCrankshaft.crankshaftReject_1); output.Append("\t\t" + GCPS.chain.contMoves.moveSetCrankshaft.crankshaftTotal_1 + System.Environment.NewLine); output.Append("\tcrankshaft 2 accepted:\t" + GCPS.chain.contMoves.moveSetCrankshaft.crankshaftAccept_2 + System.Environment.NewLine); output.Append("\tcrankshaft 2 rejected:\t" + GCPS.chain.contMoves.moveSetCrankshaft.crankshaftReject_2); output.Append("\t\t" + GCPS.chain.contMoves.moveSetCrankshaft.crankshaftTotal_2 + System.Environment.NewLine); output.Append("\tcrankshaft 3 accepted:\t" + GCPS.chain.contMoves.moveSetCrankshaft.crankshaftAccept_3 + System.Environment.NewLine); output.Append("\tcrankshaft 3 rejected:\t" + GCPS.chain.contMoves.moveSetCrankshaft.crankshaftReject_3); output.Append("\t\t" + GCPS.chain.contMoves.moveSetCrankshaft.crankshaftTotal_3 + System.Environment.NewLine); output.Append("\tTotal crankshaft Accept:\t" + GCPS.chain.contMoves.crankshaftAccept.ToString() + System.Environment.NewLine); output.Append("\tTotal crankshaft Reject:\t" + GCPS.chain.contMoves.crankshaftReject.ToString() + System.Environment.NewLine); output.Append("\tTotal crankshaft Attempts:\t" + GCPS.chain.contMoves.TotalCankshaftAttempts.ToString()); output.Append("\t\t" + (GCPS.chain.contMoves.moveSetCrankshaft.crankshaftTotal_1 + GCPS.chain.contMoves.moveSetCrankshaft.crankshaftTotal_2 + GCPS.chain.contMoves.moveSetCrankshaft.crankshaftTotal_3).ToString() + System.Environment.NewLine); output.Append("KINK" + System.Environment.NewLine); output.Append("\tTotal kink Accept:\t" + GCPS.chain.contMoves.kinkAccept.ToString() + System.Environment.NewLine); output.Append("\tTotal kink Reject:\t" + GCPS.chain.contMoves.kinkReject.ToString() + System.Environment.NewLine); output.Append("\tTotal kind Attempts:\t" + GCPS.chain.contMoves.TotatKinKAttempts.ToString() + System.Environment.NewLine); output.Append("END" + System.Environment.NewLine); output.Append("\tend 1 accepted:\t" + GCPS.chain.contMoves.moveSetEnd.endAccept_1 + System.Environment.NewLine); output.Append("\tend 1 rejected:\t" + GCPS.chain.contMoves.moveSetEnd.endReject_1); output.Append("\t\t" + GCPS.chain.contMoves.moveSetEnd.endTotal_1 + System.Environment.NewLine); output.Append("\tend 2 accepted:\t" + GCPS.chain.contMoves.moveSetEnd.endAccept_2 + System.Environment.NewLine); output.Append("end 2 rejected:\t" + GCPS.chain.contMoves.moveSetEnd.endReject_2); output.Append("\t\t" + GCPS.chain.contMoves.moveSetEnd.endTotal_2 + System.Environment.NewLine); output.Append("\tend 3 accepted:\t" + GCPS.chain.contMoves.moveSetEnd.endAccept_3 + System.Environment.NewLine); output.Append("\tend 3 rejected:\t" + GCPS.chain.contMoves.moveSetEnd.endReject_3); output.Append("\t\t" + GCPS.chain.contMoves.moveSetEnd.endTotal_3 + System.Environment.NewLine); output.Append("\tend 4 accepted:\t" + GCPS.chain.contMoves.moveSetEnd.endAccept_4 + System.Environment.NewLine); output.Append("\tend 4 rejected:\t" + GCPS.chain.contMoves.moveSetEnd.endReject_4); output.Append("\t\t" + GCPS.chain.contMoves.moveSetEnd.endTotal_4 + System.Environment.NewLine); output.Append("\tTotal ends Accept:\t" + GCPS.chain.contMoves.endsAccept.ToString() + System.Environment.NewLine); output.Append("\tTotal ends Reject:\t" + GCPS.chain.contMoves.endsReject.ToString() + System.Environment.NewLine); output.Append("\tTotal end Attempts:\t" + GCPS.chain.contMoves.TotalEndAttempts.ToString()); output.Append("\t\t" + (GCPS.chain.contMoves.moveSetEnd.endTotal_1 + GCPS.chain.contMoves.moveSetEnd.endTotal_2 + GCPS.chain.contMoves.moveSetEnd.endTotal_3 + GCPS.chain.contMoves.moveSetEnd.endTotal_4).ToString() + System.Environment.NewLine); output.Append("STRETCHED" + System.Environment.NewLine); output.Append("\tstretched Accepted:\t0" + System.Environment.NewLine); output.Append("\tstretched Rejected:\t" + GCPS.chain.contMoves.othersReject.ToString() + System.Environment.NewLine); output.Append("\tTotal stretched Attempts:\t" + GCPS.chain.contMoves.othersReject.ToString() + System.Environment.NewLine); //GICO.WriteLine(guid, output.ToString()); ExtendedStreamWriter tw = new ExtendedStreamWriter(Directory.SubDirTrajectorySet + @"\" + fileName, append, Config.CurrentGuid, Config.Crypt); tw.WriteLine(output.ToString()); output = null; try { tw.Flush(); tw.Close(); } finally { tw = null; } }
public static void SaveValueOfDebugFile() { string dir = IO.Directory.SubDirDebug; string pathFile = dir + @"\" + AppConfigClient.Param.files.Debug; if (!existFileForSaveDebug) { existFileForSaveDebug = File.Exists(pathFile); } if (existFileForSaveDebug) { long?len = File.Length(pathFile); if (len != null) { if (len >= (1024 * 1024 * 1024)) //1 GB { AppConfigClient.Param.files.count++; AppConfigClient.Param.files.Debug = "Debug" + (AppConfigClient.Param.files.count - 1) + Directory.FileExtension; } } } bool append = true; ExtendedStreamWriter tw = new ExtendedStreamWriter(pathFile, append, Config.CurrentGuid, AppConfigClient.Crypt); StringBuilder output = new StringBuilder(); //Se arquivo de saída tiver tamanho igual zero (0), significa que é um novo arquivo. if (tw.BaseStream().Length == 0) { //Portanto, monta-se o header do arquivo de saída output.Append( "McSteps\t" + "contMoves:NumberOfMovementsApplied\t" + "environment:DeltaE\t" + "environment:RG\t" + "environment:DPP\t" + "environment:R\t" + "environment:TransitionProbability\t" + "chain:UPrevious\t" + "chain:U\t" + "chain:TotalNeighborTopological\t" + "chain:selectNode\t" + "chain:typeOfLattice\t" + "chain:neighborContacts\t" + "chain:numberNeighborTopological"); tw.WriteLine(output.ToString()); output.Clear(); } output.Append( GCPS.McSteps + "\t" + GCPS.chain.contMoves.NumberOfMovementsApplied + "\t" + Structs.Environment.deltaE + "\t" + Structs.Environment.rg + "\t" + Structs.Environment.dpp + "\t" + Structs.Environment.lastR + "\t" + Structs.Environment.transitionProbability + "\t" + GCPS.chain.UPrevious + "\t" + GCPS.chain.U + "\t" + GCPS.chain.TotalNeighborTopological() + "\t" + GCPS.chain.selectNode + "\t" + GCPS.chain.typeOfLattice + "\t" + GCPS.chain.neighborContacts + "\t" + GCPS.chain.numberNeighborTopological); tw.WriteLine(output.ToString()); output = null; try { tw.Flush(); tw.Close(); } finally { tw = null; } }