source: src/FunctionApproximation/FunctionArgument.hpp@ 6cfb22a

Fix_FitPotential_needs_atomicnumbers
Last change on this file since 6cfb22a was fdd789, checked in by Frederik Heber <heber@…>, 9 years ago

Added bonded flag to argument_t.

  • Property mode set to 100644
File size: 3.8 KB
RevLine 
[66cfc7]1/*
2 * FunctionArgument.hpp
3 *
4 * Created on: 02.10.2012
5 * Author: heber
6 */
7
8#ifndef FUNCTIONARGUMENT_HPP_
9#define FUNCTIONARGUMENT_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include <utility>
[9e903b]17#include <iosfwd>
[66cfc7]18
[4266eb]19#include "FunctionApproximation/Subgraph/SubgraphEdge.hpp"
20
[66cfc7]21/** This class encapsulates all information with respect to a single argument
22 * for a high-dimensional model function.
23 *
24 * We restrict ourselves here to a function that dependent on a set of
25 * three-dimensional vectors, i.e. a set of positions in space. And for
26 * the moment to distances in between these sets.
27 *
28 */
[4266eb]29struct argument_t : public SubgraphEdge
[66cfc7]30{
[9e903b]31 //!> grant operator access to private parts
32 friend std::ostream& operator<<(std::ostream &ost, const argument_t &arg);
33
[5b5724]34 /** Default constructor for class argument_t.
35 *
36 */
37 argument_t() :
[eb1efe]38 distance(0.),
[fdd789]39 globalid(-1),
40 bonded(false)
[5b5724]41 {}
42
43 /** Constructor for class argument_t.
44 *
45 * This constructors uses the index pair (0,1) as default.
46 *
47 * \param _distance distance argument
[fdd789]48 * \param _bonded is this a distance between bonded (true) or nonbonded (false) atoms
[5b5724]49 */
[fdd789]50 argument_t(const double &_distance, const bool _bonded = false) :
[4266eb]51 SubgraphEdge(
52 indices_t( std::make_pair(0,1) ),
53 types_t( std::make_pair(0,0) )),
[eb1efe]54 distance(_distance),
[fdd789]55 globalid(-1),
56 bonded(_bonded)
[5b5724]57 {}
58
59 /** Constructor for class argument_t.
60 *
61 * \param _indices pair of indices associated with the \a _distance
62 * \param _distance distance argument
[fdd789]63 * \param _bonded is this a distance between bonded (true) or nonbonded (false) atoms
[5b5724]64 */
[fdd789]65 argument_t(const indices_t &_indices, const double &_distance, const bool _bonded = false) :
[4266eb]66 SubgraphEdge(
67 indices,
68 types_t( std::make_pair(0,0) )),
[691be4]69 distance(_distance),
[fdd789]70 globalid(-1),
71 bonded(_bonded)
[691be4]72 {}
73
74 /** Constructor for class argument_t.
75 *
76 * \param _indices pair of indices associated with the \a _distance
77 * \param _types pair of particle type
78 * \param _distance distance argument
[fdd789]79 * \param _bonded is this a distance between bonded (true) or nonbonded (false) atoms
[691be4]80 */
[fdd789]81 argument_t(
82 const indices_t &_indices,
83 const types_t &_types,
84 const double &_distance,
85 const bool _bonded = false) :
[4266eb]86 SubgraphEdge(_indices, _types),
[eb1efe]87 distance(_distance),
[fdd789]88 globalid(-1),
89 bonded(_bonded)
[5b5724]90 {}
91
[355af8]92 /** Comparator with respect to the distance.
93 *
94 * \note We'll have this as static function to allow usage in e.g. STL's sort.
95 *
96 * \param one first argument
97 * \param other other argument to compare to \a one to
98 * \return true - first distance is less
99 */
100 static bool DistanceComparator(const argument_t &one, const argument_t &other)
101 {
102 return one.distance < other.distance;
103 }
104
[64bdfd]105 /** Comparator with respect to the pair of types.
106 *
107 * \note We'll have this as static function to allow usage in e.g. STL's sort.
108 *
109 * \param one first argument
110 * \param other other argument to compare to \a one to
111 * \return true - first type is less or if equal, second type is less, else
112 */
[355af8]113 bool static IndexComparator(const argument_t &one, const argument_t &other)
114 {
[4266eb]115 return (static_cast<const SubgraphEdge &>(one) < static_cast<const SubgraphEdge &>(other));
[64bdfd]116 }
117
[66cfc7]118 //!> distance
119 double distance;
[eb1efe]120 //!> global id refers to some global index, e.g. the configuration id in training set
121 size_t globalid;
[fdd789]122 //!> states whether this argument is between bonded (true) or nonbonded (false) atoms
123 bool bonded;
[66cfc7]124};
125
[9e903b]126/** Print given \a arg to stream \a ost.
127 *
128 * \param ost output stream to print to
129 * \param arg argument to print
130 * \return output stream for concatenation
131 */
132std::ostream& operator<<(std::ostream &ost, const argument_t &arg);
133
134
[66cfc7]135#endif /* FUNCTIONARGUMENT_HPP_ */
Note: See TracBrowser for help on using the repository browser.