25 #include <basic/database/open.hh>
26 #include <basic/Tracer.hh>
29 #include <utility/io/izstream.hh>
36 #include <utility/vector1.hh>
39 namespace ObjexxFCL {
namespace fmt { } }
using namespace ObjexxFCL::fmt;
46 static basic::Tracer
TR(
"core.scoring.AtomVDW");
54 ( *chemical::ChemicalManager::get_instance()->atom_type_set( atom_type_set_name ) );
59 atom_vdw_.resize( n_atom_types );
60 for (
Size j=1; j<= n_atom_types; ++j ) {
61 atom_vdw_[j].resize( n_atom_types, 0.0 );
64 utility::io::izstream stream;
65 stream.open( atom_set.
directory() +
"/atom_vdw.txt" );
67 if ( !stream.good() ) {
70 utility_exit_with_message(
"cant find atom_vdw.txt in directory: "+ atom_set.
directory() );
72 TR.Warning <<
"YOU NEED TO UPDATE YOUR MINIROSETTA DATABASE!" << std::endl;
73 basic::database::open( stream,
"scoring/AtomVDW/atom_vdw.txt" );
74 if ( !stream.good() ) {
75 utility_exit_with_message(
"Unable to open scoring/AtomVDW/atom_vdw.txt!" );
84 while ( getline( stream, line ) ) {
85 lines.push_back(line);
86 std::istringstream l(line);
88 atom_type_index.push_back( atom_set.
atom_type_index( atom_type_name ) );
91 Size const natoms( lines.size() );
92 for (
Size i=1; i<= natoms; ++i ) {
93 std::istringstream l( lines[i] );
96 Size const i_atom_type_index( atom_type_index[i] );
98 for (
Size j=1; j<= natoms; ++j ) {
99 Size const j_atom_type_index( atom_type_index[j] );
100 l >> atom_vdw_[ i_atom_type_index ][ j_atom_type_index ];
102 if ( l.fail() ) utility_exit_with_message(
"bad format in atom_vdw.txt ");
105 setup_approximate_vdw_radii( atom_type_index, atom_set );
112 AtomVDW::setup_approximate_vdw_radii(
117 using namespace ObjexxFCL::fmt;
119 Size const natoms_full( atom_vdw_.size() );
120 Size const natoms( atom_type_index.size() );
125 for (
Size i=1; i<= natoms_full; ++i ) {
126 R[i] = atom_type_set[i].lj_radius();
130 for (
Size i=1; i<= natoms; ++i ) {
131 Size const ii( atom_type_index[i] );
132 R[ii] = std::sqrt( atom_vdw_[ii][ii] );
135 Size const niter( 10 );
136 for (
Size r=1; r<= niter; ++r ) {
141 Real total_dev( 0.0 );
143 for (
Size i=1; i<= natoms; ++i ) {
144 Size const ii( atom_type_index[i] );
146 Real dev(0.0), abs_dev(0.0);
147 for (
Size j=1; j<= natoms; ++j ) {
148 Size const jj( atom_type_index[j] );
150 Real const actual( std::sqrt( atom_vdw_[ii][jj] ) );
151 Real const expected( R[ii] + R[jj] );
152 dev += actual - expected;
153 total_dev += ( actual - expected ) * ( actual - expected );
154 abs_dev += ( actual - expected ) * ( actual - expected );
157 abs_dev = std::sqrt( abs_dev / natoms );
158 new_R[ii] = R[ii] + dev/2;
167 approximate_vdw_radii_ =
R;