17 #include <basic/Tracer.hh>
21 #include <ObjexxFCL/FArray3D.hh>
22 #include <ObjexxFCL/FArray2D.hh>
23 #include <ObjexxFCL/FArray1D.hh>
24 #include <ObjexxFCL/FArray3.hh>
25 #include <ObjexxFCL/FArray2.hh>
26 #include <ObjexxFCL/FArray1.hh>
27 #include <ObjexxFCL/FArray2P.hh>
28 #include <ObjexxFCL/FArray3P.hh>
30 #include <utility/exit.hh>
31 #include <utility/file/FileName.hh>
32 #include <utility/file/PathName.hh>
33 #include <utility/file/file_sys_util.hh>
36 #include <numeric/xyzMatrix.hh>
38 #include <basic/options/option.hh>
41 #include <basic/options/keys/out.OptionKeys.gen.hh>
42 #include <basic/options/keys/mc.OptionKeys.gen.hh>
43 #include <basic/options/keys/cluster.OptionKeys.gen.hh>
45 #include <utility/vector1.hh>
48 static basic::Tracer
TR(
"protocols.hcluster");
51 namespace canonical_sampling{
52 namespace mc_convergence_checks {
59 using namespace basic::options;
60 using namespace basic::options::OptionKeys;
62 static string subdir_prefix(
"sub_");
63 static string libdir_prefix(
"c_");
64 static string libdir_suffix(
"_lib");
66 static int nofsubdir = option[cluster::K_n_sub];
70 string tag = tag_orign +
".0000";
73 Size len=tag.length();
77 Size newpos = tag.find(
".", pos+1);
78 id_stack.push_back(atoi(tag.substr(pos+1,newpos-pos-1).c_str()));
82 Size n = id_stack.size();
83 if (n == 1)
return option[out::file::silent]();
84 ostringstream fnstream;
85 fnstream <<
"c_" << setfill (
'0') << setw (5) << id_stack[n-1] <<
".out";
86 string fn(fnstream.str());
88 for (
Size i=n-1; i>=1; i--)
90 ostringstream pathstream1;
91 ostringstream pathstream2;
94 if (i>1) pathstream1 << libdir_prefix << setfill (
'0') << setw (5) << id_stack[i-1] << libdir_suffix << s ;
96 pathstream2 << subdir_prefix << setfill (
'0') << setw (3) <<
int((id_stack[i]-1)/nofsubdir) << s;
98 fn = pathstream1.str()+pathstream2.str()+fn;
100 return defaultpath+fn;
106 silent_file_(silent_file),
111 using namespace basic::options;
112 using namespace basic::options::OptionKeys;
114 TR <<
"New cluster loaded: level=" <<
level_ <<
" radius=" <<
radius_ << std::endl;
128 while (pos<len) {oldpos=pos; pos = t.find(
".", pos+1);}
163 using namespace basic::options;
164 using namespace basic::options::OptionKeys;
166 static ObjexxFCL::FArray1D_double weights(
natom(), 1.0 );
170 if (!option[cluster::K_not_fit_xyz]) {
189 ObjexxFCL::FArray2P_double conf1(
coords()(1,1,ndx1), 3,
natom());
190 ObjexxFCL::FArray2P_double conf2(
coords()(1,1,ndx2), 3,
natom());
232 if (i==j)
return 0.0;
247 std::cout << std::endl;
296 if (
evaluate(coord, resolution, best_decoy, best_rmsd) == 1 )
349 if (
evaluate(coord, resolution, best_decoy, best_rmsd) == 1 )
355 TR <<
"tag:" << best_decoy <<
" -> " << filename << std::endl;
374 if (best_rmsd <= resolution)
395 return subpools_[best_ndx]->evaluate(coord,resolution,best_decoy,best_rmsd);
400 best_decoy =
tag(best_ndx)+
".00001";
408 TR <<
"min_rmsd=" << best_rmsd <<
" out of R=" <<
radius_;
409 TR <<
" Adding a new center ..." << std::endl;
411 std::ostringstream
tag;
415 best_decoy = tag.str();
416 add(coord, best_decoy);
438 ObjexxFCL::FArray1D_double
const weights(
natom(), 1.0 );
439 ObjexxFCL::FArray1D_double transvec( 3 );
449 ObjexxFCL::FArray2P_double xx2(
coords()(1,1,i), 3,
natom() );
468 rmsd += ( coord( d, n ) - xx2( d, n ) ) * ( coord( d, n ) - xx2( d, n ) ) * invn;
471 rmsd = std::sqrt( rmsd );
472 if ( rmsd <= best_rmsd )
479 best_decoy =
tag(best_index);
485 using namespace basic::options;
486 using namespace basic::options::OptionKeys;
496 for (i=0; i<nlist; i++)
504 if (nlist>=
core::Size(option[cluster::K_deque_size]()))
530 TR <<
"loading new cluster..." << std::endl;