9 #ifndef RMF_PHYSICS_DECORATORS_H
10 #define RMF_PHYSICS_DECORATORS_H
12 #include <RMF/config.h>
19 #include <RMF/internal/paths.h>
21 #include <boost/lexical_cast.hpp>
43 coordinates_(coordinates),
48 Float get_mass()
const {
50 return get_node().get_value(mass_);
51 } RMF_DECORATOR_CATCH( );
53 Float get_frame_mass()
const {
55 return get_node().get_frame_value(mass_);
56 } RMF_DECORATOR_CATCH( );
58 Float get_static_mass()
const {
60 return get_node().get_static_value(mass_);
61 } RMF_DECORATOR_CATCH( );
65 Vector3 get_coordinates()
const {
67 return get_node().get_value(coordinates_);
68 } RMF_DECORATOR_CATCH( );
70 Vector3 get_frame_coordinates()
const {
72 return get_node().get_frame_value(coordinates_);
73 } RMF_DECORATOR_CATCH( );
75 Vector3 get_static_coordinates()
const {
77 return get_node().get_static_value(coordinates_);
78 } RMF_DECORATOR_CATCH( );
82 Float get_radius()
const {
84 return get_node().get_value(radius_);
85 } RMF_DECORATOR_CATCH( );
87 Float get_frame_radius()
const {
89 return get_node().get_frame_value(radius_);
90 } RMF_DECORATOR_CATCH( );
92 Float get_static_radius()
const {
94 return get_node().get_static_value(radius_);
95 } RMF_DECORATOR_CATCH( );
98 static std::string get_decorator_type_name() {
99 return "ParticleConst";
117 void set_mass(
Float v) {
120 } RMF_DECORATOR_CATCH( );
122 void set_frame_mass(
Float v) {
125 } RMF_DECORATOR_CATCH( );
127 void set_static_mass(
Float v) {
130 } RMF_DECORATOR_CATCH( );
134 void set_coordinates(
Vector3 v) {
137 } RMF_DECORATOR_CATCH( );
139 void set_frame_coordinates(
Vector3 v) {
142 } RMF_DECORATOR_CATCH( );
144 void set_static_coordinates(
Vector3 v) {
147 } RMF_DECORATOR_CATCH( );
151 void set_radius(
Float v) {
154 } RMF_DECORATOR_CATCH( );
156 void set_frame_radius(
Float v) {
159 } RMF_DECORATOR_CATCH( );
161 void set_static_radius(
Float v) {
164 } RMF_DECORATOR_CATCH( );
167 static std::string get_decorator_type_name() {
185 cat_(fh.get_category(
"physics")),
189 cat_(fh.get_category(
"physics")),
194 RMF_USAGE_CHECK((nh.get_type() ==
RMF::REPRESENTATION), std::string(
"Bad node type. Got \"")
195 + boost::lexical_cast<std::string>(nh.get_type())
196 +
"\" in decorator type Particle");
203 RMF_USAGE_CHECK((nh.get_type() ==
RMF::REPRESENTATION), std::string(
"Bad node type. Got \"")
204 + boost::lexical_cast<std::string>(nh.get_type())
205 +
"\" in decorator type Particle");
214 && !nh.get_value(mass_).get_is_null();
218 && !nh.get_static_value(mass_).get_is_null()
219 && !nh.get_static_value(coordinates_).get_is_null()
220 && !nh.get_static_value(radius_).get_is_null();
222 RMF_SHOWABLE(ParticleFactory,
"ParticleFactory");
225 struct ParticleConstFactory:
public ParticleFactory {
226 ParticleConstFactory(FileConstHandle fh):
227 ParticleFactory(fh) {
229 ParticleConstFactory(FileHandle fh):
230 ParticleFactory(fh) {
251 coordinates_(coordinates) {
255 Float get_radius()
const {
257 return get_node().get_value(radius_);
258 } RMF_DECORATOR_CATCH( );
260 Float get_frame_radius()
const {
262 return get_node().get_frame_value(radius_);
263 } RMF_DECORATOR_CATCH( );
265 Float get_static_radius()
const {
267 return get_node().get_static_value(radius_);
268 } RMF_DECORATOR_CATCH( );
272 Vector3 get_coordinates()
const {
274 return get_node().get_value(coordinates_);
275 } RMF_DECORATOR_CATCH( );
277 Vector3 get_frame_coordinates()
const {
279 return get_node().get_frame_value(coordinates_);
280 } RMF_DECORATOR_CATCH( );
282 Vector3 get_static_coordinates()
const {
284 return get_node().get_static_value(coordinates_);
285 } RMF_DECORATOR_CATCH( );
288 static std::string get_decorator_type_name() {
289 return "IntermediateParticleConst";
305 void set_radius(
Float v) {
308 } RMF_DECORATOR_CATCH( );
310 void set_frame_radius(
Float v) {
313 } RMF_DECORATOR_CATCH( );
315 void set_static_radius(
Float v) {
318 } RMF_DECORATOR_CATCH( );
322 void set_coordinates(
Vector3 v) {
325 } RMF_DECORATOR_CATCH( );
327 void set_frame_coordinates(
Vector3 v) {
330 } RMF_DECORATOR_CATCH( );
332 void set_static_coordinates(
Vector3 v) {
335 } RMF_DECORATOR_CATCH( );
338 static std::string get_decorator_type_name() {
339 return "IntermediateParticle";
354 cat_(fh.get_category(
"physics")),
358 cat_(fh.get_category(
"physics")),
364 + boost::lexical_cast<std::string>(nh.
get_type())
365 +
"\" in decorator type IntermediateParticle");
372 + boost::lexical_cast<std::string>(nh.
get_type())
373 +
"\" in decorator type IntermediateParticle");
381 && !nh.get_value(radius_).get_is_null();
385 && !nh.get_static_value(radius_).get_is_null()
386 && !nh.get_static_value(coordinates_).get_is_null();
388 RMF_SHOWABLE(IntermediateParticleFactory,
"IntermediateParticleFactory");
391 struct IntermediateParticleConstFactory:
public IntermediateParticleFactory {
392 IntermediateParticleConstFactory(FileConstHandle fh):
393 IntermediateParticleFactory(fh) {
395 IntermediateParticleConstFactory(FileHandle fh):
396 IntermediateParticleFactory(fh) {
416 variances_(variances),
421 Vector3 get_variances()
const {
423 return get_node().get_value(variances_);
424 } RMF_DECORATOR_CATCH( );
426 Vector3 get_frame_variances()
const {
428 return get_node().get_frame_value(variances_);
429 } RMF_DECORATOR_CATCH( );
431 Vector3 get_static_variances()
const {
433 return get_node().get_static_value(variances_);
434 } RMF_DECORATOR_CATCH( );
438 Float get_mass()
const {
440 return get_node().get_value(mass_);
441 } RMF_DECORATOR_CATCH( );
443 Float get_frame_mass()
const {
445 return get_node().get_frame_value(mass_);
446 } RMF_DECORATOR_CATCH( );
448 Float get_static_mass()
const {
450 return get_node().get_static_value(mass_);
451 } RMF_DECORATOR_CATCH( );
454 static std::string get_decorator_type_name() {
455 return "GaussianParticleConst";
471 void set_variances(
Vector3 v) {
474 } RMF_DECORATOR_CATCH( );
476 void set_frame_variances(
Vector3 v) {
479 } RMF_DECORATOR_CATCH( );
481 void set_static_variances(
Vector3 v) {
484 } RMF_DECORATOR_CATCH( );
488 void set_mass(
Float v) {
491 } RMF_DECORATOR_CATCH( );
493 void set_frame_mass(
Float v) {
496 } RMF_DECORATOR_CATCH( );
498 void set_static_mass(
Float v) {
501 } RMF_DECORATOR_CATCH( );
504 static std::string get_decorator_type_name() {
505 return "GaussianParticle";
520 cat_(fh.get_category(
"physics")),
524 cat_(fh.get_category(
"physics")),
530 + boost::lexical_cast<std::string>(nh.
get_type())
531 +
"\" in decorator type GaussianParticle");
538 + boost::lexical_cast<std::string>(nh.
get_type())
539 +
"\" in decorator type GaussianParticle");
547 && !nh.get_value(variances_).get_is_null();
551 && !nh.get_static_value(variances_).get_is_null()
552 && !nh.get_static_value(mass_).get_is_null();
554 RMF_SHOWABLE(GaussianParticleFactory,
"GaussianParticleFactory");
557 struct GaussianParticleConstFactory:
public GaussianParticleFactory {
558 GaussianParticleConstFactory(FileConstHandle fh):
559 GaussianParticleFactory(fh) {
561 GaussianParticleConstFactory(FileHandle fh):
562 GaussianParticleFactory(fh) {
582 orientation_(orientation),
583 coordinates_(coordinates) {
587 Vector4 get_orientation()
const {
589 return get_node().get_value(orientation_);
590 } RMF_DECORATOR_CATCH( );
592 Vector4 get_frame_orientation()
const {
594 return get_node().get_frame_value(orientation_);
595 } RMF_DECORATOR_CATCH( );
597 Vector4 get_static_orientation()
const {
599 return get_node().get_static_value(orientation_);
600 } RMF_DECORATOR_CATCH( );
604 Vector3 get_coordinates()
const {
606 return get_node().get_value(coordinates_);
607 } RMF_DECORATOR_CATCH( );
609 Vector3 get_frame_coordinates()
const {
611 return get_node().get_frame_value(coordinates_);
612 } RMF_DECORATOR_CATCH( );
614 Vector3 get_static_coordinates()
const {
616 return get_node().get_static_value(coordinates_);
617 } RMF_DECORATOR_CATCH( );
620 static std::string get_decorator_type_name() {
621 return "RigidParticleConst";
637 void set_orientation(
Vector4 v) {
640 } RMF_DECORATOR_CATCH( );
642 void set_frame_orientation(
Vector4 v) {
645 } RMF_DECORATOR_CATCH( );
647 void set_static_orientation(
Vector4 v) {
650 } RMF_DECORATOR_CATCH( );
654 void set_coordinates(
Vector3 v) {
657 } RMF_DECORATOR_CATCH( );
659 void set_frame_coordinates(
Vector3 v) {
662 } RMF_DECORATOR_CATCH( );
664 void set_static_coordinates(
Vector3 v) {
667 } RMF_DECORATOR_CATCH( );
670 static std::string get_decorator_type_name() {
671 return "RigidParticle";
686 cat_(fh.get_category(
"physics")),
690 cat_(fh.get_category(
"physics")),
696 + boost::lexical_cast<std::string>(nh.
get_type())
697 +
"\" in decorator type RigidParticle");
704 + boost::lexical_cast<std::string>(nh.
get_type())
705 +
"\" in decorator type RigidParticle");
713 && !nh.get_value(orientation_).get_is_null();
717 && !nh.get_static_value(orientation_).get_is_null()
718 && !nh.get_static_value(coordinates_).get_is_null();
720 RMF_SHOWABLE(RigidParticleFactory,
"RigidParticleFactory");
723 struct RigidParticleConstFactory:
public RigidParticleFactory {
724 RigidParticleConstFactory(FileConstHandle fh):
725 RigidParticleFactory(fh) {
727 RigidParticleConstFactory(FileHandle fh):
728 RigidParticleFactory(fh) {
746 diffusion_coefficient_(diffusion_coefficient) {
750 Float get_diffusion_coefficient()
const {
752 return get_node().get_value(diffusion_coefficient_);
753 } RMF_DECORATOR_CATCH( );
755 Float get_frame_diffusion_coefficient()
const {
757 return get_node().get_frame_value(diffusion_coefficient_);
758 } RMF_DECORATOR_CATCH( );
760 Float get_static_diffusion_coefficient()
const {
762 return get_node().get_static_value(diffusion_coefficient_);
763 } RMF_DECORATOR_CATCH( );
766 static std::string get_decorator_type_name() {
767 return "DiffuserConst";
781 void set_diffusion_coefficient(
Float v) {
783 get_node().
set_value(diffusion_coefficient_, v);
784 } RMF_DECORATOR_CATCH( );
786 void set_frame_diffusion_coefficient(
Float v) {
789 } RMF_DECORATOR_CATCH( );
791 void set_static_diffusion_coefficient(
Float v) {
794 } RMF_DECORATOR_CATCH( );
797 static std::string get_decorator_type_name() {
811 cat_(fh.get_category(
"physics")),
812 diffusion_coefficient_(fh.
get_key<FloatTag>(cat_,
"diffusion coefficient")) {
815 cat_(fh.get_category(
"physics")),
816 diffusion_coefficient_(fh.
get_key<FloatTag>(cat_,
"diffusion coefficient")) {
821 + boost::lexical_cast<std::string>(nh.
get_type())
822 +
"\" in decorator type Diffuser");
828 + boost::lexical_cast<std::string>(nh.
get_type())
829 +
"\" in decorator type Diffuser");
830 return Diffuser(nh, diffusion_coefficient_);
836 && !nh.get_value(diffusion_coefficient_).get_is_null();
840 && !nh.get_static_value(diffusion_coefficient_).get_is_null();
842 RMF_SHOWABLE(DiffuserFactory,
"DiffuserFactory");
845 struct DiffuserConstFactory:
public DiffuserFactory {
846 DiffuserConstFactory(FileConstHandle fh):
847 DiffuserFactory(fh) {
849 DiffuserConstFactory(FileHandle fh):
850 DiffuserFactory(fh) {
878 Int get_element()
const {
880 return get_node().get_value(element_);
881 } RMF_DECORATOR_CATCH( );
883 Int get_frame_element()
const {
885 return get_node().get_frame_value(element_);
886 } RMF_DECORATOR_CATCH( );
888 Int get_static_element()
const {
890 return get_node().get_static_value(element_);
891 } RMF_DECORATOR_CATCH( );
895 Float get_mass()
const {
897 return get_node().get_value(mass_);
898 } RMF_DECORATOR_CATCH( );
900 Float get_frame_mass()
const {
902 return get_node().get_frame_value(mass_);
903 } RMF_DECORATOR_CATCH( );
905 Float get_static_mass()
const {
907 return get_node().get_static_value(mass_);
908 } RMF_DECORATOR_CATCH( );
912 Float get_radius()
const {
914 return get_node().get_value(radius_);
915 } RMF_DECORATOR_CATCH( );
917 Float get_frame_radius()
const {
919 return get_node().get_frame_value(radius_);
920 } RMF_DECORATOR_CATCH( );
922 Float get_static_radius()
const {
924 return get_node().get_static_value(radius_);
925 } RMF_DECORATOR_CATCH( );
928 static std::string get_decorator_type_name() {
931 RMF_SHOWABLE(
AtomConst,
"Atom: " << get_node());
947 void set_element(
Int v) {
950 } RMF_DECORATOR_CATCH( );
952 void set_frame_element(
Int v) {
955 } RMF_DECORATOR_CATCH( );
957 void set_static_element(
Int v) {
960 } RMF_DECORATOR_CATCH( );
964 void set_mass(
Float v) {
967 } RMF_DECORATOR_CATCH( );
969 void set_frame_mass(
Float v) {
972 } RMF_DECORATOR_CATCH( );
974 void set_static_mass(
Float v) {
977 } RMF_DECORATOR_CATCH( );
981 void set_radius(
Float v) {
984 } RMF_DECORATOR_CATCH( );
986 void set_frame_radius(
Float v) {
989 } RMF_DECORATOR_CATCH( );
991 void set_static_radius(
Float v) {
994 } RMF_DECORATOR_CATCH( );
997 static std::string get_decorator_type_name() {
1015 cat_(fh.get_category(
"physics")),
1016 element_(fh.
get_key<IntTag>(cat_,
"element")), mass_(fh.
get_key<FloatTag>(cat_,
"mass")), radius_(fh.
get_key<FloatTag>(cat_,
"radius")) {
1019 cat_(fh.get_category(
"physics")),
1020 element_(fh.
get_key<IntTag>(cat_,
"element")), mass_(fh.
get_key<FloatTag>(cat_,
"mass")), radius_(fh.
get_key<FloatTag>(cat_,
"radius")) {
1025 + boost::lexical_cast<std::string>(nh.
get_type())
1026 +
"\" in decorator type Atom");
1034 + boost::lexical_cast<std::string>(nh.
get_type())
1035 +
"\" in decorator type Atom");
1036 return Atom(nh, element_,
1044 && !nh.get_value(element_).get_is_null();
1048 && !nh.get_static_value(element_).get_is_null()
1049 && !nh.get_static_value(mass_).get_is_null()
1050 && !nh.get_static_value(radius_).get_is_null();
1052 RMF_SHOWABLE(AtomFactory,
"AtomFactory");
1055 struct AtomConstFactory:
public AtomFactory {
1056 AtomConstFactory(FileConstHandle fh):
1059 AtomConstFactory(FileHandle fh):
1080 rotation_(rotation),
1081 translation_(translation) {
1085 Vector4 get_rotation()
const {
1087 return get_node().get_value(rotation_);
1088 } RMF_DECORATOR_CATCH( );
1090 Vector4 get_frame_rotation()
const {
1092 return get_node().get_frame_value(rotation_);
1093 } RMF_DECORATOR_CATCH( );
1095 Vector4 get_static_rotation()
const {
1097 return get_node().get_static_value(rotation_);
1098 } RMF_DECORATOR_CATCH( );
1102 Vector3 get_translation()
const {
1104 return get_node().get_value(translation_);
1105 } RMF_DECORATOR_CATCH( );
1107 Vector3 get_frame_translation()
const {
1109 return get_node().get_frame_value(translation_);
1110 } RMF_DECORATOR_CATCH( );
1112 Vector3 get_static_translation()
const {
1114 return get_node().get_static_value(translation_);
1115 } RMF_DECORATOR_CATCH( );
1118 static std::string get_decorator_type_name() {
1119 return "ReferenceFrameConst";
1135 void set_rotation(
Vector4 v) {
1138 } RMF_DECORATOR_CATCH( );
1140 void set_frame_rotation(
Vector4 v) {
1143 } RMF_DECORATOR_CATCH( );
1145 void set_static_rotation(
Vector4 v) {
1148 } RMF_DECORATOR_CATCH( );
1152 void set_translation(
Vector3 v) {
1155 } RMF_DECORATOR_CATCH( );
1157 void set_frame_translation(
Vector3 v) {
1160 } RMF_DECORATOR_CATCH( );
1162 void set_static_translation(
Vector3 v) {
1165 } RMF_DECORATOR_CATCH( );
1168 static std::string get_decorator_type_name() {
1169 return "ReferenceFrame";
1184 cat_(fh.get_category(
"physics")),
1188 cat_(fh.get_category(
"physics")),
1194 + boost::lexical_cast<std::string>(nh.
get_type())
1195 +
"\" in decorator type ReferenceFrame");
1202 + boost::lexical_cast<std::string>(nh.
get_type())
1203 +
"\" in decorator type ReferenceFrame");
1211 && !nh.get_value(rotation_).get_is_null();
1215 && !nh.get_static_value(rotation_).get_is_null()
1216 && !nh.get_static_value(translation_).get_is_null();
1218 RMF_SHOWABLE(ReferenceFrameFactory,
"ReferenceFrameFactory");
1221 struct ReferenceFrameConstFactory:
public ReferenceFrameFactory {
1222 ReferenceFrameConstFactory(FileConstHandle fh):
1223 ReferenceFrameFactory(fh) {
1225 ReferenceFrameConstFactory(FileHandle fh):
1226 ReferenceFrameFactory(fh) {
1236 RMF_DISABLE_WARNINGS
Mostly empty base classes for decorators and factories.
bool get_is(NodeConstHandle nh) const
const NodeType REPRESENTATION
Represent part of a molecule.
bool get_is(NodeConstHandle nh) const
A handle for a particular node in the hierarchy.
bool get_is(NodeConstHandle nh) const
The base class for decorators.
NodeType get_type() const
get the type of this node
bool get_is(NodeConstHandle nh) const
A handle for a particular node in a read-only hierarchy.
Helper functions for manipulating RMF files.
A handle for a read-only RMF file.
void set_value(ID< Tag > k, typename Tag::ArgumentType v) const
A handle for an RMF file.
bool get_is(NodeConstHandle nh) const
The base class for Factories.
Declaration for RMF::FileHandle.
Declaration of NodeHandle.
bool get_is(NodeConstHandle nh) const
void set_static_value(ID< Tag > k, typename Tag::ArgumentType v) const
set the value of the attribute k for all frames.
ID< Tag > get_key(Category category, std::string name) const
bool get_is(NodeConstHandle nh) const
Various general useful macros for IMP.
const NodeType ORGANIZATIONAL
A node that is purely there for organizational purposes.
void set_frame_value(ID< Tag > k, typename Tag::ArgumentType v) const
set the value of the attribute k for this node on the current frame.
Traits classes describing how RMF uses types for storing data.