예제 #1
0
파일: pmdViz.c 프로젝트: sbiersdorff/CoMD
int main(int argc, char **argv) {
  command_t cmd;
  simflat_t *sim;
  SimThreadData* threadData;

  /* get sim_flat from cmdline */
  sim = initSimFromCmdLine(argc, argv);

  writeClsman(sim,(char *) "init.bin");

  /* start computation thread */
  if(1) {
    pthread_t computationThread;
    pthread_t visualizationThread;
    AtomVisualize* viz = new AtomVisualize();

    viz->initialize(sim);
    viz->updateData(sim);
    viz->renderData();
      
    threadData = new SimThreadData;
    threadData->sim = sim;
    threadData->viz = viz;
		  
    pthread_create(&computationThread, NULL, computation_thread, (void*) threadData);
    viz->interact();
  }

  writeClsman(sim,(char *) "final.bin");

  /* release sim_flat */
  destroySimulation(&sim); 	

  return 0;
}
예제 #2
0
파일: CoMD_lib.c 프로젝트: oxbow-apps/CoHMM
CoMD_return CoMD_lib(CoMD_input *inputStruct)
{

  // Prolog
  //profileStart(totalTimer);
  //initSubsystems();
  
  
  //Command cmd = parseCommandLine(argc, argv);
  
  Command cmd = parseInputStruct(inputStruct);
  
  
  //Ignore stressSuffix for now
  SimFlat* sim = initSimulation(cmd);
  
   Validate* validate = initValidate(sim); // atom counts, energy

	// This is the CoMD main loop
   const int nSteps = sim->nSteps;
   const int printRate = sim->printRate;
   
   double avgStress[9];
   int stressi;
   int iStep;
   for(stressi=0;stressi<9;stressi++) avgStress[stressi]=0;
   
   for (iStep=0; iStep<nSteps;iStep++)
   {
     sumAtoms(sim);
     //Find and intercept these to write to the struct
     //printThings(sim, iStep, getElapsedTime(timestepTimer));
     printTensor(iStep, sim->defInfo->stress);      
     timestep(sim, 1, sim->dt);
     if(iStep>500){
       for(stressi=0;stressi<9;stressi++) avgStress[stressi]+=sim->defInfo->stress[stressi]/(nSteps-500);
     }
   }
   
   sumAtoms(sim);
   //Find and intercept
   //printThings(sim, iStep, getElapsedTime(timestepTimer));
   CoMD_return retVal = printStuff(iStep, sim, avgStress);
   
   // Epilog
   //validateResult(validate, sim);
   //profileStop(totalTimer);
   
   /*
   if (sim->pot->dfEmbed!=NULL) {
     free(sim->pot->dfEmbed);
     sim->pot->dfEmbed=NULL;
   }
   if (sim->pot->rhobar!=NULL) {
     free(sim->pot->rhobar);
     sim->pot->rhobar=NULL;
   }
   if (sim->pot->forceExchangeData!=NULL) {
     free(sim->pot->forceExchangeData);
     sim->pot->forceExchangeData=NULL;
   }*/

   destroySimulation(&sim);
   comdFree(validate);
   //finalizeSubsystems();//???

   //destroyParallel();  //???
   
	return retVal;
}
예제 #3
0
파일: CoMD.c 프로젝트: shamouda/ocr-apps
int main(int argc, char** argv)
{
   // Prolog
   initParallel(&argc, &argv);
   profileStart(totalTimer);
   initSubsystems();
   timestampBarrier("Starting Initialization\n");

   yamlAppInfo(yamlFile);
   yamlAppInfo(screenOut);

   Command cmd = parseCommandLine(argc, argv);
   printCmdYaml(yamlFile, &cmd);
   printCmdYaml(screenOut, &cmd);

   SimFlat* sim = initSimulation(cmd);
   printSimulationDataYaml(yamlFile, sim);
   printSimulationDataYaml(screenOut, sim);

   Validate* validate = initValidate(sim); // atom counts, energy
   timestampBarrier("Initialization Finished\n");

   timestampBarrier("Starting simulation\n");

   // This is the CoMD main loop
   const int nSteps = sim->nSteps;
   const int printRate = sim->printRate;
   int iStep = 0;
   profileStart(loopTimer);
   for (; iStep<nSteps;)
   {
      startTimer(commReduceTimer);
      sumAtoms(sim);
      stopTimer(commReduceTimer);

      printThings(sim, iStep, getElapsedTime(timestepTimer));

      startTimer(timestepTimer);
      timestep(sim, printRate, sim->dt);
      stopTimer(timestepTimer);

      iStep += printRate;
   }
   profileStop(loopTimer);

   sumAtoms(sim);
   printThings(sim, iStep, getElapsedTime(timestepTimer));
   timestampBarrier("Ending simulation\n");

   // Epilog
   validateResult(validate, sim);
   profileStop(totalTimer);

   printPerformanceResults(sim->atoms->nGlobal);
   printPerformanceResultsYaml(yamlFile);

   destroySimulation(&sim);
   comdFree(validate);
   finalizeSubsystems();

   timestampBarrier("CoMD Ending\n");
   destroyParallel();

   return 0;
}