| Bsoft 2.0.5 Bernard's software package

rwmodel.h
Go to the documentation of this file.
1
9 #include "View.h"
10 #include "Bstring.h"
11 #include "Color.h"
12
13 #ifndef _Bmodel_
14 #define MAXLINK 10 // Maximum number of links per component
15
16 /************************************************************************
17 @Object: struct Bcomptype
18 @Description:
19 Model component type parameter structure.
20 @Features:
21 Reference to a model file, either atomic coordinates or a 3D map.
22 Number of components of this type.
23 Figure-of-merit.
24 *************************************************************************/
25 struct Bcomptype {
26 Bcomptype* next; // Next component type in list
27 Bstring id; // Component type identifier
28 int index; // Type index for reference in a distance matrix
29 Bstring fmod; // Model file name (molecule or map)
30 int num; // Image number in model or map file
31 int count; // Number of components
32 float mass; // Component mass
33 float fom; // Figure-of-merit
34 int sel; // Selection flag
35 } ;
36
37 /************************************************************************
38 @Object: struct Bcomponent
39 @Description:
40 Model component parameter structure.
41 @Features:
42 Type which must be a valid component type.
43 Location.
44 Orientation.
45 Vector for use as force or displacement.
46 Radius.
47 Color.
48 Figure-of-merit.
49 Selection.
50 *************************************************************************/
51 struct Bcomponent {
52 Bcomponent* next; // Next component in list
53 Bstring id; // Component identifier
54 Bcomptype* type; // Component type pointer
55 Bcomponent* link[MAXLINK]; // Links to other components
56 Bcomponent* neighbor[MAXLINK]; // Neighboring components
57 int flag[MAXLINK]; // Flags for connectors
58 Vector3<float> loc; // Location coordinates (angstroms)
59 View view; // View: 3-value unit vector and angle (radians)
60 Vector3<float> vec; // Vector for use as force or displacement
61 Vector3<float> vel; // Vector for use as velocity
62 float radius; // Display radius
63 RGBA<float> color; // RGBA color
64 float density; // Component density or intensity
65 float fom; // Figure-of-merit
66 int sel; // Selection flag
67 } ;
68
69 /************************************************************************
70 @Object: struct Blink
71 @Description:
72 Model link parameter structure.
73 @Features:
74 Link between components.
75 Link rotation angle for orientation.
76 Length.
77 Radius.
78 Color.
79 Figure-of-merit.
80 Selection.
81 *************************************************************************/
82 struct Blink {
83 Blink* next; // Next link in list
84 Bcomponent* comp[2]; // Linked components
85 float angle; // Rotation angle around the link
86 float length; // Link reference length
87 float radius; // Display radius
88 RGBA<float> color; // RGBA color
89 float fom; // Figure-of-merit
90 int sel; // Selection flag
91 } ;
92
93 /************************************************************************
94 @Object: struct Bpolygon
95 @Description:
96 Model polygon parameter structure.
97 @Features:
98 List of components.
99 Polygon normal.
100 A flag to indicate if it is a closed polygon.
101 *************************************************************************/
102 struct Bpolygon {
103 Bpolygon* next;
104 int number; // Number of components
105 Bcomponent* comp[MAXLINK]; // List of components
106 Vector3<float> normal; // Vector normal to the polygon plane
107 int closed; // Flag to indicate a closed polygon
108 float fom; // Figure-of-merit
109 int sel; // Selection flag
110 } ;
111
112 /************************************************************************
113 @Object: struct Bmodel
114 @Description:
115 Model parameter structure.
116 @Features:
117 Orientation parameters for each model.
118 *************************************************************************/
119 struct Bmodel {
120 Bmodel* next; // Next model in list
121 Bstring id; // Model identifier
122 Bstring type_id; // Type identifier
123 int hand; // Hand or enantiomorph
124 Bstring symmetry; // Symmetry label
125 Bstring fmap; // Density map file name
126 Bstring comment; // Model comment string
127 int img_num; // Image number in map file
128 float fom; // Figure-of-merit
129 int sel; // Selection flag
130 int split; // Flag to split into individual output files
131 Bcomptype* type; // Component type list
132 Bcomponent* comp; // Component list
133 Blink* link; // Link list
134 Bpolygon* poly; // Polygon list
135 } ;
136
137 #define _Bmodel_
138 #endif
139
140 /* Function prototypes */
141 Bmodel* read_model(Bstring& filename);
142 Bmodel* read_model(Bstring* file_list);
143 Bmodel* read_model(Bstring& filename, Bstring& paramfile);
144 Bmodel* read_model(Bstring* file_list, Bstring& paramfile);
145 int write_model(Bstring& filename, Bmodel* model);
146 Bmodel* model_init(Bstring& id);
147 Bmodel* model_init(const char* cid);
148 Bmodel* model_add(Bmodel** model, Bstring& id);
149 Bmodel* model_add(Bmodel** model, const char* cid);
150 Bmodel* model_add(Bmodel** model, Bmodel* model_nu);
151 Bcomptype* component_type_add(Bcomptype** type, Bstring& id);
152 Bcomponent* component_add(Bcomponent** comp, Bstring& id);
153 Bcomponent* component_add(Bcomponent** comp, unsigned long number);
154 Blink* link_add(Blink** link, Bcomponent* comp1, Bcomponent* comp2, double length, double radius);
155 Blink* link_add(Blink** link, Bcomponent* comp1, Bcomponent* comp2);
156 int link_index(Bcomponent* comp, Bcomponent* comp2);
157 int model_set_map_filenames(Bmodel* model, Bstring& mapfile);
158 Bcomptype* model_add_type_by_id(Bmodel* model, Bstring& id);
159 Bcomptype* model_add_type_by_filename(Bmodel* model, Bstring& filename, int num);
160 Bcomptype* model_add_type_by_id_and_filename(Bmodel* model, Bstring& id, Bstring& filename, int num);
161 Bcomptype* model_get_type(Bmodel* model, Bstring& id);
162 int model_set_type(Bmodel* model, Bstring& set_type);
163 int model_change_type(Bmodel* model, Bstring& change_type);
164 int model_count_component_types(Bmodel* model);
165 int model_check(Bmodel* model, Bstring path);
166 int model_component_count(Bmodel* model);
167 Bmodel* model_list_copy(Bmodel* model);
168 Bmodel* model_copy(Bmodel* model);
169 int component_type_copy(Bcomptype* fromct, Bcomptype* toct);
170 int component_copy(Bcomponent* fromcomp, Bcomponent* tocomp);
171 long component_count(Bcomponent* comp);
172 Bcomponent* component_find(Bcomponent* comp, Bstring& id);
173 int link_copy(Blink* fromlink, Blink* tolink);
174 Blink* link_find(Blink* link, Bcomponent* comp1, Bcomponent* comp2);
175 int component_kill(Bcomponent* comp);
176 int component_list_kill(Bcomponent* comp);
177 int comp_type_kill(Bcomptype* type);
178 int comp_type_list_kill(Bcomptype* type);
179 int model_link_list_kill(Bmodel* model);
180 int link_kill(Blink** link_list, Bcomponent* comp, int i);
181 int link_kill(Blink** link_list, Bcomponent* comp, Bcomponent* comp2);
182 int poly_list_kill(Bpolygon* poly);
183 int comp_associated_links_kill(Bcomponent* comp, Blink** link);
184 int model_kill(Bmodel* model);
185 int model_update_comment(Bmodel* model, int n, char** strings);
186 int model_associate(Bmodel* model, Bstring& associate_type, Bstring& associate_file);
187 int model_associate_mass(Bmodel* model, Bstring& associate_type, double mass);
188 int model_set_comptype_filenames(Bmodel* model, Bstring& filename);
189 long model_set_component_radius(Bmodel* model, double comprad);
190 long model_set_density(Bmodel* model, double density);
191 long model_set_fom(Bmodel* model, double fom);
192
193
Bmodel::img_num
int img_num
Definition: rwmodel.h:127
MAXLINK
#define MAXLINK
Definition: rwmodel.h:14
Bcomponent::id
Bstring id
Definition: rwmodel.h:53
model_set_component_radius
long model_set_component_radius(Bmodel *model, double comprad)
Set the display radius for all components to a specific value.
Definition: rwmodel.cpp:1264
Bcomponent::type
Bcomptype * type
Definition: rwmodel.h:54
Blink
Definition: rwmodel.h:82
Bmodel::id
Bstring id
Definition: rwmodel.h:121
model_count_component_types
int model_count_component_types(Bmodel *model)
Counts the number of components for each type.
Definition: rwmodel.cpp:568
Bmodel::poly
Bpolygon * poly
Definition: rwmodel.h:134
model_change_type
int model_change_type(Bmodel *model, Bstring &change_type)
Change a component type name.
Definition: rwmodel.cpp:545
Blink::color
RGBA< float > color
Definition: rwmodel.h:88
Bcomptype::fmod
Bstring fmod
Definition: rwmodel.h:29
RGBA< float >
link_copy
int link_copy(Blink *fromlink, Blink *tolink)
Copies all elements from one link to another.
Definition: rwmodel.cpp:836
model_add_type_by_filename
Bcomptype * model_add_type_by_filename(Bmodel *model, Bstring &filename, int num)
Add a type to a model if the type with the given file name does not exist already.
Definition: rwmodel.cpp:434
Bcomponent::flag
int flag[MAXLINK]
Definition: rwmodel.h:57
Bpolygon::comp
Bcomponent * comp[MAXLINK]
Definition: rwmodel.h:105
Bmodel::split
int split
Definition: rwmodel.h:130
Bpolygon
Definition: rwmodel.h:102
model_component_count
int model_component_count(Bmodel *model)
Counts the total number of components.
Definition: rwmodel.cpp:635
Blink::sel
int sel
Definition: rwmodel.h:90
Bmodel::comment
Bstring comment
Definition: rwmodel.h:126
component_add
Bcomponent * component_add(Bcomponent **comp, Bstring &id)
Adds a component to a linked list.
Definition: rwmodel.cpp:267
link_add
Blink * link_add(Blink **link, Bcomponent *comp1, Bcomponent *comp2, double length, double radius)
Adds a component link to a linked list.
Definition: rwmodel.cpp:315
Bcomptype::mass
float mass
Definition: rwmodel.h:32
Bmodel::sel
int sel
Definition: rwmodel.h:129
Bpolygon::fom
float fom
Definition: rwmodel.h:108
Bcomponent::neighbor
Bcomponent * neighbor[MAXLINK]
Definition: rwmodel.h:56
Bcomponent::vel
Vector3< float > vel
Definition: rwmodel.h:61
Bcomptype::sel
int sel
Definition: rwmodel.h:34
component_list_kill
int component_list_kill(Bcomponent *comp)
Deallocates memory for a list of components.
Definition: rwmodel.cpp:891
link_find
Blink * link_find(Blink *link, Bcomponent *comp1, Bcomponent *comp2)
Finds a link in a link list.
Definition: rwmodel.cpp:857
Blink::comp
Bcomponent * comp[2]
Definition: rwmodel.h:84
model_list_copy
Bmodel * model_list_copy(Bmodel *model)
Copies a model.
Definition: rwmodel.cpp:657
model_copy
Bmodel * model_copy(Bmodel *model)
Copies a model.
Definition: rwmodel.cpp:685
model_get_type
Bcomptype * model_get_type(Bmodel *model, Bstring &id)
Return the type corresponding to an identifier.
Definition: rwmodel.cpp:491
Bmodel::hand
int hand
Definition: rwmodel.h:123
Bpolygon::number
int number
Definition: rwmodel.h:104
Bcomptype::index
int index
Definition: rwmodel.h:28
model_set_fom
long model_set_fom(Bmodel *model, double fom)
Set the FOM of selected components to a specific value.
Definition: rwmodel.cpp:1306
Blink::length
float length
Definition: rwmodel.h:86
model_kill
int model_kill(Bmodel *model)
Deallocates all memory in the list.
Definition: rwmodel.cpp:1124
model_init
Bmodel * model_init(Bstring &id)
Initializes a model structure.
Definition: rwmodel.cpp:144
model_set_density
long model_set_density(Bmodel *model, double density)
Set the density of selected components to a specific value.
Definition: rwmodel.cpp:1285
Bcomponent::view
View view
Definition: rwmodel.h:59
Blink::next
Blink * next
Definition: rwmodel.h:83
model_set_map_filenames
int model_set_map_filenames(Bmodel *model, Bstring &mapfile)
Sets all the map file names of selected models.
Definition: rwmodel.cpp:395
comp_type_list_kill
int comp_type_list_kill(Bcomptype *type)
Deallocates memory for a list of component types.
Definition: rwmodel.cpp:926
Bcomponent::fom
float fom
Definition: rwmodel.h:65
link_index
int link_index(Bcomponent *comp, Bcomponent *comp2)
Returns the index of a linked component.
Definition: rwmodel.cpp:378
Bmodel::type
Bcomptype * type
Definition: rwmodel.h:131
Bmodel::type_id
Bstring type_id
Definition: rwmodel.h:122
model_add_type_by_id_and_filename
Bcomptype * model_add_type_by_id_and_filename(Bmodel *model, Bstring &id, Bstring &filename, int num)
Add a type to a model if the type with the given id and file name does not exist already.
Definition: rwmodel.cpp:465
Blink::radius
float radius
Definition: rwmodel.h:87
model_update_comment
int model_update_comment(Bmodel *model, int n, char **strings)
Puts a set of strings and time in the comment of a model.
Definition: rwmodel.cpp:1158
length
double length(vector< T > v)
Definition: Vector3.h:528
Blink::angle
float angle
Definition: rwmodel.h:85
Bcomponent::density
float density
Definition: rwmodel.h:64
Bpolygon::next
Bpolygon * next
Definition: rwmodel.h:103
Bmodel::symmetry
Bstring symmetry
Definition: rwmodel.h:124
Bmodel::next
Bmodel * next
Definition: rwmodel.h:120
Bcomponent::sel
int sel
Definition: rwmodel.h:66
model_add_type_by_id
Bcomptype * model_add_type_by_id(Bmodel *model, Bstring &id)
Add a type to a model if the identifier does not exist already.
Definition: rwmodel.cpp:411
Bcomponent::radius
float radius
Definition: rwmodel.h:62
model
Bmodel * model
Definition: bshow.cpp:32
read_model
Bmodel * read_model(Bstring &filename)
Definition: rwmodel.cpp:28
write_model
int write_model(Bstring &filename, Bmodel *model)
Writes model parameters.
Definition: rwmodel.cpp:91
component_kill
int component_kill(Bcomponent *comp)
Deallocates memory for one component.
Definition: rwmodel.cpp:877
Bmodel::fom
float fom
Definition: rwmodel.h:128
Bstring
Definition: Bstring.h:29
Bcomponent::link
Bcomponent * link[MAXLINK]
Definition: rwmodel.h:55
Bmodel::link
Blink * link
Definition: rwmodel.h:133
poly_list_kill
int poly_list_kill(Bpolygon *poly)
Deallocates memory for a list of polygons.
Definition: rwmodel.cpp:1070
Bmodel::fmap
Bstring fmap
Definition: rwmodel.h:125
comp_associated_links_kill
int comp_associated_links_kill(Bcomponent *comp, Blink **link)
Deallocates memory for links associated with a component.
Definition: rwmodel.cpp:1092
Bcomptype::num
int num
Definition: rwmodel.h:30
model_add
Bmodel * model_add(Bmodel **model, Bstring &id)
Adds a model to a linked list.
Definition: rwmodel.cpp:178
Bcomponent::vec
Vector3< float > vec
Definition: rwmodel.h:60
Bcomponent::next
Bcomponent * next
Definition: rwmodel.h:52
Bpolygon::normal
Vector3< float > normal
Definition: rwmodel.h:106
Bcomptype::id
Bstring id
Definition: rwmodel.h:27
Vector3< float >
Bstring.h
Header file for the string class.
View
Definition: View.h:26
component_find
Bcomponent * component_find(Bcomponent *comp, Bstring &id)
Finds a component in a component list.
Definition: rwmodel.cpp:822
component_type_add
Bcomptype * component_type_add(Bcomptype **type, Bstring &id)
Adds a component type to a linked list.
Definition: rwmodel.cpp:230
component_type_copy
int component_type_copy(Bcomptype *fromct, Bcomptype *toct)
Copies all elements from one component to another.
Definition: rwmodel.cpp:763
component_copy
int component_copy(Bcomponent *fromcomp, Bcomponent *tocomp)
Copies all elements from one component to another.
Definition: rwmodel.cpp:783
model_set_comptype_filenames
int model_set_comptype_filenames(Bmodel *model, Bstring &filename)
Sets the filenames of all selected component types to the given string.
Definition: rwmodel.cpp:1239
Color.h
Classes for color objects.
Bmodel
Definition: rwmodel.h:119
model_link_list_kill
int model_link_list_kill(Bmodel *model)
Deallocates memory for a list of component links.
Definition: rwmodel.cpp:950
model_associate
int model_associate(Bmodel *model, Bstring &associate_type, Bstring &associate_file)
Associates a model file with a component type.
Definition: rwmodel.cpp:1177
Bcomptype
Definition: rwmodel.h:25
component_count
long component_count(Bcomponent *comp)
Counts the total number of components.
Definition: rwmodel.cpp:805
model_set_type
int model_set_type(Bmodel *model, Bstring &set_type)
Reset the component types.
Definition: rwmodel.cpp:516
Bmodel::comp
Bcomponent * comp
Definition: rwmodel.h:132
View.h
View object.
Bcomponent::loc
Vector3< float > loc
Definition: rwmodel.h:58
Bcomptype::fom
float fom
Definition: rwmodel.h:33
Blink::fom
float fom
Definition: rwmodel.h:89
Bcomptype::count
int count
Definition: rwmodel.h:31
comp_type_kill
int comp_type_kill(Bcomptype *type)
Deallocates memory for one component type.
Definition: rwmodel.cpp:912
Bcomponent::color
RGBA< float > color
Definition: rwmodel.h:63
link_kill
int link_kill(Blink **link_list, Bcomponent *comp, int i)
Deletes a link.
Definition: rwmodel.cpp:988
Bpolygon::sel
int sel
Definition: rwmodel.h:109
Bcomptype::next
Bcomptype * next
Definition: rwmodel.h:26
model_check
int model_check(Bmodel *model, Bstring path)
Checks model properties.
Definition: rwmodel.cpp:592
model_associate_mass
int model_associate_mass(Bmodel *model, Bstring &associate_type, double mass)
Associates a mass with a component type.
Definition: rwmodel.cpp:1207
Bpolygon::closed
int closed
Definition: rwmodel.h:107
Bcomponent
Definition: rwmodel.h:51