IMP logo
IMP Reference Guide  2.9.0
The Integrative Modeling Platform
protobuf.h
Go to the documentation of this file.
1 /**
2  * \file protobuf.h
3  * \brief A Score on the distance between a pair of particles.
4  *
5  * Copyright 2007-2018 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPNPCTRANSPORT_PROTOBUF_H
9 #define IMPNPCTRANSPORT_PROTOBUF_H
10 
11 #include "npctransport_config.h"
12 #include <IMP/SingletonContainer.h>
13 #include <IMP/core/Typed.h>
14 #include <boost/cstdint.hpp>
15 #include <set>
16 
17 #ifndef SWIG
18 // instead of including protobuf header, which is problematic due to
19 // minor issue with google headers namespaces
20 namespace npctransport_proto {
21  class Conformation;
22 }
23 #endif
24 
25 IMPNPCTRANSPORT_BEGIN_NAMESPACE
26 
27 
28 IMPNPCTRANSPORTEXPORT void show_ranges(std::string fname);
29 
30 /**
31  reads the protobuf message in [input_config_fname], which may contain submessages with
32  ranges of values (indicated by presence of .upper and .lower fields, with
33  .steps possible steps for each such field). The output is a message with
34  the [work_unit]'th possible combination of these ranges, to the file
35  [output_assignment_fname].
36 
37  Note: the range values are enumerated as if they lie on a grid with
38  log-evenly distributed axis-aligned grid points, using the .base field
39  as the log base for each ranged field, such that e.g. iterating over the
40  range [1..8] with 3 steps and base 2 will be enumerated as (1,4,8)
41 
42  @param fname input_config_fname configuration file name
43  @param output output_assignment_fname assignment file name
44  @param work_unit the index of combination of range values to be used. If the
45  total of possible combinations of all fields with ranges is
46  k,
47  it is guaranteed that iterating over work_unit between
48  0..k-1
49  will enumerate over all possible combinations, and that
50  work_unit and (work_unit % k) will return the same output
51  for
52  the same input.
53  @param show_steps show the steps that occur
54  @param random_seed the random seed used to initialize the IMP random number
55  generator for this simulation
56 
57  @throw IMP::ValueException if any of the values in the configuration
58  file are in conflict (e.g., simulation time and maximal number of
59  frames)
60 */
61 // Each range field also has .steps and .base field.
62 IMPNPCTRANSPORTEXPORT int assign_ranges(
63  std::string input_config_fname, std::string output_assignment_fname, unsigned int work_unit,
64  bool show_steps,
65  boost::uint64_t random_seed // do not use boost::uint64_t cause of SWIG
66  );
67 
68 IMPNPCTRANSPORTEXPORT int get_number_of_work_units(
69  std::string configuration_file);
70 
71 #ifndef SWIG
72 /**
73  Loads a protobuf conformation into the diffusers and sites
74 
75  @param conformation the saved conformation protobuf message
76  @param beads corresponding diffusers to be updated
77  @param sites a map of sites for each diffuser particle type
78  to be updated
79 
80  @note the beads and sites must have the same structure
81  as the ones used when saving (e.g. their
82  non-changing variables are expected to
83  be identical, and they differ only in the
84  dynamic ones)
85  \see save_pb_conformation
86 */
88 ( const ::npctransport_proto::Conformation &conformation,
90  boost::unordered_map<core::ParticleType, algebra::Sphere3Ds> &sites);
91 
92 /**
93  Saves a protobuf conformation from the diffusers and sites
94 
95  @param beads beads to save
96  @param sites a map of sites for each diffuser particle type
97  to be saved
98  @param conformation the conformation protobuf message to be save
99 
100  \see load_pb_conformation
101  */
104  const boost::unordered_map<core::ParticleType, algebra::Sphere3Ds> &sites,
105  ::npctransport_proto::Conformation *conformation );
106 #endif
107 
108 IMPNPCTRANSPORT_END_NAMESPACE
109 
110 #endif /* IMPNPCTRANSPORT_PROTOBUF_H */
A container for Singletons.
int assign_ranges(std::string input_config_fname, std::string output_assignment_fname, unsigned int work_unit, bool show_steps, boost::uint64_t random_seed)
void load_pb_conformation(const ::npctransport_proto::Conformation &conformation, IMP::SingletonContainerAdaptor beads, boost::unordered_map< core::ParticleType, algebra::Sphere3Ds > &sites)
A particle with a user-defined type.
void save_pb_conformation(IMP::SingletonContainerAdaptor beads, const boost::unordered_map< core::ParticleType, algebra::Sphere3Ds > &sites,::npctransport_proto::Conformation *conformation)