40 #include <basic/Tracer.hh>
43 #include <utility/exit.hh>
46 #include <numeric/constants.hh>
54 #include <utility/vector1.hh>
62 basic::Tracer
TR_tsr_opt(
"protocols.scoring.methods.pcs.TensorsOptimizer");
67 utility_exit_with_message(
"You shouldn't call the empty constructor for class TensorsOptimizer");
84 core::Real PCS_calc, PCS_exp, score, score_la;;
90 if(n_la != (vars.size() - 3) / 5){
91 TR_tsr_opt <<
"n_la: " << n_la <<
" (vars.size() - 3) / 5):" << (vars.size() - 3) / 5 <<
" vars.size(): " << vars.size() <<std::endl;
92 utility_exit_with_message(
"The number of lanthanides is inconsistent with the derivatives size of vars");
106 if(n_la != pcs_d_p_l_a.size()){
107 utility_exit_with_message(
"The number of lanthanides is inconsistent");
110 for (i = 1; i <= n_la; i++){
119 ObjexxFCL::FArray1D< core::Real >
const & fstyle_b(pcs_d_p_l.
get_fstyle_b());
126 for (j = 1; j <= n_pcs; j++){
132 PCS_calc = A[1]*Xxx + A[2]*Xxy + A[3]*Xxz + A[4]*Xyy + A[5]*Xyz;
133 PCS_exp = fstyle_b(j);
134 score_la += (PCS_calc-PCS_exp) * (PCS_calc-PCS_exp);
156 core::Real PCS_calc, PCS_exp, common, common2, common3;
163 if(n_la != (dE_dvars.size() - 3) / 5){
164 utility_exit_with_message(
"The number of lanthanides is inconsistent with the derivativessize of dE_dvars");
168 for (i = 1; i <= dE_dvars.size(); i++){
183 if(n_la != pcs_d_p_l_a.size()){
184 utility_exit_with_message(
"The number of lanthanides is inconsistent");
187 for (i = 1; i <= n_la; i++){
196 ObjexxFCL::FArray1D< core::Real >
const & fstyle_b(pcs_d_p_l.
get_fstyle_b());
200 for (j = 1; j <= n_pcs; j++){
206 PCS_calc = A[1]*Xxx + A[2]*Xxy + A[3]*Xxz + A[4]*Xyy + A[5]*Xyz;
207 PCS_exp = fstyle_b(j);
208 common = 2 * (PCS_calc - PCS_exp) * weight;
211 for (k = 1; k <= 5; k++){
212 dE_dvars[3 + 5*(i-1) + k] += common * A[k];
223 common2 = 5*r3*4*PCS_calc * numeric::constants::d::pi / 10000.0 ;
224 common3 = common/(4*r5 * numeric::constants::d::pi) *10000.0 ;
225 dE_dvars[1] += (x*common2 - 2*(x*Xxx + y*Xxy + z*Xxz)) * common3;
226 dE_dvars[2] += (y*common2 - 2*(x*Xxy + y*Xyy + z*Xyz)) * common3;
227 dE_dvars[3] += (z*common2 - 2*(-z*Xxx + x*Xxz -z*Xyy + y*Xyz)) * common3;