AVIFileSink::~AVIFileSink() { completeOutputFile(); // Then, stop streaming and delete each active "AVISubsessionIOState": MediaSubsessionIterator iter(fInputSession); MediaSubsession* subsession; while ((subsession = iter.next()) != NULL) { if (subsession->readSource() != NULL) subsession->readSource()->stopGettingFrames(); AVISubsessionIOState* ioState = (AVISubsessionIOState*)(subsession->miscPtr); if (ioState == NULL) continue; delete ioState; } // Then, delete the index records: AVIIndexRecord* cur = fIndexRecordsHead; while (cur != NULL) { AVIIndexRecord* next = cur->next(); delete cur; cur = next; } // Finally, close our output file: CloseOutputFile(fOutFid); }
void HIDCaptureThread::WriteCapturedDataToFile(bool bWriteToFile, QString qsFileName, bool bWriteHeaderInfo, bool bWriteFilteredData) { m_bWriteToFile = bWriteToFile; m_bWriteHeaderInfo = bWriteHeaderInfo; m_bWriteFilteredData = bWriteFilteredData; if ((qsFileName != "") && (qsFileName != m_qsFileName)) { m_qsFileName = qsFileName; CloseOutputFile(); } }
void RunOpt (CodeSeg* S) /* Run the optimizer */ { const char* StatFileName; /* If we shouldn't run the optimizer, bail out */ if (!S->Optimize) { return; } /* Check if we are requested to write optimizer statistics */ StatFileName = getenv ("CC65_OPTSTATS"); if (StatFileName) { ReadOptStats (StatFileName); } /* Print the name of the function we are working on */ if (S->Func) { Print (stdout, 1, "Running optimizer for function `%s'\n", S->Func->Name); } else { Print (stdout, 1, "Running optimizer for global code segment\n"); } /* If requested, open an output file */ OpenDebugFile (S); WriteDebugOutput (S, 0); /* Generate register info for all instructions */ CS_GenRegInfo (S); /* Run groups of optimizations */ RunOptGroup1 (S); RunOptGroup2 (S); RunOptGroup3 (S); RunOptGroup4 (S); RunOptGroup5 (S); RunOptGroup6 (S); RunOptGroup7 (S); /* Free register info */ CS_FreeRegInfo (S); /* Close output file if necessary */ if (DebugOptOutput) { CloseOutputFile (); } /* Write statistics */ if (StatFileName) { WriteOptStats (StatFileName); } }
AVIFileSink::~AVIFileSink() { completeOutputFile(); // Then, delete each active "AVISubsessionIOState": MediaSubsessionIterator iter(fInputSession); MediaSubsession* subsession; while ((subsession = iter.next()) != NULL) { AVISubsessionIOState* ioState = (AVISubsessionIOState*)(subsession->miscPtr); if (ioState == NULL) continue; delete ioState; } // Finally, close our output file: CloseOutputFile(fOutFid); }
void MinimalizationSimulation(void) { int j,k; REAL Drift,ReferenceEnergy,ran; int NumberOfSystemMoves,NumberOfParticleMoves,NumberOfSteps; int ran_int; Drift=0.0; ReferenceEnergy=0.0; CurrentSystem=0; fprintf(stderr, "Starting minimization\n"); OpenOutputFile(); //InitializeNoseHooverAllSystems(); InitializesEnergiesAllSystems(); InitializesEnergyAveragesAllSystems(); InitializeSmallMCStatisticsAllSystems(); InitializeMCMovesStatisticsAllSystems(); CalculateTotalEnergyAllSystems(); PrintPreSimulationStatus(); for(CurrentSystem=0;CurrentSystem<NumberOfSystems;CurrentSystem++) { for(k=0;k<NumberOfCycles;k++) { InitializesEnergiesAllSystems(); InitializesEnergyAveragesAllSystems(); CalculateTotalEnergyAllSystems(); for(CurrentCycle=0;CurrentCycle<NumberOfInitializationCycles;CurrentCycle++) { if((CurrentCycle%PrintEvery)==0) PrintIntervalStatusInit(CurrentCycle,NumberOfInitializationCycles,OutputFilePtr[CurrentSystem]); NumberOfSystemMoves=12; NumberOfParticleMoves=MAX2(MinimumInnerCycles,NumberOfAdsorbateMolecules[CurrentSystem]+NumberOfCationMolecules[CurrentSystem]); NumberOfSteps=(NumberOfSystemMoves+NumberOfParticleMoves)*NumberOfComponents; for(j=0;j<NumberOfSteps;j++) { ran_int=(int)(RandomNumber()*NumberOfSteps); switch(ran_int) { case 0: if(RandomNumber()<ProbabilityParallelTemperingMove) ParallelTemperingMove(); break; case 1: if(RandomNumber()<ProbabilityHyperParallelTemperingMove) HyperParallelTemperingMove(); break; case 2: if(RandomNumber()<ProbabilityParallelMolFractionMove) ParallelMolFractionMove(); break; case 3: if(RandomNumber()<ProbabilityChiralInversionMove) ChiralInversionMove(); break; case 4: if(RandomNumber()<ProbabilityHybridNVEMove) HybridNVEMove(); break; case 5: if(RandomNumber()<ProbabilityHybridNPHMove) HybridNPHMove(); break; case 6: if(RandomNumber()<ProbabilityHybridNPHPRMove) HybridNPHPRMove(); break; case 7: if(RandomNumber()<ProbabilityVolumeChangeMove) VolumeMove(); break; case 8: if(RandomNumber()<ProbabilityBoxShapeChangeMove) BoxShapeChangeMove(); break; case 9: if(RandomNumber()<ProbabilityGibbsVolumeChangeMove) GibbsVolumeMove(); break; case 10: if(RandomNumber()<ProbabilityFrameworkChangeMove) FrameworkChangeMove(); break; case 11: if(RandomNumber()<ProbabilityFrameworkShiftMove) FrameworkShiftMove(); break; default: // choose component at random CurrentComponent=(int)(RandomNumber()*(REAL)NumberOfComponents); // choose the Monte Carlo move at random ran=RandomNumber(); if(ran<Components[CurrentComponent].ProbabilityTranslationMove) TranslationMove(); else if(ran<Components[CurrentComponent].ProbabilityRandomTranslationMove) RandomTranslationMove(); else if(ran<Components[CurrentComponent].ProbabilityRotationMove) RotationMove(); else if(ran<Components[CurrentComponent].ProbabilityPartialReinsertionMove) PartialReinsertionMove(); else if(ran<Components[CurrentComponent].ProbabilityReinsertionMove) ReinsertionMove(); else if(ran<Components[CurrentComponent].ProbabilityReinsertionInPlaceMove) ReinsertionInPlaceMove(); else if(ran<Components[CurrentComponent].ProbabilityReinsertionInPlaneMove) ReinsertionInPlaneMove(); else if(ran<Components[CurrentComponent].ProbabilityIdentityChangeMove) IdentityChangeMove(); else if(ran<Components[CurrentComponent].ProbabilitySwapMove) { if(RandomNumber()<0.5) SwapAddMove(); else SwapRemoveMove(); } else if(ran<Components[CurrentComponent].ProbabilityWidomMove) ; else if(ran<Components[CurrentComponent].ProbabilitySurfaceAreaMove) ; else if(ran<Components[CurrentComponent].ProbabilityGibbsChangeMove) GibbsParticleTransferMove(); else if(ran<Components[CurrentComponent].ProbabilityGibbsIdentityChangeMove) GibbsIdentityChangeMove(); } } if(CurrentCycle%1000==0) OptimizeTranslationAcceptence(); } // do the minimization Minimization(k); InitializesEnergiesCurrentSystem(); CalculateEnergy(); PrintEnergyStatus(OutputFilePtr[CurrentSystem],"minimization full energy"); } PrintRestartFile(); } PrintPostSimulationStatus(); CloseOutputFile(); }
void GlobalMinimumSimulation(void) { int i,j,k,l; int success; REAL ran,GlobalMinimumEnergy,UInitial,UAfterMC; success=0; GlobalMinimumEnergy=EnergyOverlapCriteria; OpenOutputFile(); PrintPreSimulationStatus(); for(k=0;k<NumberOfCycles;k++) { do { CurrentSystem=0; for(i=0;i<NumberOfAdsorbateMolecules[0];i++) RemoveAdsorbateMolecule(); for(i=0;i<NumberOfCationMolecules[0];i++) RemoveCationMolecule(); for(j=0;j<NumberOfComponents;j++) { if(Components[j].CreateNumberOfMolecules[0]>0) { CurrentSystem=0; if(Components[j].ExtraFrameworkMolecule) MakeInitialCations(Components[j].CreateNumberOfMolecules[0],j); else MakeInitialAdsorbates(Components[j].CreateNumberOfMolecules[0],j); } } CalculateForce(); UInitial=UTotal[0]; for(l=0;l<NumberOfInitializationCycles;l++) { for(j=0;j<MAX2(MinimumInnerCycles,NumberOfAdsorbateMolecules[CurrentSystem]+NumberOfCationMolecules[CurrentSystem]);j++) { // choose component at random CurrentComponent=(int)(RandomNumber()*(REAL)NumberOfComponents); // choose the Monte Carlo move at random ran=RandomNumber(); if(Components[CurrentComponent].ExtraFrameworkMolecule) { if(ran<Components[CurrentComponent].ProbabilityTranslationMove) TranslationMoveCation(); if(ran<Components[CurrentComponent].ProbabilityRotationMove) RotationMoveCation(); else if(ran<Components[CurrentComponent].ProbabilityReinsertionMove) ReinsertionCationMove(); } else { if(ran<Components[CurrentComponent].ProbabilityTranslationMove) TranslationMoveAdsorbate(); if(ran<Components[CurrentComponent].ProbabilityRotationMove) RotationMoveAdsorbate(); else if(ran<Components[CurrentComponent].ProbabilityReinsertionMove) ReinsertionAdsorbateMove(); } } } CalculateForce(); UAfterMC=UTotal[0]; // do the minimization as //success=BakerMinimizationNoOutput(); if(success==0) fprintf(OutputFilePtr[0],"Minimization failed to convergence within %d steps\n",MaximumNumberOfMinimizationSteps); } while(success==0); // recompute energy CalculateForce(); CurrentSystem=0; fprintf(OutputFilePtr[0],"iteration: %d Energy before Monte-Carlo: %18.10f [K] Energy after Monte-Carlo: %18.10f [K]\n", k,UInitial*ENERGY_TO_KELVIN,UAfterMC*ENERGY_TO_KELVIN); fflush(OutputFilePtr[0]); if(UTotal[0]<GlobalMinimumEnergy) { fprintf(OutputFilePtr[0],"found lower new minimum, positions saved to restart-file\n"); GlobalMinimumEnergy=UTotal[0]; PrintRestartFile(); } fprintf(OutputFilePtr[0],"\t\tMinimization steps: %d Minimized energy: %18.10f [K] (%18.10f [kJ/mol]) Global minimum: %18.10f (%18.10f [kJ/mol])\n", success,UTotal[0]*ENERGY_TO_KELVIN,UTotal[0]*ENERGY_TO_KJ_PER_MOL,GlobalMinimumEnergy*ENERGY_TO_KELVIN,GlobalMinimumEnergy*ENERGY_TO_KJ_PER_MOL); fflush(OutputFilePtr[0]); } PrintPostSimulationStatus(); CloseOutputFile(); }
SRecord2C::~SRecord2C() { CloseOutputFile(); }
// ============================================================== // Extract License & Notes files // These are stored as 4-bytes length, followed by length-bytes of compressed data int ExtractTextFile(BLOCK_DATA *Blk, ULONG FileType) { ULONG n, m; BYTE *zSrcBuf = (BYTE *) Blk->SrcBuf; BYTE *zDstBuf = (BYTE *) Blk->DstBuf; const char *FileExt; if (FileType == FLAGS_License) FileExt = LicenseExt; else if (FileType == FLAGS_Notes) FileExt = NotesExt; else return 0; // NB:Can't use BioReadBuf... aligment problems? Yet it works for ProcessNextBlock() !!?? // Ok, can use ReadInputFile here cause everythjing is whole no. of bytes... //BioReadBuf((BYTE *)&n, sizeof(n)); // Read length of block from file ReadInputFile((BYTE *)&n, sizeof(n)); // Read length of block from file FixEndian(&n, sizeof(n)); // Fix endian if (n <= 0 || n > ZBUF_SIZE) // Check for valid block length { sprintf(MsgTxt, "ERROR - Invalid length for %s file (apparently %ld bytes) %s", FileExt, n, CorruptedMsg); msg(MsgTxt, MSG_PopUp); GlobalErrorFlag = SFARKLIB_ERR_CORRUPT; return 0; } //BioReadBuf(zSrcBuf, n); // Read the block ReadInputFile((BYTE *)zSrcBuf, n); // Read the block m = UnMemcomp(zSrcBuf, n, zDstBuf, ZBUF_SIZE); // Uncompress Blk->FileCheck = adler32(Blk->FileCheck, zDstBuf, m); // Accumulate checksum if (GlobalErrorFlag || m > ZBUF_SIZE) // Uncompressed ok & size is valid? return 0; // Write file - Use original file name plus specified extension for OutFileName... char OutFileName[MAX_FILENAME]; strncpy(OutFileName, Blk->FileHeader.FileName, sizeof(OutFileName)); // copy output filename ChangeFileExt(OutFileName, FileExt, sizeof(OutFileName)); OpenOutputFile(OutFileName); // Create notes / license file WriteOutputFile(zDstBuf, m); // and write to output file CloseOutputFile(); if (FileType == FLAGS_License) { sprintf(MsgTxt, "Created license file: %s", OutFileName); msg(MsgTxt, 0); if (GetLicenseAgreement((const char *)zDstBuf, OutFileName) == 0) { GlobalErrorFlag = SFARKLIB_ERR_LICENSE; return EndProcess(0); } } else if (FileType == FLAGS_Notes) { sprintf(MsgTxt, "Created notes file: %s", OutFileName); msg(MsgTxt, 0); DisplayNotes((const char *)zDstBuf, OutFileName); } return 1; }
// ============================================================== int EndProcess(int ErrorNum) { CloseInputFile(); CloseOutputFile(); return ErrorNum; }
HIDCaptureThread::~HIDCaptureThread() { stop(); CloseOutputFile(); m_JostickHistory.clear(); }
void HIDCaptureThread::run() { bool bAutoGenerateData = false;//For testing purpose bool bButtonValueChanged = false; USBHIDDeviceNameSpace::strcJoystickPosition currentJoyPos; m_bIsRunning = true; emit receiveThreadStarted(QDateTime::currentDateTime().toString(MainAppInfo::stdDateTimeFormat())); int res; unsigned char buf[255]; hid_device *handle; if(!bAutoGenerateData) { memset(buf,0x00,sizeof(buf)); struct hid_device_info *devs, *cur_dev; devs = hid_enumerate(0x0, 0x0); cur_dev = devs; //while (cur_dev) { // printf("Device Found\n type: %04hx %04hx\n path: %s\n serial_number: %ls", cur_dev->vendor_id, cur_dev->product_id, cur_dev->path, cur_dev->serial_number); // printf("\n"); // printf(" Manufacturer: %ls\n", cur_dev->manufacturer_string); // printf(" Product: %ls\n", cur_dev->product_string); // printf(" Release: %hx\n", cur_dev->release_number); // printf(" Interface: %d\n", cur_dev->interface_number); // printf("\n"); // cur_dev = cur_dev->next; //} hid_free_enumeration(devs); // Open the device using the VID, PID, and optionally the Serial number. handle = hid_open(m_VendorID, m_ProductID, NULL); if (!handle) { //printf("unable to open device\n"); emit receiveThreadStopped(QDateTime::currentDateTime().toString(MainAppInfo::stdDateTimeFormat())); qCritical("HIDCaptureThread: Could not open HID Device"); m_bIsRunning = false; return; } // Set the hid_read() function to be non-blocking. hid_set_nonblocking(handle, 1); } else { m_HIDData[0] = 0; m_HIDData[1] = 0; m_HIDData[2] = 0; m_HIDData[3] = 0; } while(m_bAbortRunning==false) { // Try to read from the device. There should be no // data here, but execution should not block. if(!bAutoGenerateData) { res = hid_read(handle, buf, sizeof(buf)); } else { res = 4;//We are going to generate these results } if (res>1) { if(!bAutoGenerateData) { //emit captureThreadTriggered(); if(buf[0] > 127) { m_HIDData[0] = (buf[0] - 128); } else { m_HIDData[0] = (buf[0] + 128); } if(buf[1] > 127) { m_HIDData[1] = (buf[1] - 128); } else { m_HIDData[1] = (buf[1] + 128); } m_HIDData[2] = buf[2]; m_HIDData[3] = buf[3]; //Hereafter the center is at position(x,y) (127|128),(127|128) --> (m_HIDData[0],m_HIDData[1]) //The left point(x) is < 127, right point(x) is > 128 --> m_HIDData[0] //The top point(y) is < 127, bottom point(y) is > 128 --> m_HIDData[1] //The Buttons are at m_HIDData[2]; LeftButton = 1, RightButton = 2 //TriggerInput is also at m_HIDData[2], emulates Button;(BNC; inside = TTL, outside = GND) only rising edge(send only a single packet as response)! } else//Generate some dummy data for testing { m_HIDData[0] = m_HIDData[0]+1; m_HIDData[1] = m_HIDData[1]+1; //m_HIDData[2] = m_HIDData[2]+2; //m_HIDData[3] = m_HIDData[3]+2; } if(m_bActivateButtonTriggers) { unsigned char cSignalVal; cNewButtonByteVal = (m_HIDData[2] & m_cButtonMask); switch (m_ButtonDetectCaptureMethod) { case USBHIDDeviceNameSpace::MaskedValueChanged : if (cOldButtonByteVal != cNewButtonByteVal)//any change within masked measurement { emit receiveThreadButtonTriggered(cNewButtonByteVal,cOldButtonByteVal ^ cNewButtonByteVal);//Signal(Difference, Press and Release) bButtonValueChanged = true; } cOldButtonByteVal = cNewButtonByteVal; break; case USBHIDDeviceNameSpace::MaskedValueChangedHigh : cSignalVal = (~cOldButtonByteVal) & cNewButtonByteVal; if(cSignalVal)//any change from low to high { emit receiveThreadButtonTriggered(cNewButtonByteVal,cSignalVal);//Signal(Positive Changes, Press) bButtonValueChanged = true; } cOldButtonByteVal = cNewButtonByteVal; break; case USBHIDDeviceNameSpace::MaskedValueChangedLow : cSignalVal = cOldButtonByteVal & (~cNewButtonByteVal); if(cSignalVal)//any change from high to low { emit receiveThreadButtonTriggered(cNewButtonByteVal,cSignalVal);//Signal(Positive Changes, Release) bButtonValueChanged = true; } cOldButtonByteVal = cNewButtonByteVal; break; } } //Maintain a history currentJoyPos.Xpos = m_HIDData[0]; currentJoyPos.Ypos = m_HIDData[1]; while(m_JostickHistory.size() > m_nJoystickHistorySize) { m_JostickHistory.pop_front();//Maximum size reached } if (m_bActivateJoystickTrigger)//Is the trigger activated? { if(m_JostickHistory.size()>0)//Do we already have a history? { if(!((m_JostickHistory.last().Xpos == currentJoyPos.Xpos) && (m_JostickHistory.last().Ypos == currentJoyPos.Ypos)))//Only when value changed! { if((m_bActivateJoystickStabilisation)&&(m_nJoystickStabilisationThreshold>0)) { if( ((m_JostickHistory.last().Xpos - m_nJoystickStabilisationThreshold) > currentJoyPos.Xpos) || \ ((m_JostickHistory.last().Xpos + m_nJoystickStabilisationThreshold) < currentJoyPos.Xpos) || \ ((m_JostickHistory.last().Ypos - m_nJoystickStabilisationThreshold) > currentJoyPos.Ypos) || \ ((m_JostickHistory.last().Ypos + m_nJoystickStabilisationThreshold) < currentJoyPos.Ypos) ) //Only when value changed enough!! { EmitFilteredData();//Send the trigger if (!OutputCapturedData()) m_bAbortRunning = true; } } else { EmitFilteredData();//Send the trigger if (!OutputCapturedData()) m_bAbortRunning = true; } } } else { EmitFilteredData();//Send the trigger, first record! if (!OutputCapturedData()) m_bAbortRunning = true; } } //else if ((m_bActivateButtonTriggers) && (bButtonValueChanged)) //{ // //} m_JostickHistory.append(currentJoyPos);//Now add the new data record } //QThread::msleep(10); } if(!bAutoGenerateData) hid_close(handle); CloseOutputFile(); m_bAbortRunning = false; m_bIsRunning = false; emit receiveThreadStopped(QDateTime::currentDateTime().toString(MainAppInfo::stdDateTimeFormat())); return; }
//使用到numerator、denominator、type、ctrl、起始时间,终止时间 int CSeedManager::CreateOutputFile( const WCHAR* path, CtrlParam* pctrl ) { int ret = TRUE; WCHAR filename[MAX_PATH]; //CtrlParam ctrl; CloseOutputFile(); if(m_list->GetElementCnt() <= 0) return FALSE; // memcpy(&ctrl, pctrl, sizeof(CtrlParam)); // wcscpy_s(ctrl.station, sizeof(ctrl.station)/sizeof(WCHAR), m_station); // wcscpy_s(ctrl.channel, sizeof(ctrl.channel)/sizeof(WCHAR), m_channel); wcscpy_s(pctrl->station, sizeof(pctrl->station)/sizeof(WCHAR), m_station); wcscpy_s(pctrl->channel, sizeof(pctrl->channel)/sizeof(WCHAR), m_channel); if(FALSE == AdjustValidParam(pctrl)) return FALSE; switch (pctrl->type) { case EXPORT_TXT: m_exp = new CTxtExport; break; case EXPORT_BIN: m_exp = new CBinExport; break; case EXPORT_MSEED: m_exp = new CMSeedExport; break; case EXPORT_SEED: m_exp = new CSeedExport; break; default: return FALSE; } m_filetype = pctrl->type; GetMergeFileName(path, filename, pctrl); char szfilename[MAX_PATH]; WcharNameToCharName(szfilename, MAX_PATH, filename, wcslen(filename)); if(FALSE == m_exp->Create(filename, pctrl)) { if(m_plog != NULL) { DWORD res = GetLastError(); sprintf_s(m_plog->logString, sizeof(m_plog->logString), "file name:%s. error code:%d", szfilename, res); m_plog->FormatAndAppendLog(error_seed, erro_export_file_create_failed, m_plog->logString); } delete m_exp; m_exp = NULL; ret = FALSE; }else if(m_plog != NULL) { SYSTEMTIME loc; GetLocalTime(&loc); sprintf_s(m_plog->logString, sizeof(m_plog->logString), "file name:%s." "at time:%4d-%2d-%2d,%2d:%2d:%2d", szfilename, loc.wYear, loc.wMonth, loc.wDay, loc.wHour, loc.wMinute, loc.wSecond); m_plog->FormatAndAppendLog(info_seed, info_merge_file_created, m_plog->logString); } //保存日志 if(m_plog != NULL) m_plog->SaveLog(); return ret; }
/** * Closes the file */ void FStatNotifyProvider_File::Destroy(void) { // Close the output file if we have one CloseOutputFile(); }
/** * Stop writing stats data and finalize the file */ void FStatNotifyProvider_BinaryFile::StopWritingStatsFile() { if( File != NULL ) { FArchive& OutputFile = *File; // Make sure the stats manager has a fresh list of descriptions for us. Note that // this MUST happen after we've finished capturing stat data, because some stat types // are added on-demand, such as script cycle stats // @todo: This is a bit sketchy right here, we should avoid hitting the other provider types GStatManager.SendNotifiersDescriptions(); // Write group descriptions { // Write data chunk tag for 'Script profiler data' DWORD DataChunkTag = EStatsDataChunkTag_GroupDescriptions; OutputFile << DataChunkTag; /* const */ WORD GroupDescriptionCount = GroupDescriptions.Num(); OutputFile << GroupDescriptionCount; for( WORD CurGroupIndex = 0; CurGroupIndex < GroupDescriptionCount; ++CurGroupIndex ) { /* const */ FStatGroupDescriptionData& CurGroupDesc = GroupDescriptions( CurGroupIndex ); WORD ShortGroupID = CurGroupDesc.ID; OutputFile << ShortGroupID; OutputFile << CurGroupDesc.Name; } } // Write stat descriptions { // Write data chunk tag for 'Script profiler data' DWORD DataChunkTag = EStatsDataChunkTag_StatDescriptions; OutputFile << DataChunkTag; /* const */ WORD StatDescriptionCount = StatDescriptions.Num(); OutputFile << StatDescriptionCount; for( WORD CurStatIndex = 0; CurStatIndex < StatDescriptionCount; ++CurStatIndex ) { /* const */ FStatDescriptionData& CurStatDesc = StatDescriptions( CurStatIndex ); WORD ShortStatID = CurStatDesc.ID; OutputFile << ShortStatID; OutputFile << CurStatDesc.Name; BYTE ShortStatType = CurStatDesc.StatType; OutputFile << ShortStatType; WORD ShortGroupID = CurStatDesc.GroupID; OutputFile << ShortGroupID; BYTE ShortIsScriptFunctionStat = CurStatDesc.bIsScriptFunctionStat; OutputFile << ShortIsScriptFunctionStat; } } const FString FullFileName = ArchiveFilename; // Flush and close the file CloseOutputFile(); warnf(TEXT("UE3Stats: done writing file [%s]"),*(FullFileName)); SendDataToPCViaUnrealConsole( TEXT("UE_PROFILER!UE3STATS:"), FullFileName ); // Decrease counter forcing scoped cycle stats to be enabled. --GForceEnableScopedCycleStats; debugf( TEXT( "Stats System: Finished capturing stat data." ) ); } else { // File not started yet? debugf( TEXT( "Stats System: Stats file capture hasn't been started yet." ) ); } }
RESLT COutputReader::OpenOutputFile(TCHAR *FileName) { DWORD bytes; //int i; //SPECIESBINOUTINF speInf; CEnvironmentData bath; CEnvironmentData salt; CEnvironmentData temp; //DWORD filePointer; //RESLT res; //BOOL rslt; if(m_hdl != NULL && m_hdl != INVALID_HANDLE_VALUE) CloseOutputFile(); m_hdl = CreateFile(FileName, GENERIC_READ, NULL, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, 0); if(m_hdl == INVALID_HANDLE_VALUE) return OPENFILEREAD_ERROR; if(FALSE == ReadFile(m_hdl, &m_sceParams, sizeof(_fSCENARIOPARAMS), &bytes, NULL)) { CloseOutputFile(); return FILEREAD_ERROR; } //CloseOutputFile(); return OK; // Not sure about what follows # if 0 m_binOutputConfig = CFileManager::TranslateBinFileOutConfiguration(m_sceParams.binOutStateItemConfig); // Read in the bathymetry file (if the scenario was configured to save it). if(m_binOutputConfig.headerInf.bathyMap == TRUE && OK != (res = bath.LoadFromBinFile(m_hdl))) { CloseOutputFile(); return res; } // Read in the salinity file (if the scenario was configured to save it). if(m_binOutputConfig.headerInf.salinityMap == TRUE && OK != (res = salt.LoadFromBinFile(m_hdl))) { CloseOutputFile(); return res; } // Read in the temperature file (if the scenario was configured to save it). if(m_binOutputConfig.headerInf.temperatureMap == TRUE && OK != (res = temp.LoadFromBinFile(m_hdl))) { CloseOutputFile(); return res; } // Skip past statistical data if scenario was configured to save it. if(m_binOutputConfig.headerInf.postRunAnalysis == TRUE) { filePointer = MySetFilePointer(m_hdl, sizeof(TAKE), FILE_CURRENT); filePointer = MySetFilePointer(m_hdl, sizeof(TAKESTATS)*m_sceParams.numSpecies, FILE_CURRENT); } // Read in species model information (if the scenario was configured to save it). if(m_binOutputConfig.headerInf.speInfAndAnimatAsscn == TRUE) { _ASSERT(m_speInf == NULL); _ASSERT(m_aniAssoc == NULL); m_speInf = new SPECIESBINOUTINF[m_sceParams.numSpecies]; m_aniAssoc = new ANIMATASSCN[m_sceParams.totalNumAnimats]; // Skip over minor species information for(i=0; i<(int)m_sceParams.numSpecies && rslt == TRUE; i++) { if(FALSE == (rslt = ReadFile(m_hdl, &m_speInf[i], sizeof(SPECIESBINOUTINF), &bytes, NULL))) return FILEREAD_ERROR; // Skip past the behavior names that belong to this species. filePointer = MySetFilePointer(m_hdl, __int64(m_speInf[i].description.numBehaviors) * sizeof(BEHAVIOR_NAME), FILE_CURRENT); if(INVALID_SET_FILE_POINTER == filePointer) return SETFILEPOINTER_ERROR; } // Read in animat summaries/association to species. rslt &= ReadFile(m_hdl, m_aniAssoc, m_sceParams.totalNumAnimats * sizeof(ANIMATASSCN), &bytes, NULL); return FILEREAD_ERROR; } // Skip over acoustic exposures, get the file pointer for animat states (- 1 // to number of iterations because because an initial AE isn't saved). m_filePointerAnimats = MySetFilePointer(m_hdl, __int64(m_sceParams.duration-1) * sizeof(ACST_SRC_STATE), FILE_CURRENT); if(INVALID_SET_FILE_POINTER == filePointer) return SETFILEPOINTER_ERROR; return OK; #endif }
void MolecularDynamicsSimulation(void) { int i,j,k; REAL ran; // for a crash-recovery we skip the initialization and jump to the // position right after the crash-file was written in the production run if(ContinueAfterCrash) { if(SimulationStage==POSITION_INITIALIZATION) goto ContinueAfterCrashLabel1; else if(SimulationStage==VELOCITY_EQUILIBRATION) goto ContinueAfterCrashLabel2; else goto ContinueAfterCrashLabel3; } // compute gas properties // here the pressure is converted to fugacities ComputeGasPropertiesForAllSystems(); // open output-file OpenOutputFile(); // print all the pre-simulations data PrintPreSimulationStatus(); // allocate memory SampleRadialDistributionFunction(ALLOCATE); SampleProjectedLengthsDistributionFunction(ALLOCATE); SampleProjectedAnglesDistributionFunction(ALLOCATE); SampleNumberOfMoleculesHistogram(ALLOCATE); SamplePositionHistogram(ALLOCATE); SampleFreeEnergyProfile(ALLOCATE); SampleEndToEndDistanceHistogram(ALLOCATE); SampleEnergyHistogram(ALLOCATE); SampleFrameworkSpacingHistogram(ALLOCATE); SampleResidenceTimes(ALLOCATE); SampleDistanceHistogram(ALLOCATE); SampleBendAngleHistogram(ALLOCATE); SampleDihedralAngleHistogram(ALLOCATE); SampleAngleBetweenPlanesHistogram(ALLOCATE); SampleMoleculePropertyHistogram(ALLOCATE); SampleInfraRedSpectra(ALLOCATE); SampleMeanSquaredDisplacementOrderN(ALLOCATE); SampleVelocityAutoCorrelationFunctionOrderN(ALLOCATE); SampleRotationalVelocityAutoCorrelationFunctionOrderN(ALLOCATE); SampleMolecularOrientationAutoCorrelationFunctionOrderN(ALLOCATE); SampleBondOrientationAutoCorrelationFunctionOrderN(ALLOCATE); SampleMeanSquaredDisplacement(ALLOCATE); SampleVelocityAutoCorrelationFunction(ALLOCATE); SampleDensityProfile3DVTKGrid(ALLOCATE); SampleCationAndAdsorptionSites(ALLOCATE); SampleDcTSTConfigurationFiles(ALLOCATE); SamplePDBMovies(ALLOCATE,-1); // initialize InitializesEnergiesAllSystems(); InitializeSmallMCStatisticsAllSystems(); InitializeMCMovesStatisticsAllSystems(); // compute initial energy CalculateTotalEnergyAllSystems(); // Monte-Carlo initializing period to achieve a rapid equilibration of the positions SimulationStage=POSITION_INITIALIZATION; for(CurrentCycle=0;CurrentCycle<NumberOfInitializationCycles;CurrentCycle++) { if((CurrentCycle%PrintEvery)==0) for(CurrentSystem=0;CurrentSystem<NumberOfSystems;CurrentSystem++) PrintIntervalStatusInit(CurrentCycle,NumberOfInitializationCycles,OutputFilePtr[CurrentSystem]); for(j=0;j<NumberOfSystems*NumberOfComponents;j++) { // choose a random system CurrentSystem=(int)(RandomNumber()*(REAL)NumberOfSystems); for(k=0;k<MAX2(MinimumInnerCycles,NumberOfAdsorbateMolecules[CurrentSystem]);k++) { // choose a random component CurrentComponent=(int)(RandomNumber()*(REAL)NumberOfComponents); // choose any of the MC moves randomly with the selected probability ran=RandomNumber(); if(ran<Components[CurrentComponent].ProbabilityTranslationMove) TranslationMove(); else if(ran<Components[CurrentComponent].ProbabilityRandomTranslationMove) RandomTranslationMove(); else if(ran<Components[CurrentComponent].ProbabilityRotationMove) RotationMove(); else if(ran<Components[CurrentComponent].ProbabilityPartialReinsertionMove) PartialReinsertionMove(); else if(ran<Components[CurrentComponent].ProbabilityReinsertionMove) ReinsertionMove(); else if(ran<Components[CurrentComponent].ProbabilityReinsertionInPlaceMove) ReinsertionInPlaceMove(); else if(ran<Components[CurrentComponent].ProbabilityReinsertionInPlaneMove) ReinsertionInPlaneMove(); else if(ran<Components[CurrentComponent].ProbabilityIdentityChangeMove) IdentityChangeMove(); else if(ran<Components[CurrentComponent].ProbabilitySwapMove) { if(RandomNumber()<0.5) SwapAddMove(); else SwapRemoveMove(); } else if(ran<Components[CurrentComponent].ProbabilityCFSwapLambdaMove) CFSwapLambaMove(); else if(ran<Components[CurrentComponent].ProbabilityCBCFSwapLambdaMove) CBCFSwapLambaMove(); else if(ran<Components[CurrentComponent].ProbabilityWidomMove) ; else if(ran<Components[CurrentComponent].ProbabilitySurfaceAreaMove) ; else if(ran<Components[CurrentComponent].ProbabilityGibbsChangeMove) GibbsParticleTransferMove(); else if(ran<Components[CurrentComponent].ProbabilityGibbsIdentityChangeMove) GibbsIdentityChangeMove(); else if(ran<Components[CurrentComponent].ProbabilityCFGibbsChangeMove) CFGibbsParticleTransferMove(); else if(ran<Components[CurrentComponent].ProbabilityCBCFGibbsChangeMove) CBCFGibbsParticleTransferMove(); else if(ran<Components[CurrentComponent].ProbabilityParallelTemperingMove) ParallelTemperingMove(); else if(ran<Components[CurrentComponent].ProbabilityHyperParallelTemperingMove) HyperParallelTemperingMove(); else if(ran<Components[CurrentComponent].ProbabilityParallelMolFractionMove) ParallelMolFractionMove(); else if(ran<Components[CurrentComponent].ProbabilityChiralInversionMove) ChiralInversionMove(); else if(ran<Components[CurrentComponent].ProbabilityHybridNVEMove) HybridNVEMove(); else if(ran<Components[CurrentComponent].ProbabilityHybridNPHMove) HybridNPHMove(); else if(ran<Components[CurrentComponent].ProbabilityHybridNPHPRMove) HybridNPHPRMove(); else if(ran<Components[CurrentComponent].ProbabilityVolumeChangeMove) VolumeMove(); else if(ran<Components[CurrentComponent].ProbabilityBoxShapeChangeMove) BoxShapeChangeMove(); else if(ran<Components[CurrentComponent].ProbabilityGibbsVolumeChangeMove) GibbsVolumeMove(); else if(ran<Components[CurrentComponent].ProbabilityFrameworkChangeMove) FrameworkChangeMove(); else if(ran<Components[CurrentComponent].ProbabilityFrameworkShiftMove) FrameworkShiftMove(); } } if(CurrentCycle%PrintEvery==0) { for(CurrentSystem=0;CurrentSystem<NumberOfSystems;CurrentSystem++) { OptimizeVolumeChangeAcceptence(); OptimizeTranslationAcceptence(); if(Framework[CurrentSystem].FrameworkModel==FLEXIBLE) { OptimizeFrameworkChangeAcceptence(); OptimizeFrameworkShiftAcceptence(); } RescaleMaximumRotationAnglesSmallMC(); } } if((CurrentCycle>0)&&(WriteBinaryRestartFileEvery>0)&&(CurrentCycle%WriteBinaryRestartFileEvery==0)) WriteBinaryRestartFiles(); ContinueAfterCrashLabel1:; } // initialize InitializesEnergiesAllSystems(); InitializeSmallMCStatisticsAllSystems(); InitializeMCMovesStatisticsAllSystems(); SimulationStage=VELOCITY_SCALING; if(ReinitializeVelocities) { for(CurrentSystem=0;CurrentSystem<NumberOfSystems;CurrentSystem++) { InitializeAdsorbateVelocities(); InitializeCationVelocities(); if(Framework[CurrentSystem].FrameworkModel==FLEXIBLE) InitializeFrameworkVelocities(); RemoveVelocityDrift(); //AdjustSystemAngularRotationToZero(); } } //InitializeNoseHooverCurrentSystem(); InitializeNoseHooverAllSystems(); // compute initial energy InitializeForcesAllSystems(); // Molecular-Dynamics initializing period to remove excessive kinetic energy due to // poor equilibration of the positions (use with caution) // Velocity-scaling scales the velocities at each time step to the desired temperature /* for(CurrentCycle=0;CurrentCycle<NumberOfVelocityScalingCycles;CurrentCycle++) { for(CurrentSystem=0;CurrentSystem<NumberOfSystems;CurrentSystem++) { // scake the velocity to the exact temperature AdjustVelocitiesToTemperature(); // regularly output system status and restart files if(CurrentCycle%PrintEvery==0) { PrintIntervalStatusEquilibration(CurrentCycle,NumberOfEquilibrationCycles,OutputFilePtr[CurrentSystem]); PrintRestartFile(); } // evolve the system a full time-step Integration(); } } */ // set the current ensemble to the initialization ensemble for(i=0;i<NumberOfSystems;i++) Ensemble[i]=InitEnsemble[i]; InitializesEnergyAveragesAllSystems(); for(CurrentSystem=0;CurrentSystem<NumberOfSystems;CurrentSystem++) { ReferenceEnergy[CurrentSystem]=ConservedEnergy[CurrentSystem]; Drift[CurrentSystem]=0.0; } // Molecular-Dynamics initializing period to achieve a rapid equilibration of the velocities SimulationStage=VELOCITY_EQUILIBRATION; for(CurrentCycle=0;CurrentCycle<NumberOfEquilibrationCycles;CurrentCycle++) { for(CurrentSystem=0;CurrentSystem<NumberOfSystems;CurrentSystem++) { // regularly output system status and restart files if(CurrentCycle%PrintEvery==0) { PrintIntervalStatusEquilibration(CurrentCycle,NumberOfEquilibrationCycles,OutputFilePtr[CurrentSystem]); PrintRestartFile(); } // insertion/deletion for the osmotic-ensemble if(Ensemble[CurrentSystem]==MuPT) { CurrentComponent=(int)(RandomNumber()*NumberOfComponents); if((CurrentCycle%(Components[CurrentComponent].SwapEvery)==0)&& (Components[CurrentComponent].ProbabilitySwapMove>0.0)) { if(RandomNumber()<0.5) SwapAddMove(); else SwapRemoveMove(); } } // evolve the system a full time-step Integration(); // prevent heating of the core-shells AdjustCoreShellVelocities(); // update the current energy-drift Drift[CurrentSystem]+=fabs((ConservedEnergy[CurrentSystem]-ReferenceEnergy[CurrentSystem])/ReferenceEnergy[CurrentSystem]); } if((CurrentCycle>0)&&(WriteBinaryRestartFileEvery>0)&&(CurrentCycle%WriteBinaryRestartFileEvery==0)) WriteBinaryRestartFiles(); ContinueAfterCrashLabel2:; } // initialize sampling-routines at the start of the production run for(CurrentSystem=0;CurrentSystem<NumberOfSystems;CurrentSystem++) { Ensemble[CurrentSystem]=RunEnsemble[CurrentSystem]; ReferenceEnergy[CurrentSystem]=ConservedEnergy[CurrentSystem]; Drift[CurrentSystem]=0.0; SampleRadialDistributionFunction(INITIALIZE); SampleProjectedLengthsDistributionFunction(INITIALIZE); SampleProjectedAnglesDistributionFunction(INITIALIZE); SampleNumberOfMoleculesHistogram(INITIALIZE); SamplePositionHistogram(INITIALIZE); SampleFreeEnergyProfile(INITIALIZE); SampleEndToEndDistanceHistogram(INITIALIZE); SampleEnergyHistogram(INITIALIZE); SampleFrameworkSpacingHistogram(INITIALIZE); SampleResidenceTimes(INITIALIZE); SampleDistanceHistogram(INITIALIZE); SampleBendAngleHistogram(INITIALIZE); SampleDihedralAngleHistogram(INITIALIZE); SampleAngleBetweenPlanesHistogram(INITIALIZE); SampleMoleculePropertyHistogram(INITIALIZE); SampleInfraRedSpectra(INITIALIZE); SampleMeanSquaredDisplacementOrderN(INITIALIZE); SampleVelocityAutoCorrelationFunctionOrderN(INITIALIZE); SampleRotationalVelocityAutoCorrelationFunctionOrderN(INITIALIZE); SampleMolecularOrientationAutoCorrelationFunctionOrderN(INITIALIZE); SampleBondOrientationAutoCorrelationFunctionOrderN(INITIALIZE); SampleMeanSquaredDisplacement(INITIALIZE); SampleVelocityAutoCorrelationFunction(INITIALIZE); SampleDensityProfile3DVTKGrid(INITIALIZE); SampleCationAndAdsorptionSites(INITIALIZE); SampleDcTSTConfigurationFiles(INITIALIZE); SamplePDBMovies(INITIALIZE,-1); } // Molecular-Dynamics production run // loop over the amount of production cycles (MD integration steps) SimulationStage=PRODUCTION; for(CurrentCycle=0;CurrentCycle<NumberOfCycles;CurrentCycle++) { // detect erroneous chirality changes for(CurrentSystem=0;CurrentSystem<NumberOfSystems;CurrentSystem++) CheckChiralityMolecules(); // loop over all the systems and handle one by one for(CurrentSystem=0;CurrentSystem<NumberOfSystems;CurrentSystem++) { // update all the average energies UpdateEnergyAveragesCurrentSystem(); if(CurrentCycle%PrintPropertiesEvery==0) PrintPropertyStatus(CurrentCycle,NumberOfCycles,OutputFilePtr[CurrentSystem]); if(CurrentCycle%PrintEvery==0) { PrintIntervalStatus(CurrentCycle,NumberOfCycles,OutputFilePtr[CurrentSystem]); PrintRestartFile(); } // insertion/deletion for the osmotic-ensemble if(Ensemble[CurrentSystem]==MuPT) { CurrentComponent=(int)(RandomNumber()*NumberOfComponents); if((CurrentCycle%(Components[CurrentComponent].SwapEvery)==0)&& (Components[CurrentComponent].FractionOfSwapMove>0.0)) { if(RandomNumber()<0.5) SwapAddMove(); else SwapRemoveMove(); } } for(CurrentComponent=0;CurrentComponent<NumberOfComponents;CurrentComponent++) { if(Components[CurrentComponent].FractionOfWidomMove>0.0) WidomMove(); } // evolve the system a full time step Integration(); // update the current energy-drift Drift[CurrentSystem]+=fabs((ConservedEnergy[CurrentSystem]-ReferenceEnergy[CurrentSystem])/ ReferenceEnergy[CurrentSystem]); if(Drift[CurrentSystem]/(CurrentCycle+1.0)>1e2) { fprintf(OutputFilePtr[CurrentSystem],"\n\nERROR: unstable integration (energy drift %g > 1e2, simulation stopped)\n\n",Drift[CurrentSystem]/(CurrentCycle+1.0)); fprintf(OutputFilePtr[CurrentSystem],"Check that: 1) all interaction are defined properly\n"); fprintf(OutputFilePtr[CurrentSystem]," 2) the time step is not too large\n"); fprintf(OutputFilePtr[CurrentSystem]," 3) the system is equilibrated\n\n"); fflush(OutputFilePtr[CurrentSystem]); exit(0); } } for(CurrentSystem=0;CurrentSystem<NumberOfSystems;CurrentSystem++) { SampleRadialDistributionFunction(SAMPLE); SampleProjectedLengthsDistributionFunction(SAMPLE); SampleProjectedAnglesDistributionFunction(SAMPLE); SampleNumberOfMoleculesHistogram(SAMPLE); SamplePositionHistogram(SAMPLE); SampleFreeEnergyProfile(SAMPLE); SampleEndToEndDistanceHistogram(SAMPLE); SampleEnergyHistogram(SAMPLE); SampleFrameworkSpacingHistogram(SAMPLE); SampleResidenceTimes(SAMPLE); SampleDistanceHistogram(SAMPLE); SampleBendAngleHistogram(SAMPLE); SampleDihedralAngleHistogram(SAMPLE); SampleAngleBetweenPlanesHistogram(SAMPLE); SampleMoleculePropertyHistogram(SAMPLE); SampleInfraRedSpectra(SAMPLE); SampleMeanSquaredDisplacementOrderN(SAMPLE); SampleVelocityAutoCorrelationFunctionOrderN(SAMPLE); SampleRotationalVelocityAutoCorrelationFunctionOrderN(SAMPLE); SampleMolecularOrientationAutoCorrelationFunctionOrderN(SAMPLE); SampleBondOrientationAutoCorrelationFunctionOrderN(SAMPLE); SampleMeanSquaredDisplacement(SAMPLE); SampleVelocityAutoCorrelationFunction(SAMPLE); SampleDensityProfile3DVTKGrid(SAMPLE); SampleCationAndAdsorptionSites(SAMPLE); SampleDcTSTConfigurationFiles(SAMPLE); SamplePDBMovies(SAMPLE,-1); } if((CurrentCycle>0)&&(WriteBinaryRestartFileEvery>0)&&(CurrentCycle%WriteBinaryRestartFileEvery==0)) WriteBinaryRestartFiles(); ContinueAfterCrashLabel3:; for(CurrentSystem=0;CurrentSystem<NumberOfSystems;CurrentSystem++) { // regulary output sampling function SampleRadialDistributionFunction(PRINT); SampleProjectedLengthsDistributionFunction(PRINT); SampleProjectedAnglesDistributionFunction(PRINT); SampleNumberOfMoleculesHistogram(PRINT); SamplePositionHistogram(PRINT); SampleFreeEnergyProfile(PRINT); SampleEndToEndDistanceHistogram(PRINT); SampleEnergyHistogram(PRINT); SampleFrameworkSpacingHistogram(PRINT); SampleResidenceTimes(PRINT); SampleDistanceHistogram(PRINT); SampleBendAngleHistogram(PRINT); SampleDihedralAngleHistogram(PRINT); SampleAngleBetweenPlanesHistogram(PRINT); SampleMoleculePropertyHistogram(PRINT); SampleInfraRedSpectra(PRINT); SampleMeanSquaredDisplacementOrderN(PRINT); SampleVelocityAutoCorrelationFunctionOrderN(PRINT); SampleRotationalVelocityAutoCorrelationFunctionOrderN(PRINT); SampleMolecularOrientationAutoCorrelationFunctionOrderN(PRINT); SampleBondOrientationAutoCorrelationFunctionOrderN(PRINT); SampleMeanSquaredDisplacement(PRINT); SampleVelocityAutoCorrelationFunction(PRINT); SampleDensityProfile3DVTKGrid(PRINT); SampleCationAndAdsorptionSites(PRINT); SampleDcTSTConfigurationFiles(PRINT); if(Movies[CurrentSystem]&&(CurrentCycle%WriteMoviesEvery[CurrentSystem]==0)) SamplePDBMovies(PRINT,-1); } } if(WriteBinaryRestartFileEvery>0) WriteBinaryRestartFiles(); // finalize and clean up for(CurrentSystem=0;CurrentSystem<NumberOfSystems;CurrentSystem++) { SampleRadialDistributionFunction(FINALIZE); SampleProjectedLengthsDistributionFunction(FINALIZE); SampleProjectedAnglesDistributionFunction(FINALIZE); SampleNumberOfMoleculesHistogram(FINALIZE); SamplePositionHistogram(FINALIZE); SampleFreeEnergyProfile(FINALIZE); SampleEndToEndDistanceHistogram(FINALIZE); SampleEnergyHistogram(FINALIZE); SampleFrameworkSpacingHistogram(FINALIZE); SampleResidenceTimes(FINALIZE); SampleDistanceHistogram(FINALIZE); SampleBendAngleHistogram(FINALIZE); SampleDihedralAngleHistogram(FINALIZE); SampleAngleBetweenPlanesHistogram(FINALIZE); SampleMoleculePropertyHistogram(FINALIZE); SampleInfraRedSpectra(FINALIZE); SampleMeanSquaredDisplacementOrderN(FINALIZE); SampleVelocityAutoCorrelationFunctionOrderN(FINALIZE); SampleRotationalVelocityAutoCorrelationFunctionOrderN(FINALIZE); SampleMolecularOrientationAutoCorrelationFunctionOrderN(FINALIZE); SampleBondOrientationAutoCorrelationFunctionOrderN(FINALIZE); SampleMeanSquaredDisplacement(FINALIZE); SampleVelocityAutoCorrelationFunction(FINALIZE); SampleDensityProfile3DVTKGrid(FINALIZE); SampleCationAndAdsorptionSites(FINALIZE); SampleDcTSTConfigurationFiles(FINALIZE); SamplePDBMovies(FINALIZE,-1); } // print post-status PrintPostSimulationStatus(); CloseOutputFile(); }