IMP logo
IMP Reference Guide  2.17.0
The Integrative Modeling Platform
container/generic.h
Go to the documentation of this file.
1 /**
2  * \file IMP/container/generic.h \brief Various important functionality
3  * for implementing decorators.
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPCONTAINER_GENERIC_H
10 #define IMPCONTAINER_GENERIC_H
11 
12 #include <IMP/container/container_config.h>
13 #include <IMP/internal/ContainerRestraint.h>
14 #include <IMP/internal/ContainerConstraint.h>
16 
17 IMPCONTAINER_BEGIN_NAMESPACE
18 
19 /** Create a restraint from a score and a container. The resulting restraint
20  is, in general, more efficient than creating an, eg, PairsRestraint.
21 
22  A Python version of this is provided, but it produces a slightly less
23  efficient restraint.
24 */
25 template <class Score, class Container>
26 inline Restraint *create_restraint(Score *s, Container *c,
27  std::string name = std::string()) {
28  return IMP::internal::create_container_restraint(s, c, name);
29 }
30 
31 /** Helper to create a ContainerConstraint.
32  */
33 template <class Container, class Before, class After>
34 inline Constraint *create_constraint(Before *b, After *a, Container *c,
35  std::string name = std::string()) {
36  return IMP::internal::create_container_constraint(c, b, a, name);
37 }
38 
39 /** Create a filter that returns whether the pair, or its flip is
40  contained in the passed container.
41 
42  \note This is different than the InContainerPairFilter.*/
43 template <class Container>
45  std::string name =
46  std::string()) {
47  return new InContainerPairFilter(c, name);
48 }
49 
50 IMPCONTAINER_END_NAMESPACE
51 
52 #endif /* IMPCONTAINER_GENERIC_H */
A filter which returns true if a container containers the Pair.
Restraint * create_restraint(Score *s, Container *c, std::string name=std::string())
A filter for Pairs.
Implement a constraint on the Model.
Definition: Constraint.h:49
Abstract predicate function.
Definition: PairPredicate.h:31
PairPredicate * create_in_container_filter(Container *c, std::string name=std::string())
Constraint * create_constraint(Before *b, After *a, Container *c, std::string name=std::string())
Abstract class for containers of particles.
A restraint is a term in an IMP ScoringFunction.
Definition: Restraint.h:53