15 #include <basic/options/keys/sicdock.OptionKeys.gen.hh>
16 #include <basic/options/option.hh>
17 #include <basic/options/option_macros.hh>
18 #include <numeric/constants.hh>
19 #include <numeric/xyz.functions.hh>
20 #include <numeric/xyz.io.hh>
21 #include <ObjexxFCL/format.hh>
22 #include <ObjexxFCL/string.functions.hh>
23 #include <utility/io/ozstream.hh>
24 #include <utility/string_util.hh>
30 #include <boost/foreach.hpp>
39 using utility::vector1;
42 using ObjexxFCL::format::RJ;
49 typedef numeric::xyzVector<platform::Real>
Vec;
50 typedef numeric::xyzMatrix<platform::Real>
Mat;
53 if ( sqdist > stop*stop ) {
55 }
else if ( sqdist < start*start ) {
58 double dist = sqrt( sqdist );
59 return (stop-dist)/(stop-
start);
67 BIN(CLD*basic::options::option[basic::options::OptionKeys::sicdock::hash_2D_vs_3D]()),
72 CLD(basic::options::option[basic::options::OptionKeys::sicdock::clash_dis]()),
74 BIN(CLD*basic::options::option[basic::options::OptionKeys::sicdock::hash_2D_vs_3D]()),
96 init(pose,pose,clash_atoms,clash_atoms);
109 for (
int j = 1; j <= ((pose1.
residue(i).
name3()==
"GLY")?4:5); ++j ) {
114 for (
int j = 1; j <= ((pose2.
residue(i).
name3()==
"GLY")?4:5); ++j ) {
118 init(pose1,pose2,clashmap1,clashmap2);
140 vector1<Vec>
const & pb,
141 vector1<Vec>
const & pa,
142 double & xmx,
double & xmn,
143 double & ymx,
double & ymn
146 double xmx1=-9e9,xmn1=9e9,ymx1=-9e9,ymn1=9e9;
147 xmx=-9e9,xmn=9e9,ymx=-9e9,ymn=9e9;
148 for ( vector1<Vec>::const_iterator ia = pb.begin(); ia != pb.end(); ++ia ) {
149 xmx1 = max(xmx1,ia->x()); xmn1 = min(xmn1,ia->x());
150 ymx1 = max(ymx1,ia->y()); ymn1 = min(ymn1,ia->y());
152 for ( vector1<Vec>::const_iterator ib = pa.begin(); ib != pa.end(); ++ib ) {
153 xmx = max(xmx,ib->x()); xmn = min(xmn,ib->x());
154 ymx = max(ymx,ib->y()); ymn = min(ymn,ib->y());
156 xmx = min(xmx,xmx1); xmn = max(xmn,xmn1);
157 ymx = min(ymx,ymx1); ymn = max(ymn,ymn1);
158 if ( ymn > ymx || xmn > xmx )
return false;
166 vector1<Vec>
const & pb,
167 vector1<Vec>
const & pa,
173 ObjexxFCL::FArray2D<Vec> & ha,
174 ObjexxFCL::FArray2D<Vec> & hb,
180 xlb = (int)(xmn/BIN)-2; xub = (int)(xmx/BIN+0.999999999)+2;
181 ylb = (int)(ymn/BIN)-2; yub = (int)(ymx/BIN+0.999999999)+2;
182 ha.dimension(xub-xlb+1,yub-ylb+1,
Vec(0,0,-9e9));
183 hb.dimension(xub-xlb+1,yub-ylb+1,
Vec(0,0, 9e9));
184 int const xsize = xub-xlb+1;
185 int const ysize = yub-ylb+1;
186 for ( vector1<Vec>::const_iterator ia = pb.begin(); ia != pb.end(); ++ia ) {
187 int const ix = (int)((ia->x()/BIN)-xlb+0.999999999);
188 int const iy = (int)((ia->y()/BIN)-ylb+0.999999999);
189 if ( ix < 1 || ix > xsize || iy < 1 || iy > ysize )
continue;
190 if ( ha(ix,iy).z() < ia->z() ) ha(ix,iy) = *ia;
194 for ( vector1<Vec>::const_iterator ib = pa.begin(); ib != pa.end(); ++ib ) {
195 int const ix = (int)((ib->x()/BIN)-xlb+0.999999999);
196 int const iy = (int)((ib->y()/BIN)-ylb+0.999999999);
197 if ( ix < 1 || ix > xsize || iy < 1 || iy > ysize )
continue;
198 if ( hb(ix,iy).z() > ib->z() ) hb(ix,iy) = *ib;
212 ObjexxFCL::FArray2D<Vec>
const & ha,
213 ObjexxFCL::FArray2D<Vec>
const & hb,
214 double const & clashdis2
216 int const xsize=xub-xlb+1, ysize=yub-ylb+1;
218 for (
int i = 1; i <= xsize; ++i ) {
219 for (
int j = 1; j <= ysize; ++j ) {
220 for (
int k = -1; k <= 1; ++k ) {
221 if ( i+k < 1 || i+k > xsize )
continue;
222 for (
int l = -1; l <= 1; ++l ) {
223 if ( j+l < 1 || j+l > ysize )
continue;
224 double const xa1 = ha(i,j).x();
225 double const ya1 = ha(i,j).y();
226 double const xb1 = hb(i+k,j+l).x();
227 double const yb1 = hb(i+k,j+l).y();
228 double const d21 = (xa1-xb1)*(xa1-xb1)+(ya1-yb1)*(ya1-yb1);
229 if ( d21<clashdis2 ) {
230 double const dz = hb(i+k,j+l).z() - ha(i,j).z() - sqrt(clashdis2-d21);
247 numeric::xyzVector<double>
const & v,
248 numeric::xyzVector<double>
const &
c,
252 double const dxy2 =
dof.cross(v-c).length_squared();
265 Xform const & xform_to_struct2_start,
266 vector1<Vec>
const & pa,
267 vector1<Real>
const & radii,
269 double const & clash_dis_sq,
270 double const & mindis_approx
272 double mindis = mindis_approx;
273 Mat Rori = rotation_matrix_degrees( (ori.z() < -0.99999) ?
Vec(1,0,0) : (
Vec(0,0,1)+ori.normalized())/2.0 , 180.0 );
274 Vec hash_ori = xform_to_struct2_start.R.transposed() * ori;
277 vector1<Real>::const_iterator irad = radii.begin();
278 for ( vector1<Vec>::const_iterator ipa = pa.begin(); ipa != pa.end(); ++ipa,++irad ) {
279 Vec const v = ~xform_to_struct2_start*(Rori*((*ipa)-
Vec(0,0,mindis)));
280 xh->visit_lax(v,*irad,visitor);
287 if ( fabs(visitor.
correction) < 0.001 )
break;
301 utility::vector1<Vec> pa(
h1_->natom()), pb(
h2_->natom());
302 utility::vector1<Vec>::iterator ipa(pa.begin()),ipb(pb.begin());
303 for ( xyzStripeHashPose::const_iterator i =
h1_->begin(); i !=
h1_->end(); ++i,++ipa ) *ipa = xa*(*i-
h1_->translation());
304 for ( xyzStripeHashPose::const_iterator i =
h2_->begin(); i !=
h2_->end(); ++i,++ipb ) *ipb = xb*(*i-
h2_->translation());
305 utility::vector1<Real> ra;
306 for ( xyzStripeHashPose::const_iterator i =
h1_->begin(); i !=
h1_->end(); ++i ) ra.push_back(i.radius());
308 double xmx,xmn,ymx,ymn;
310 ObjexxFCL::FArray2D<Vec> ha,hb;
313 Mat rot = rotation_matrix_degrees( (ori.z() < -0.99999) ?
Vec(1,0,0) : (
Vec(0,0,1)+ori)/2.0 , 180.0 );
314 for ( vector1<Vec>::iterator ia = pb.begin(); ia != pb.end(); ++ia ) *ia = rot*(*ia);
315 for ( vector1<Vec>::iterator ib = pa.begin(); ib != pa.end(); ++ib ) *ib = rot*(*ib);
319 fill_plane_hash(pb,pa,xmx,xmn,ymx,ymn,
BIN,ha,hb,xlb,ylb,xub,yub);
322 if ( fabs(mindis_approx) > 9e8 )
return 9e9;
325 if ( fabs(mindis) > 9e8 )
return 9e9;
337 BOOST_FOREACH (
Xform const & x1,x1s ) {
338 BOOST_FOREACH (
Xform const & x2,x2s ) {
340 if ( tmp < 9e8 ) t = max(t,tmp);
double dist_score(double const &sqdist, double const &start, double const &stop)
Stub class – an object of orthogonal coordinate frame.
c
DEPRECATED convert between the real-valued chi dihedrals and the rotamer well indices.
void init(core::pose::Pose const &pose1)
A molecular system including residues, kinematics, and energies.
Real lj_radius() const
Lennard-Jones 6-12 potential parameter – atom radius.
core::pose::xyzStripeHashPose * h2_
bool get_bounds_intersection(vector1< Vec > const &pb, vector1< Vec > const &pa, double &xmx, double &xmn, double &ymx, double &ymn)
double slide_into_contact_DEPRICATED(core::kinematics::Stub const &xmob, core::kinematics::Stub const &xfix, Vec ori) const
Size n_residue() const
Returns the number of residues in the pose conformation example(s): pose.n_residue() See also: Pose P...
Map from Atom identifiers to contained values class.
double slide_into_contact(Xform const &xmob, Xform const &xfix, Vec ori) const
numeric::xyzVector< platform::Real > Vec
void fill_plane_hash(vector1< Vec > const &pb, vector1< Vec > const &pa, double const &xmx, double const &xmn, double const &ymx, double const &ymn, double const &BIN, ObjexxFCL::FArray2D< Vec > &ha, ObjexxFCL::FArray2D< Vec > &hb, int &xlb, int &ylb, int &xub, int &yub)
void initialize_atomid_map(id::AtomID_Map< T > &atom_map, pose::Pose const &pose)
Initialize an AtomID_Map for a given Pose using the AtomID_Map's current default fill values...
numeric::xyzMatrix< platform::Real > Mat
Atom identifier class. Defined by the atom number and the residue number.
Matrix M
coord frame by 3x3 matrix, each column is a unit vector
double refine_mindis_with_xyzHash(xyzStripeHashPose *xh, Xform const &xform_to_struct2_start, vector1< Vec > const &pa, vector1< Real > const &radii, Vec const &ori, double const &clash_dis_sq, double const &mindis_approx)
numeric::xyzVector< platform::Real > Vec
double get_mindis_with_plane_hashes(int const &xlb, int const &ylb, int const &xub, int const &yub, ObjexxFCL::FArray2D< Vec > const &ha, ObjexxFCL::FArray2D< Vec > const &hb, double const &clashdis2)
std::vector< numeric::xyzVector< core::Real > > xa
Definition for functions used in definition of constraints.
routines which calculate solvent accessible surface area
void visit(numeric::xyzVector< double > const &v, numeric::xyzVector< double > const &c, double, double)
core::pose::xyzStripeHashPose * h1_
A class for defining atom parameters, known as atom_types.
CorrectionVisitor(Vec const &dof_in, Real const &clash_dis_sq_in)
Residue const & residue(Size const seqpos) const
Returns the Residue at position (read access) Note: this method will trigger a refold if eit...
Map from Atom identifiers to contained values class.
numeric::xyzVector< core::Real > t
Vector v
center point by a vector