bool Chain::is_continuous() const { // go through and find elements where there is a chain break const double dmin = 2.0; std::vector<bool> cterm( dbmonomers.size(), false ); for ( int i = 0; i < int(dbmonomers.size()-1); i++ ) { int j = i + 1; const clipper::Coord_orth co1 = dbmonomers[i].coord_o3(); const clipper::Coord_orth co2 = dbmonomers[j].coord_p(); if ( co1.is_null() || co2.is_null() ) return false; const double d2 = ( co1 - co2 ).lengthsq(); if ( d2 > dmin*dmin ) return false; } return true; }
clipper::Coord_orth NucleicAcidTools::coord_adjust( const clipper::Coord_orth& co, const clipper::Coord_orth& cc3, const clipper::Coord_orth& cf3, const clipper::Coord_orth& cc4, const clipper::Coord_orth& cf4, double rad ) { if ( co.is_null() ) return co; clipper::Coord_orth result = co; double w3 = 1.0 - sqrt( ( co - cf3 ).lengthsq() ) / rad; double w4 = 1.0 - sqrt( ( co - cf4 ).lengthsq() ) / rad; if ( w3 > 0.0 ) result += w3 * ( cc3 - cf3 ); if ( w4 > 0.0 ) result += w4 * ( cc4 - cf4 ); return result; }
void SSfind::prep_search( const clipper::Xmap<float>& xmap, const double rhocut, const double radcut, const clipper::Coord_orth centre ) { // make list of results typedef clipper::Xmap<float>::Map_reference_index MRI; srctrn.clear(); double r2cut = ( radcut > 0.0 ) ? radcut*radcut : 1.0e20; clipper::Coord_frac cf = centre.coord_frac( xmap.cell() ); for ( MRI ix = xmap.first(); !ix.last(); ix.next() ) if ( xmap[ix] > rhocut ) { clipper::Coord_frac df = ix.coord().coord_frac( xmap.grid_sampling() ); df = df.symmetry_copy_near( xmap.spacegroup(), xmap.cell(), cf ) - cf; double r2 = df.lengthsq( xmap.cell() ); if ( r2 < r2cut ) srctrn.push_back( grid.index( ix.coord() ) ); } }
clipper::RTop_orth NucleicAcidTools::symmetry_rtop( const std::vector<clipper::Coord_orth>& cowrk, clipper::Coord_orth& coref, const clipper::Spacegroup& spgr, const clipper::Cell& cell ) { std::vector<clipper::Coord_frac> cwrk( cowrk.size() ); for ( int a = 0; a < cowrk.size(); a++ ) cwrk[a] = cowrk[a].coord_frac(cell); clipper::Coord_frac cref = coref.coord_frac(cell); clipper::Coord_frac c1, c2; double d2, d2min(1.0e12); int smin(0); clipper::Coord_frac dmin(0.0,0.0,0.0); for ( int s = 0; s < spgr.num_symops(); s++ ) for ( int a = 0; a < cwrk.size(); a++ ) { c1 = ( spgr.symop(s) * cwrk[a] ); c2 = c1.lattice_copy_near( cref ); d2 = ( c2 - cref ).lengthsq( cell ); if ( d2 < d2min ) { d2min = d2; smin = s; dmin = c2 - c1; } } clipper::RTop_frac rf( spgr.symop(smin).rot(), spgr.symop(smin).trn()+dmin ); return rf.rtop_orth( cell ); }
NucleicAcid::NucleicAcid( const clipper::Coord_orth& cp, const clipper::Coord_orth& co5, const clipper::Coord_orth& cc5, const clipper::Coord_orth& cc4, const clipper::Coord_orth& co4, const clipper::Coord_orth& cc3, const clipper::Coord_orth& co3, const clipper::Coord_orth& cc2, const clipper::Coord_orth& cc1, const clipper::Coord_orth& cn, const clipper::String& type ) { clipper::String t = type + "?"; typ = t.trim()[0]; clipper::Util::set_null( p_x ); clipper::Util::set_null( o5x ); clipper::Util::set_null( c5x ); clipper::Util::set_null( c4x ); clipper::Util::set_null( o4x ); clipper::Util::set_null( c3x ); clipper::Util::set_null( o3x ); clipper::Util::set_null( c2x ); clipper::Util::set_null( c1x ); clipper::Util::set_null( n_x ); if ( !cp.is_null() ) { p_x = cp.x(); p_y = cp.y(); p_z = cp.z(); } if ( !co5.is_null() ) { o5x = co5.x(); o5y = co5.y(); o5z = co5.z(); } if ( !cc5.is_null() ) { c5x = cc5.x(); c5y = cc5.y(); c5z = cc5.z(); } if ( !cc4.is_null() ) { c4x = cc4.x(); c4y = cc4.y(); c4z = cc4.z(); } if ( !co4.is_null() ) { o4x = co4.x(); o4y = co4.y(); o4z = co4.z(); } if ( !cc3.is_null() ) { c3x = cc3.x(); c3y = cc3.y(); c3z = cc3.z(); } if ( !co3.is_null() ) { o3x = co3.x(); o3y = co3.y(); o3z = co3.z(); } if ( !cc2.is_null() ) { c2x = cc2.x(); c2y = cc2.y(); c2z = cc2.z(); } if ( !cc1.is_null() ) { c1x = cc1.x(); c1y = cc1.y(); c1z = cc1.z(); } if ( !cn.is_null() ) { n_x = cn.x(); n_y = cn.y(); n_z = cn.z(); } set_flag(); }