IMP logo
IMP Reference Guide  2.22.0
The Integrative Modeling Platform
StatisticalPairScore.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/StatisticalPairScore.h
3  * \brief Functions to read mol2s
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPCORE_STATISTICAL_PAIR_SCORE_H
10 #define IMPCORE_STATISTICAL_PAIR_SCORE_H
11 
12 #include <IMP/core/core_config.h>
13 #include <IMP/generic.h>
14 #include <IMP/Model.h>
17 #include <IMP/Particle.h>
18 #include <IMP/PairScore.h>
19 #include <IMP/algebra/Vector3D.h>
20 #include "XYZ.h"
21 #include <IMP/file.h>
22 #include <limits>
23 
24 IMPCORE_BEGIN_NAMESPACE
25 /** Create a pairwise statistical potential from a file. The Keys passed
26  as a template argument are used to determine how to map the names of
27  the types as described in the loaded file to indexes. That is, if
28  atom::ResidueKey is passed as the Keys, the potential will expect a file
29  which has one line for each pair of residue names.
30 
31  The expected file format is:
32 \verbatim
33  bin_width number_a number_b [offset]
34  key_0a key_0b bin0 bin1 bin2...
35  key_1a key_1b bin0 bin1 bin2...
36 \endverbatim
37 
38  The order of the lines (after the first one) does not matter.
39  The bin_width is how much distance is allocated per bin (the distance used
40  is that between the points). number_a and number_b are the numbers of
41  particle types (number_b should only be specified if BIPARTITE is set).
42 
43  \note The values read in the file are for bins. That is, the first bin
44  is from offset to offset+width. The second is offset+width to offset+
45  2width.
46  As a result, when interpolation is used, the function achieves the
47  bin value at the center of the bin.
48 
49  \param[in] Key is an IMP::Key which maps between names and indices
50  \param[in] BIPARTITE If true, the two sets of particles being stored are
51  different (e.g. a protein atom and a ligand atom), otherwise they are
52  assumed to both be the same. Appropriate values must be provided
53  in the file.
54  \param[in] INTERPOLATE If true, even the scores without derivatives are
55  spline interpolated. If false, only the evaluation of derivatives is
56  interpolated with a spline.
57 */
58 template <class Key, bool BIPARTITE, bool INTERPOLATE, bool SPARSE = false>
61  score_functor::Statistical<Key, BIPARTITE, INTERPOLATE, SPARSE> > {
64 
65  public:
66  /** \param[in] k The attribute to use for determining the particle types
67  \param[in] threshold The maximum distance to score
68  \param[in] data_file Where to load the file from.
69  */
70  StatisticalPairScore(IntKey k, double threshold, TextInput data_file)
71  : P(S(k, threshold, data_file)) {}
72  /** \param[in] k The attribute to use for determining the particle types
73  \param[in] threshold The maximum distance to score
74  \param[in] data_file Where to load the file from.
75  \param[in] shift The offset for the types of the second set of types.
76  eg, if the score is on protein and ligand atoms, the ligand atom types
77  start with the value shift.
78  */
79  StatisticalPairScore(IntKey k, double threshold, TextInput data_file,
80  unsigned int shift)
81  : P(S(k, threshold, data_file, shift)) {}
82 };
83 IMPCORE_END_NAMESPACE
84 
85 #endif /* IMPCORE_STATISTICAL_PAIR_SCORE_H */
A Score on the distance between a pair of particles.
StatisticalPairScore(IntKey k, double threshold, TextInput data_file, unsigned int shift)
Storage of a model, its restraints, constraints and particles.
Handling of file input/output.
StatisticalPairScore(IntKey k, double threshold, TextInput data_file)
Create efficient distance-based pair scores.
Simple XYZ decorator.
Define PairScore.
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
Simple 3D vector class.
Compile-time generic restraint and constraint support.
A Score on the distance between a pair of particles.