Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
XYZ_Func.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 
13 /// Unit headers
15 
16 #include <core/types.hh>
17 
20 #include <core/id/AtomID.hh>
21 
22 #include <utility/assert.hh>
23 
24 #include <utility/vector1.hh>
25 
26 
27 namespace core {
28 namespace scoring {
29 namespace constraints {
30 
31 //////////////////////////////////////////////////////////////////////////////////
32 //////////////////////////////////////////////////////////////////////////////////
33 /// helper classes to reuse code
34 //////////////////////////////////////////////////////////////////////////////////
35 //////////////////////////////////////////////////////////////////////////////////
36 
37 
39 
40 
41 ResidueXYZ::ResidueXYZ( Residue const & rsd_in ): rsd_( rsd_in ) {}
42 
43 
44 Vector const &
45 ResidueXYZ::operator()( AtomID const & id ) const
46 {
47  assert( id.rsd() == rsd_.seqpos() && id.atomno() <= rsd_.natoms() );
48  return rsd_.xyz( id.atomno() );
49 }
50 
51 
53 ResidueXYZ::residue( Size ASSERT_ONLY( seqpos ) ) const {
54  assert( (Size) rsd_.seqpos() == seqpos );
55  return rsd_;
56 }
57 
58 
60 
61 ResiduePairXYZ::ResiduePairXYZ( Residue const & rsd1_in, Residue const & rsd2_in )
62 :
63  rsd1_( rsd1_in ),
64  rsd2_( rsd2_in )
65 {}
66 
67 
68 Vector const &
70 {
71  Residue const & rsd( ( id.rsd() == rsd1_.seqpos() ) ? rsd1_ : rsd2_ );
72  assert( id.rsd() == rsd.seqpos() && id.atomno() <= rsd.natoms() );
73  return rsd.xyz( id.atomno() );
74 }
75 
76 
78 ResiduePairXYZ::residue( Size seqpos ) const {
79  assert( (Size) rsd1_.seqpos() == seqpos || (Size) rsd2_.seqpos() == seqpos );
80  return (Size) rsd1_.seqpos() == seqpos ? rsd1_ : rsd2_;
81 }
82 
84 
85 ConformationXYZ::ConformationXYZ( Conformation const & conformation_in ): conformation_( conformation_in ) {}
86 
87 
88 Vector const &
90 {
91  return conformation_.xyz( id );
92 }
93 
94 
96 ConformationXYZ::residue( Size seqpos ) const {
97  return conformation_.residue( seqpos );
98 }
99 
101 
102 } // constraints
103 } // scoring
104 } // core
105