Difference for src/colvarcomp_rotations.C from version 1.16 to 1.17

version 1.16version 1.17
Line 123
Line 123
 } }
  
  
  cvm::real colvar::orientation::dist2(colvarvalue const &x1,
                                       colvarvalue const &x2) const
  {
    return x1.quaternion_value.dist2(x2);
  }
  
  
  colvarvalue colvar::orientation::dist2_lgrad(colvarvalue const &x1,
                                               colvarvalue const &x2) const
  {
    return x1.quaternion_value.dist2_grad(x2);
  }
  
  
  colvarvalue colvar::orientation::dist2_rgrad(colvarvalue const &x1,
                                               colvarvalue const &x2) const
  {
    return x2.quaternion_value.dist2_grad(x1);
  }
  
  
  
 colvar::orientation_angle::orientation_angle(std::string const &conf) colvar::orientation_angle::orientation_angle(std::string const &conf)
   : orientation(conf)   : orientation(conf)
Line 176
Line 197
 } }
  
  
  simple_scalar_dist_functions(orientation_angle)
  
  
  
 colvar::orientation_proj::orientation_proj(std::string const &conf) colvar::orientation_proj::orientation_proj(std::string const &conf)
   : orientation(conf)   : orientation(conf)
Line 220
Line 244
 } }
  
  
  simple_scalar_dist_functions(orientation_proj)
  
  
  
 colvar::tilt::tilt(std::string const &conf) colvar::tilt::tilt(std::string const &conf)
   : orientation(conf)   : orientation(conf)
Line 278
Line 305
 } }
  
  
  simple_scalar_dist_functions(tilt)
  
  
  
 colvar::spin_angle::spin_angle(std::string const &conf) colvar::spin_angle::spin_angle(std::string const &conf)
   : orientation(conf)   : orientation(conf)
Line 339
Line 369
     atoms->apply_colvar_force(fw);     atoms->apply_colvar_force(fw);
   }   }
 } }
  
  
  cvm::real colvar::spin_angle::dist2(colvarvalue const &x1,
                                      colvarvalue const &x2) const
  {
    cvm::real diff = x1.real_value - x2.real_value;
    diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
    return diff * diff;
  }
  
  
  colvarvalue colvar::spin_angle::dist2_lgrad(colvarvalue const &x1,
                                              colvarvalue const &x2) const
  {
    cvm::real diff = x1.real_value - x2.real_value;
    diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
    return 2.0 * diff;
  }
  
  
  colvarvalue colvar::spin_angle::dist2_rgrad(colvarvalue const &x1,
                                              colvarvalue const &x2) const
  {
    cvm::real diff = x1.real_value - x2.real_value;
    diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
    return (-2.0) * diff;
  }
  
  
  void colvar::spin_angle::wrap(colvarvalue &x) const
  {
    if ((x.real_value - wrap_center) >= 180.0) {
      x.real_value -= 360.0;
      return;
    }
  
    if ((x.real_value - wrap_center) < -180.0) {
      x.real_value += 360.0;
      return;
    }
  
    return;
  }


Legend:
Removed in v.1.16 
changed lines
 Added in v.1.17



Made by using version 1.53 of cvs2html