void BondAngleDistribution::writeBondAngleDistribution() {

    RealType norm = (RealType)nTotBonds_*((RealType)nTotBonds_-1.0)/2.0;
    
    std::ofstream ofs(getOutputFileName().c_str());

    if (ofs.is_open()) {
            
      Revision r;
      
      ofs << "# " << getAnalysisType() << "\n";
      ofs << "# OpenMD " << r.getFullRevision() << "\n";
      ofs << "# " << r.getBuildDate() << "\n";
      ofs << "# selection script: \"" << selectionScript_ << "\"\n";
      if (!paramString_.empty())
        ofs << "# parameters: " << paramString_ << "\n";

      // Normalize by number of frames and write it out:
      for (int i = 0; i < nBins_; ++i) {
        RealType Thetaval = i * deltaTheta_;               
        ofs << Thetaval;        
        ofs << "\t" << (RealType)histogram_[i]/norm/frameCounter_;        
        ofs << "\n";
      }
      
      ofs.close();
      
    } else {
      sprintf(painCave.errMsg, "BondAngleDistribution: unable to open %s\n", 
              (getOutputFileName() + "q").c_str());
      painCave.isFatal = 1;
      simError();  
    }
    
  }
Beispiel #2
0
 void GCN::writeData() {
   std::ofstream ofs(outputFilename_.c_str(), std::ios::binary);
   
   if (ofs.is_open()) {
     
     Revision r;
     RealType binValue(0.0);
     
     ofs << "# " << getAnalysisType() << "\n";
     ofs << "# OpenMD " << r.getFullRevision() << "\n";
     ofs << "# " << r.getBuildDate() << "\n";
     ofs << "# selection script1: \"" << sele1_ ;
     ofs << "\"\tselection script2: \"" << sele2_ << "\"\n";
     if (!paramString_.empty())
       ofs << "# parameters: " << paramString_ << "\n";
     
     for(unsigned int n = 0; n < histogram_.size(); n++){
       binValue = n * delta_;
       ofs << binValue << "\t"
           << histogram_[n]
           << "\n";
     } 
   }   
   ofs.close();
 }
Beispiel #3
0
  void GofRAngle::writeRdf() {
    std::ofstream ofs(outputFilename_.c_str());
    if (ofs.is_open()) {
      Revision r;
      ofs << "# " << getAnalysisType() << "\n";
      ofs << "# OpenMD " << r.getFullRevision() << "\n";
      ofs << "# " << r.getBuildDate() << "\n";
      ofs << "# selection script1: \"" << selectionScript1_ ;
      ofs << "\"\tselection script2: \"" << selectionScript2_ << "\"";
      if (doSele3_) {
        ofs << "\tselection script3: \"" << selectionScript3_ << "\"\n";
      } else {
        ofs << "\n";
      }

      if (!paramString_.empty())
        ofs << "# parameters: " << paramString_ << "\n";

      for (unsigned int i = 0; i < avgGofr_.size(); ++i) {
	// RealType r = deltaR_ * (i + 0.5);

	for(unsigned int j = 0; j < avgGofr_[i].size(); ++j) {
	  // RealType cosAngle = -1.0 + (j + 0.5)*deltaCosAngle_;
	  ofs << avgGofr_[i][j]/nProcessed_ << "\t";
	}

	ofs << "\n";
      }
        
    } else {
      sprintf(painCave.errMsg, "GofRAngle: unable to open %s\n", 
              outputFilename_.c_str());
      painCave.isFatal = 1;
      simError();  
    }

    ofs.close();
  }