Debian Codegraph @

include/BALL/MOLMEC/PARAMETER/templates.h

raw symbols SCIP
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4
5 // Molecular Mechanics Parameter: class describing the atom type section of a parameter file
6
7 #ifndef BALL_MOLMEC_PARAMETER_TEMPLATES_H
8 #define BALL_MOLMEC_PARAMETER_TEMPLATES_H
9
10 #ifndef BALL_FORMAT_PARAMETERSECTION_H
11 # include <BALL/FORMAT/parameterSection.h>
12 #endif
13
14 #ifndef BALL_KERNEL_SYSTEM_H
15 # include <BALL/KERNEL/system.h>
16 #endif
17
18 #ifndef BALL_DATATYPE_HASHSET_H
19 # include <BALL/DATATYPE/hashset.h>
20 #endif
21
22 #include <BALL/KERNEL/atom.h>
23
24 namespace BALL
25 {
26 class Atom;
27
28 /** Force Field Residue Template Class.
29 \ingroup MolmecParameters
30 */
31 class BALL_EXPORT Templates
32 : public ParameterSection
33 {
34 public:
35
36 /** @name Constructors and Destructors
37 */
38 //@{
39
40 /** Default constructor.
41 */
42 Templates();
43
44 /** Copy constructor.
45 */
46 Templates(const Templates& templates, bool deep = true);
47
48 /** Destructor.
49 */
50 virtual ~Templates() ;
51
52 /** Clear method.
53 */
54 virtual void clear() ;
55
56 //@}
57 /** Parameter extraction
58 */
59 //@{
60
61 /** Reads a parameter section from an INI file.
62 This method reads the section given in section_name from ini_file,
63 interprets (if given) a format line, reads the data from this section according to
64 the format, and builds some datastructures for fast and easy acces this data.
65 The section is typically entitled <b>ChargesAndTypeNames</b>.
66 */
67 virtual bool extractSection(Parameters& parameters, const String& section_name);
68
69 /** Returns the numeric type for a given string.
70 */
71 float getCharge(const String& name) const;
72
73 /** Returns the name for a given index
74 */
75 String getTypeName(const String& name) const;
76
77 /** Queries whether a given template atom is defined
78 */
79 bool has(const String& name) const;
80
81 /** Assign charges and type names
82 */
83 void assign(System& system, bool overwrite_existing_typenames = true,
84 bool overwrite_non_zero_charges = true) const;
85
86 /** Assign charges and type names
87 */
88 void assignCharges(System& system, bool overwrite_non_zero_charges = true) const;
89
90 /** Assign type names
91 */
92 void assignTypeNames(System& system, bool overwrite_existing_typenames = true) const;
93
94 //@}
95 /** @name Assignment
96 */
97 //@{
98
99 /** Assignment operator.
100 Copy the contents of <tt>templates</tt> into <tt>this</tt> residue template object.
101 @param templates the residue template object to be copied
102 */
103 Templates& operator = (const Templates& templates);
104
105 /** Set the number of atoms, for which the assignment can
106 fail, until the assign() methods aborts and return false.
107 By default, there is no limit set.
108 */
109 void setMaximumUnassignedAtoms(Size nr);
110
111 /** Get the number of atoms, for which the assignment can
112 fail, until the assign() methods aborts and return false.
113 */
114 Size getMaximumUnassignedAtoms() const;
115
116 /// Get the number of atoms, for which the assignment failed.
117 Size getNumberOfUnassignedAtoms() const;
118
119 /// Get the atoms, for which the assignment failed.
120 HashSet<const Atom*>& getUnassignedAtoms();
121
122 //@}
123
124 protected:
125
126 /*_ Contains the charge for each residue/atom combination
127 */
128 StringHashMap<float> charges_;
129
130 /*_ Contains the atom type names for each residue/atom combination
131 */
132 StringHashMap<String> type_names_;
133
134 //_ Atoms, for which the assignment fails
135 HashSet<const Atom*> unassigned_atoms_;
136
137 //_ max number of unassigned atoms
138 Size max_number_unassigned_atoms_;
139 };
140 } // namespace BALL
141
142 #endif // BALL_MOLMEC_PARAMETER_TEMPLATES_H