Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
util.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file
11 /// @brief
12 /// @author
13 
17 #include <basic/options/option.hh>
18 
19 #include <iostream>
20 
21 // option key includes
22 #include <basic/options/keys/edensity.OptionKeys.gen.hh>
23 #include <basic/options/keys/patterson.OptionKeys.gen.hh>
24 
25 #include <utility/vector1.hh>
26 
27 
28 // C++ Headers
29 
30 namespace core {
31 namespace scoring {
32 namespace electron_density {
33 
34 /// @brief read density weights from the cmd line into the scorefunction
36  using namespace basic::options;
37 
38  if ( option[ OptionKeys::patterson::weight ].user() ) {
40  option[ OptionKeys::patterson::weight ]() );
41  }
42  if ( option[ OptionKeys::edensity::fastdens_wt ].user() ) {
44  option[ OptionKeys::edensity::fastdens_wt ]() );
45  }
46  if ( option[ OptionKeys::edensity::sliding_window_wt ].user() ) {
48  option[ OptionKeys::edensity::sliding_window_wt ]() );
49  }
50  if ( option[ OptionKeys::edensity::whole_structure_ca_wt ].user() ) {
52  option[ OptionKeys::edensity::whole_structure_ca_wt ]() );
53  }
54  if ( option[ OptionKeys::edensity::whole_structure_allatom_wt ].user() ) {
56  option[ OptionKeys::edensity::whole_structure_allatom_wt ]() );
57  }
58 }
59 
60 
61 /// @brief spline interpolation with periodic boundaries
63  ObjexxFCL::FArray3D< double > & coeffs ,
64  numeric::xyzVector< core::Real > const & idxX ) {
65  int dims[3] = { coeffs.u3(), coeffs.u2(), coeffs.u1() };
66  core::Real pt[3] = { idxX[2]-1.0 , idxX[1]-1.0, idxX[0]-1.0 };
67  core::Real retval = SplineInterp::interp3(&coeffs[0], dims, pt, 3);
68  return retval;
69 }
70 
72  ObjexxFCL::FArray3D< double > & data ,
73  ObjexxFCL::FArray3D< double > & coeffs) {
74  int dims[3] = { data.u3(), data.u2(), data.u1() };
75  coeffs = data;
76  SplineInterp::compute_coefficients( &coeffs[0] , dims , 3 );
77 }
78 
80  ObjexxFCL::FArray3D< float > & data ,
81  ObjexxFCL::FArray3D< double > & coeffs) {
82  int N = data.u3()*data.u2()*data.u1();
83  ObjexxFCL::FArray3D< double > data_d(data.u1(),data.u2(),data.u3()) ;
84  for (int i=0; i<N; ++i)
85  data_d[i] = (double)data[i];
86  spline_coeffs( data_d, coeffs );
87 }
88 
89 
90 } // namespace constraints
91 } // namespace scoring
92 } // namespace core