24 #include <ObjexxFCL/FArray1D.hh>
27 #include <utility/exit.hh>
28 #include <basic/Tracer.hh>
29 #include <ObjexxFCL/format.hh>
37 #include <utility/vector1.hh>
38 #include <numeric/xyz.functions.hh>
41 namespace kinematics {
44 static basic::Tracer
TR(
"core.kinematics.tree.Atom_");
51 assert( weak_ptr() ==
this );
102 std::cout <<
"ATOM: " <<
atom_id_ << std::endl;
103 std::cout <<
" PARENT: ";
105 std::cout <<
parent_->id() << std::endl;
106 std::cout <<
" GRAND PARENT: ";
108 std::cout << static_cast< Atom_* >(
parent_() )->
parent_->id() << std::endl;
110 std::cout <<
" NULL" << std::endl;
114 std::cout <<
" NULL" << std::endl;
117 std::cout <<
" CHILDREN: ";
118 for ( Atoms::const_iterator it=
atoms_.begin(), it_end =
atoms_.end(); it != it_end; ++it ) {
119 std::cout << (*it)->id() <<
' ';
121 std::cout << std::endl;
122 for ( Atoms::const_iterator it=
atoms_.begin(), it_end =
atoms_.end(); it != it_end; ++it ) {
132 using namespace ObjexxFCL::fmt;
134 TR <<
"POSITION: " << F(8,3,
x()) << F(8,3,
y()) << F(8,3,
z()) << std::endl;
138 TR <<
" GRAND PARENT: ";
140 TR << static_cast< Atom_* >(
parent_() )->
parent_->id() << std::endl;
142 TR <<
" NULL" << std::endl;
146 TR <<
" NULL" << std::endl;
150 for ( Atoms::const_iterator it=
atoms_.begin(), it_end =
atoms_.end(); it != it_end; ++it ) {
151 TR << (*it)->id() <<
' ';
157 int const next_level(n_level - 1);
158 for ( Atoms::const_iterator it=
atoms_.begin(), it_end =
atoms_.end(); it != it_end; ++it ) {
159 (*it)->show(next_level);
182 int color( current_color );
184 bool const my_dof_moved( dof_moved[
atom_id_ ] );
185 bool const my_xyz_moved( atom_moved[ atom_id_ ] );
187 if ( my_dof_moved ) {
193 current_color = biggest_color;
199 color = biggest_color;
203 int const current_map( domain_map( atom_id_.rsd() ) );
204 if ( !my_dof_moved && my_xyz_moved ) {
206 domain_map( atom_id_.rsd() ) = 0;
207 }
else if ( current_map < 0 ) {
209 domain_map( atom_id_.rsd() ) = color;
210 }
else if ( current_map == 0 || current_map == color ) {
214 domain_map( atom_id_.rsd() ) = 0;
218 for ( Atoms::const_iterator it=
atoms_.begin(), it_end =
atoms_.end(); it != it_end; ++it ) {
219 (*it)->update_domain_map( color, biggest_color, domain_map, dof_moved, atom_moved );
235 if ( atom->is_jump() ) {
252 if ( iter ==
atoms_.end() ) {
253 std::cerr <<
"child not present in atoms list! " <<
atoms_.size() << std::endl;
271 if ( atom->is_jump() ) {
292 assert( index >= 0 );
293 Atoms::iterator pos(
atoms_.begin() + index );
294 if ( atom->is_jump() ) {
305 atoms_.insert( pos, atom );
318 assert( ( old_atom->is_jump() && new_atom->is_jump() ) ||
319 ( !old_atom->is_jump() && !new_atom->is_jump() ) );
321 Atoms::iterator iter( std::find(
atoms_.begin(),
atoms_.end(), old_atom ) );
322 if ( iter ==
atoms_.end() ) {
323 std::cout <<
"old_atom not present in atoms list! " <<
324 atoms_.size() << std::endl;
329 iter =
atoms_.insert( iter, new_atom );
333 assert( *iter == old_atom );
347 if ( iter >=
atoms_.end() ) {
395 assert( child->parent()() ==
this );
397 if (
atoms_[k] == child )
return k;
399 utility_exit_with_message(
"problemo in Atom_'s atom list" );
417 if ( child1->parent()() !=
this || child2->parent()() !=
this ) {
418 utility_exit_with_message(
"Atom_::dihedral_between_bonded_children: atoms are not both my children!");
420 if ( child1->is_jump() || child2->is_jump() ) {
421 utility_exit_with_message(
"Atom_::dihedral_between_bonded_children: one of the atoms is a JumpAtom!");
425 AtomCOP first_atom( 0 ), second_atom( 0 );
427 Real phi_offset(0.0);
430 it_end=
atoms_end(); it != it_end; ++it ) {
431 if ( first_atom ) phi_offset += (*it)->dof(
PHI);
433 if ( *it == child1 || *it == child2 ) {
443 if ( !second_atom ) {
444 utility_exit_with_message(
"Atom_::dihedral_between_bonded_children: atoms not found!");
446 if ( second_atom == child1 ) phi_offset *= -1.0;
459 for (
int ii=0, ie=
n_children(); ii < ie; ++ii ) {
460 if (
child(ii) == atom1 ) {
519 return parent_->previous_child(
this );
534 if ( iter ==
atoms_.end() ) {
535 std::cerr <<
"child not present in atoms list! " <<
atoms_.size() << std::endl;
538 if ( iter ==
atoms_.begin() ) {
555 if ( iter ==
atoms_.end() ) {
556 std::cerr <<
"child not present in atoms list! " <<
atoms_.size() << std::endl;
560 if ( iter ==
atoms_.end() ) {
627 for ( Atoms::iterator it =
atoms_.begin(), it_end =
atoms_.end(); it != it_end; ++it ) {
628 if ( *it == child ) {
629 (*it)->update_internal_coords( my_stub );
632 if ( it != it_end ) {
633 (*it)->update_internal_coords( my_stub,
false );
639 (*it)->update_stub( my_stub );
643 std::cerr <<
"update_child_torsions:: child not in atoms list" <<
644 atom_id_ <<
' ' << child->id() << std::endl;
662 for ( Atoms::iterator it =
atoms_.begin(), it_end =
atoms_.end(); it != it_end; ++it ) {
663 (*it)->transform_Ax_plus_b_recursive( A, b, res_change_list );
674 path.push_back(
this );
682 return ( atm() ==
this || (
parent_ &&
parent_->atom_is_on_path_from_root( atm ) ) );
690 Atoms::const_iterator iter(
atoms_.begin() );
691 while ( iter !=
atoms_.end() && (*iter)->is_jump() ) ++iter;
700 Atoms::iterator iter(
atoms_.begin() );
701 while ( iter !=
atoms_.end() && (*iter)->is_jump() ) ++iter;
716 Size const start_atom_index
723 (*iter)->dfs( changeset, res_change_list, start_atom_index );
731 (*iter)->dfs( changeset, res_change_list, start_atom_index );
736 (*iter)->dfs( changeset, res_change_list, start_atom_index );
765 std::cerr <<
"kinematics::Atom bad method call in Atom hierarchy!" << std::endl;