/** * \file EnvelopeFitRestraint.cpp * \brief * * \authors Dina Schneidman * Copyright 2007-2013 IMP Inventors. All rights reserved. * */ #include #include IMPEM_BEGIN_NAMESPACE EnvelopeFitRestraint::EnvelopeFitRestraint(Particles ps, DensityMap *em_map, double density_threshold, double penetration_threshold) : ps_(ps), pca_aligner_(em_map, density_threshold), penetration_threshold_(penetration_threshold), distance_transform_(em_map, density_threshold, penetration_threshold*2.0), envelope_score_(&distance_transform_) { } double EnvelopeFitRestraint::unprotected_evaluate( IMP::DerivativeAccumulator *accum) const { IMP_UNUSED(accum); // get the XYZs IMP::algebra::Vector3Ds coordinates(ps_.size()); for (unsigned int i=0; i::max(); for(unsigned int j=0; j best_score) { best_score = score; best_trans = map_transforms[j]; best_found = true; } } if(best_found) const_cast(this)->transformation_ = best_trans; else // store identity trans const_cast(this)->transformation_ = algebra::Transformation3D(algebra::Vector3D(0,0,0)); return -best_score; } void EnvelopeFitRestraint::apply_transformation() { unprotected_evaluate(nullptr); for (unsigned int i=0; i