43 #include <basic/database/open.hh>
47 #include <ObjexxFCL/FArray2A.hh>
50 #include <utility/vector1.fwd.hh>
51 #include <utility/io/izstream.hh>
55 #include <basic/Tracer.hh>
60 #include <numeric/random/random.hh>
65 #include <numeric/xyzMatrix.hh>
66 #include <numeric/xyzMatrix.fwd.hh>
73 #include <utility/vector1.hh>
74 #include <numeric/xyz.functions.hh>
77 static basic::Tracer
tr(
"protocols.jumping");
81 using namespace basic;
82 using namespace ObjexxFCL;
89 BaseDisulfPairingLibrary::~BaseDisulfPairingLibrary() {}
91 static numeric::random::RandomGenerator
RG(12345);
115 numeric::xyzMatrix_double
const & p,
116 numeric::xyzMatrix_double & m
119 using namespace numeric;
121 xyzVector_double a1 = p.col_x() - p.col_y();
122 xyzVector_double a2 = p.col_z() - p.col_y();
124 xyzVector_double a3 = cross( a1, a2 );
126 a2 = cross( a3, a1 );
128 m = xyzMatrix_double::cols( a1, a2, a3 );
134 numeric::xyzMatrix_double & p
137 pos.dimension( 3, 5 );
138 using namespace numeric;
140 xyzVector_double n( &pos(1,1) );
141 xyzVector_double ca( &pos(1,2) );
142 xyzVector_double
c( &pos(1,4) );
144 p = xyzMatrix_double::cols( n, ca, c );
148 numeric::xyzMatrix_double
151 pos.dimension( 3, 5 );
152 using namespace numeric;
154 xyzVector_double n( &pos(1,1) );
155 xyzVector_double ca( &pos(1,2) );
156 xyzVector_double
c( &pos(1,4) );
158 return xyzMatrix_double::cols( n, ca, c );
172 Size const MAX_POS( 5 );
173 Epos1.dimension(3,MAX_POS);
174 Epos2.dimension(3,MAX_POS);
178 numeric::xyzMatrix_double p1, p2, m1, m2;
203 numeric::xyzVector_double e1( &Epos1(1,2) );
204 numeric::xyzVector_double e2( &Epos2(1,2) );
208 translation = m1.transposed() * ( e2 - e1 );
232 rotation = m1.transposed() * m2;
251 std::cout <<
" p1:\n" << p1 << std::endl;
252 std::cout <<
" p2:\n" << p2 << std::endl;
253 std::cout <<
" m1:\n" << m2 << std::endl;
254 std::cout <<
" m2:\n" << m2 << std::endl;
255 std::cout <<
" translation:\n" << translation << std::endl;
256 std::cout <<
" rotation:\n" << rotation << std::endl;
258 FArray2D_float tmp_pos1(3,MAX_POS), tmp_pos2(3,MAX_POS);
260 for (
int i=1; i<= MAX_POS; ++i ) {
261 for (
int j=1; j<= 3; ++j ) {
262 tmp_pos1(j,i) = Epos1(j,i);
263 tmp_pos2(j,i) = Epos2(j,i);
267 double forward_dev(0), forward_dev2(0), backward_dev(0);
270 make_jump( tmp_pos1, tmp_pos2 );
271 std::cout <<
"tmp_pos1:\n" << tmp_pos1 << std::endl;
272 std::cout <<
"tmp_pos2:\n" << tmp_pos2 << std::endl;
273 for (
int i=1; i<= MAX_POS; ++i ) {
274 if ( i==1 || i==2 || i == 4 ) {
275 for (
int j=1; j<= 3; ++j ) {
276 forward_dev += std::abs( Epos2(j,i) - tmp_pos2(j,i) );
283 make_jump( tmp_pos2, tmp_pos1 );
284 std::cout <<
"tmp_pos1:\n" << tmp_pos1 << std::endl;
285 std::cout <<
"tmp_pos2:\n" << tmp_pos2 << std::endl;
286 for (
int i=1; i<= MAX_POS; ++i ) {
287 if ( i==1 || i==2 || i == 4 ) {
288 for (
int j=1; j<= 3; ++j ) {
289 backward_dev += std::abs( Epos1(j,i) - tmp_pos1(j,i) );
298 make_jump( tmp_pos1, tmp_pos2 );
299 std::cout <<
"tmp_pos1:\n" << tmp_pos1 << std::endl;
300 std::cout <<
"tmp_pos2:\n" << tmp_pos2 << std::endl;
301 for (
int i=1; i<= MAX_POS; ++i ) {
302 if ( i==1 || i==2 || i == 4 ) {
303 for (
int j=1; j<= 3; ++j ) {
304 forward_dev2 += std::abs( Epos2(j,i) - tmp_pos2(j,i) );
309 std::cout <<
"RT::RT: debug make_jump:"
310 <<
" fdev= " << F(9,6,forward_dev)
311 <<
" bdev= " << F(9,6,backward_dev)
312 <<
" fdev2= " << F(9,6,forward_dev2) << std::endl;
356 int pos1,pos2,seq_sep;
360 Size const MAX_POS( 5 );
361 FArray2D_float Epos1(3,MAX_POS), Epos2(3,MAX_POS);
362 utility::io::izstream data( fn );
366 while ( getline( data,line ) ) {
367 std::istringstream is( line );
370 is >> tag >> filename >> pos1 >> pos2 >> res1 >> res2 >>
371 ss1 >> ss2 >> seq_sep >> this_rt;
373 if ( is.fail() || tag !=
"DISULF" )
continue;
391 pairings_[ std::make_pair( 1, 1 ) ].push_back( t );
403 using namespace core::fragment;
411 const int ntemplates ( templates.size() );
412 const int iStart( 1 );
413 const int iStop ( 2 );
414 frags.reserve( ntemplates );
415 for ( DisulfTemplateList::const_iterator it=templates.begin(), eit=templates.end();
418 if ( bWithTorsion ) {
420 start->set_torsion( 1, it->phi( iStart ) );
421 start->set_torsion( 2, it->psi( iStart ) );
422 start->set_torsion( 3, it->omega( iStart ) );
424 frags.back()->add_residue( start );
427 frags.back()->add_residue(
new UpJumpSRFD() );
428 frags.back()->add_residue(
new DownJumpSRFD( it->rt_, it->atoms_downstream_, it->atoms_upstream_,
'X' ) );
430 if ( bWithTorsion ) {
432 stop->set_torsion( 1, it->phi( iStop ) );
433 stop->set_torsion( 2, it->psi( iStop ) );
434 stop->set_torsion( 3, it->omega( iStop ) );
436 frags.back()->add_residue( stop );
438 frags.back()->set_valid();
453 for (
Size jump_nr = 1; jump_nr <= pairings.size(); ++jump_nr) {
456 int const startpos( pairings[ jump_nr ].pos1 );
457 int const endpos( pairings[ jump_nr ].pos2 );
460 Size const length( bWithTorsion ? 4 : 2 );
461 runtime_assert( length == frag_data.front()->size() );
463 frame->add_fragment( frag_data );
464 frags_accumulator.
add( frame );
466 utility_exit_with_message(
"need to implement this: make ss-library fragments that only contain those torsions for residues\
467 that can move according to movemap -- call this function with \
468 bWithTorsions = false ... and it works for now");
478 if ( instance_ == NULL ) {
480 std::cout <<
"READING START" << std::endl;
481 instance_->read_from_file( basic::database::full_name(
"sampling/disulfide_jump_database_wip.dat") );
482 std::cout <<
"READING END" << std::endl;