mcpele
1.0.0
The Monte Carlo Python Energy Landscape Explorer
|
00001 #include "mcpele/gaussian_coords_displacement.h" 00002 00003 namespace mcpele { 00004 00005 GaussianCoordsDisplacement::GaussianCoordsDisplacement(const size_t rseed, const double stepsize) 00006 : m_seed(rseed), 00007 m_mean(0.0), 00008 m_stdev(1.0), 00009 m_generator(rseed), 00010 m_distribution(m_mean, m_stdev), 00011 m_stepsize(stepsize), 00012 m_count(0) 00013 { 00014 #ifdef DEBUG 00015 std::cout<<"seed TakeStep:"<<_seed<< "\n"; 00016 #endif 00017 } 00018 00019 void GaussianCoordsDisplacement::displace(pele::Array<double>& coords, MC* mc) 00020 { 00021 //assert(coords.size() == _N); 00022 for(size_t i = 0; i < coords.size(); ++i){ 00023 double randz = m_distribution(m_generator); //this is sample from N(0,1) 00024 coords[i] += randz * m_stepsize; //here the stepsize plays the same role as the stdev. This is sampled from N(0,stepsize) 00025 } 00026 ++m_count; 00027 } 00028 00029 } // namespace mcpele