15 #include <numeric/constants.hh>
21 #include <basic/options/option.hh>
22 #include <basic/options/keys/OptionKeys.hh>
23 #include <basic/options/keys/fingerprint.OptionKeys.gen.hh>
32 #include <numeric/xyz.functions.hh>
33 #include <numeric/xyzMatrix.hh>
34 #include <numeric/conversions.hh>
35 #include <utility/io/ozstream.hh>
47 #include <utility/vector1.hh>
50 #include <numeric/random/random.fwd.hh>
53 using namespace core::scoring;
60 DarcElectrostaticsBase::DarcElectrostaticsBase () :
74 Size height = esp_grid_size;
75 Size width = esp_grid_size;
76 Size depth = esp_grid_size;
79 ifstream inFile(input_filename.c_str());
81 std::cout<<
"Can't open input file " << input_filename << std::endl;
86 std::vector < std::vector < std::vector <core::Real> > > esp_grid;
87 esp_grid.resize(height);
88 for(
Size i=0; i<height; ++i){
89 esp_grid[i].resize(width);
90 for (
Size j =0; j<width; ++j)
91 esp_grid[i][j].resize(depth);
104 for(
Size i=1; i<=height; ++i){
107 for(
Size j=1; j<=width; ++j){
109 for(
Size k=1; k<=depth; ++k){
111 inFile >> grid_point[4];
120 utility::io::ozstream outPDB_stream;
121 outPDB_stream.open(
"esp_grid.pdb", std::ios::out);
125 outPDB_stream<<
"HETATM"<<std::setw(5)<<count<<
" C ESP A 1 "<<std::setw(8)<<std::fixed<<std::setprecision(3)<<pd->at(1)<<std::setw(8)<<std::fixed<<std::setprecision(3)<<pd->at(2)<<std::setw(8)<<std::fixed<<std::setprecision(3)<<pd->at(3)<<
" "<<std::setw(6)<<std::fixed<<std::setprecision(2)<<pd->at(4)<<std::endl;
127 outPDB_stream.close();
128 outPDB_stream.clear();
136 for (
int j = 1, resnum = ligand_pose.
total_residue(); j <= resnum; ++j ) {
142 if (lig_res_num == 0){
143 std::cout<<
"Error, no ligand to Calculate Electrostatic energy" << std::endl;
148 utility::io::ozstream outPDB_stream;
149 outPDB_stream.open(
"lig_grid.pdb", std::ios::out);
152 core::Real x0,y0,z0,x1,y1,z1,x_d,y_d,z_d,V_000,V_100,V_010,V_110,V_001,V_101,V_011,V_111,c_00,c_10,c_01,c_11,c_0,c_1,
c;
157 ligand.x() = curr_rsd.
atom(i).
xyz()(1);
158 ligand.y() = curr_rsd.
atom(i).
xyz()(2);
159 ligand.z() = curr_rsd.
atom(i).
xyz()(3);
168 x_d = (ligand.x() - x0)/(x1 - x0);
169 y_d = (ligand.y() - y0)/(y1 - y0);
170 z_d = (ligand.z() - z0)/(z1 - z0);
172 if (pd->at(1) == x0 && pd->at(2)== y0 && pd->at(3) == z0 ) V_000 = pd->at(4);
173 if (pd->at(1) == x1 && pd->at(2)== y0 && pd->at(3) == z0 ) V_100 = pd->at(4);
174 if (pd->at(1) == x0 && pd->at(2)== y1 && pd->at(3) == z0 ) V_010 = pd->at(4);
175 if (pd->at(1) == x1 && pd->at(2)== y1 && pd->at(3) == z0 ) V_110 = pd->at(4);
176 if (pd->at(1) == x0 && pd->at(2)== y0 && pd->at(3) == z1 ) V_001 = pd->at(4);
177 if (pd->at(1) == x1 && pd->at(2)== y1 && pd->at(3) == z0 ) V_101 = pd->at(4);
178 if (pd->at(1) == x0 && pd->at(2)== y1 && pd->at(3) == z1 ) V_011 = pd->at(4);
179 if (pd->at(1) == x1 && pd->at(2)== y1 && pd->at(3) == z1 ) V_111 = pd->at(4);
182 c_00 = (V_000 * (1 - x_d)) + (V_100 * x_d);
183 c_10 = (V_010 * (1 - x_d)) + (V_110 * x_d);
184 c_01 = (V_001 * (1 - x_d)) + (V_101 * x_d);
185 c_11 = (V_011 * (1 - x_d)) + (V_111 * x_d);
186 c_0 = (c_00 * (1 - y_d)) + (c_10 * y_d);
187 c_1 = (c_01 * (1 - y_d)) + (c_11 * y_d);
188 c = (c_0 * (1 - z_d)) + (c_1 * z_d);
191 outPDB_stream<<
"HETATM"<<std::setw(5)<<1<<
" C GRD A 1 "<<std::setw(8)<<std::fixed<<std::setprecision(3)<<x0<<std::setw(8)<<std::fixed<<std::setprecision(3)<<y0<<std::setw(8)<<std::fixed<<std::setprecision(3)<<z0<<std::endl;
192 outPDB_stream<<
"HETATM"<<std::setw(5)<<1<<
" C GRD A 1 "<<std::setw(8)<<std::fixed<<std::setprecision(3)<<x0+grid_spacing_<<std::setw(8)<<std::fixed<<std::setprecision(3)<<y0<<std::setw(8)<<std::fixed<<std::setprecision(3)<<z0<<std::endl;
193 outPDB_stream<<
"HETATM"<<std::setw(5)<<1<<
" C GRD A 1 "<<std::setw(8)<<std::fixed<<std::setprecision(3)<<x0<<std::setw(8)<<std::fixed<<std::setprecision(3)<<y0+grid_spacing_<<std::setw(8)<<std::fixed<<std::setprecision(3)<<z0<<std::endl;
194 outPDB_stream<<
"HETATM"<<std::setw(5)<<1<<
" C GRD A 1 "<<std::setw(8)<<std::fixed<<std::setprecision(3)<<x0<<std::setw(8)<<std::fixed<<std::setprecision(3)<<y0<<std::setw(8)<<std::fixed<<std::setprecision(3)<<z0+grid_spacing_<<std::endl;
195 outPDB_stream<<
"HETATM"<<std::setw(5)<<1<<
" C GRD A 1 "<<std::setw(8)<<std::fixed<<std::setprecision(3)<<x0+grid_spacing_<<std::setw(8)<<std::fixed<<std::setprecision(3)<<y0+grid_spacing_<<std::setw(8)<<std::fixed<<std::setprecision(3)<<z0<<std::endl;
196 outPDB_stream<<
"HETATM"<<std::setw(5)<<1<<
" C GRD A 1 "<<std::setw(8)<<std::fixed<<std::setprecision(3)<<x0+grid_spacing_<<std::setw(8)<<std::fixed<<std::setprecision(3)<<y0<<std::setw(8)<<std::fixed<<std::setprecision(3)<<z0+grid_spacing_<<std::endl;
197 outPDB_stream<<
"HETATM"<<std::setw(5)<<1<<
" C GRD A 1 "<<std::setw(8)<<std::fixed<<std::setprecision(3)<<x0<<std::setw(8)<<std::fixed<<std::setprecision(3)<<y0+grid_spacing_<<std::setw(8)<<std::fixed<<std::setprecision(3)<<z0+grid_spacing_<<std::endl;
198 outPDB_stream<<
"HETATM"<<std::setw(5)<<1<<
" C GRD A 1 "<<std::setw(8)<<std::fixed<<std::setprecision(3)<<x0+grid_spacing_<<std::setw(8)<<std::fixed<<std::setprecision(3)<<y0+grid_spacing_<<std::setw(8)<<std::fixed<<std::setprecision(3)<<z0+grid_spacing_<<std::endl;
201 outPDB_stream.close();
202 outPDB_stream.clear();
205 std::cout<<
"Delphi Electrostatics Energy: " << E_energy << std::endl;