1 |
|
#include <stdio.h> |
2 |
|
#include <stdlib.h> |
3 |
+ |
#include <string.h> |
4 |
|
|
5 |
|
#include "interface.h" |
6 |
|
#include "../headers/BASS_interface.h" |
7 |
+ |
#include "../headers/simError.h" |
8 |
+ |
#ifdef IS_MPI |
9 |
+ |
#include "../headers/mpiBASS.h" |
10 |
+ |
#endif |
11 |
|
|
12 |
|
void interface_error( event* the_event ); |
13 |
|
|
21 |
|
the_event->evt.blk_index = comp_index; |
22 |
|
|
23 |
|
if( !event_handler( the_event ) ) interface_error( the_event ); |
24 |
< |
|
24 |
> |
#ifdef IS_MPI |
25 |
> |
throwMPIEvent(the_event); |
26 |
> |
#endif |
27 |
> |
|
28 |
|
free( the_event ); |
29 |
|
} |
30 |
|
|
38 |
|
the_event->evt.blk_index = mol_index; |
39 |
|
|
40 |
|
if( !event_handler( the_event ) ) interface_error( the_event ); |
41 |
+ |
#ifdef IS_MPI |
42 |
+ |
throwMPIEvent(the_event); |
43 |
+ |
#endif |
44 |
|
|
45 |
|
free( the_event ); |
46 |
|
} |
55 |
|
the_event->evt.blk_index = atom_index; |
56 |
|
|
57 |
|
if( !event_handler( the_event ) ) interface_error( the_event ); |
58 |
+ |
#ifdef IS_MPI |
59 |
+ |
throwMPIEvent(the_event); |
60 |
+ |
#endif |
61 |
|
|
62 |
|
free( the_event ); |
63 |
|
} |
72 |
|
the_event->evt.blk_index = bond_index; |
73 |
|
|
74 |
|
if( !event_handler( the_event ) ) interface_error( the_event ); |
75 |
+ |
#ifdef IS_MPI |
76 |
+ |
throwMPIEvent(the_event); |
77 |
+ |
#endif |
78 |
|
|
79 |
|
free( the_event ); |
80 |
|
} |
89 |
|
the_event->evt.blk_index = bend_index; |
90 |
|
|
91 |
|
if( !event_handler( the_event ) ) interface_error( the_event ); |
92 |
+ |
#ifdef IS_MPI |
93 |
+ |
throwMPIEvent(the_event); |
94 |
+ |
#endif |
95 |
|
|
96 |
|
free( the_event ); |
97 |
|
} |
106 |
|
the_event->evt.blk_index = torsion_index; |
107 |
|
|
108 |
|
if( !event_handler( the_event ) ) interface_error( the_event ); |
109 |
+ |
#ifdef IS_MPI |
110 |
+ |
throwMPIEvent(the_event); |
111 |
+ |
#endif |
112 |
|
|
113 |
|
free( the_event ); |
114 |
|
} |
132 |
|
the_event->evt.mbr.d = the_node->the_data.mbr.d; |
133 |
|
|
134 |
|
if( !event_handler( the_event ) ) interface_error( the_event ); |
135 |
+ |
#ifdef IS_MPI |
136 |
+ |
throwMPIEvent(the_event); |
137 |
+ |
#endif |
138 |
|
|
139 |
|
free( the_event ); |
140 |
|
} |
150 |
|
the_event->evt.cnstr = the_node->the_data.cnstr.constraint_val; |
151 |
|
|
152 |
|
if( !event_handler( the_event ) ) interface_error( the_event ); |
153 |
+ |
#ifdef IS_MPI |
154 |
+ |
throwMPIEvent(the_event); |
155 |
+ |
#endif |
156 |
|
|
157 |
|
free( the_event ); |
158 |
|
} |
187 |
|
} |
188 |
|
|
189 |
|
if( !event_handler( the_event ) ) interface_error( the_event ); |
190 |
+ |
#ifdef IS_MPI |
191 |
+ |
throwMPIEvent(the_event); |
192 |
+ |
#endif |
193 |
|
|
194 |
|
free( the_event ); |
195 |
|
} |
207 |
|
the_event->evt.pos.z = the_node->the_data.pos.z; |
208 |
|
|
209 |
|
if( !event_handler( the_event ) ) interface_error( the_event ); |
210 |
+ |
#ifdef IS_MPI |
211 |
+ |
throwMPIEvent(the_event); |
212 |
+ |
#endif |
213 |
|
|
214 |
|
free( the_event ); |
215 |
|
} |
227 |
|
the_event->evt.ornt.z = the_node->the_data.ort.z; |
228 |
|
|
229 |
|
if( !event_handler( the_event ) ) interface_error( the_event ); |
230 |
+ |
#ifdef IS_MPI |
231 |
+ |
throwMPIEvent(the_event); |
232 |
+ |
#endif |
233 |
|
|
234 |
|
free( the_event ); |
235 |
|
} |
236 |
|
|
199 |
– |
void init_start_index( struct node_tag* the_node, |
200 |
– |
struct namespc the_namespc ){ |
201 |
– |
event* the_event; |
202 |
– |
int* si_array; |
203 |
– |
int n_elements = 0; |
204 |
– |
int index = 0; |
237 |
|
|
206 |
– |
struct integer_list_tag* head; |
207 |
– |
struct integer_list_tag* current; |
208 |
– |
|
209 |
– |
the_event = (event* )malloc( sizeof( event ) ); |
210 |
– |
|
211 |
– |
the_event->event_type = ORIENTATION; |
212 |
– |
the_event->err_msg = NULL; |
213 |
– |
|
214 |
– |
head = the_node->the_data.il_head; |
215 |
– |
n_elements++; |
216 |
– |
|
217 |
– |
current = head->next; |
218 |
– |
while( current != NULL ){ |
219 |
– |
n_elements++; |
220 |
– |
current = current->next; |
221 |
– |
} |
222 |
– |
|
223 |
– |
the_event->evt.si.n_elements = n_elements; |
224 |
– |
si_array = ( int* ) calloc( n_elements, sizeof( int ) ); |
225 |
– |
|
226 |
– |
si_array[index] = head->the_int; |
227 |
– |
|
228 |
– |
current = head->next; |
229 |
– |
while( current != NULL ){ |
230 |
– |
index++; |
231 |
– |
si_array[index] = current->the_int; |
232 |
– |
current = current->next; |
233 |
– |
} |
234 |
– |
the_event->evt.si.array = si_array; |
235 |
– |
|
236 |
– |
if( !event_handler( the_event ) ) interface_error( the_event ); |
237 |
– |
|
238 |
– |
free( the_event ); |
239 |
– |
} |
240 |
– |
|
238 |
|
void end_of_block( void ){ |
239 |
|
event* the_event; |
240 |
|
|
244 |
|
the_event->err_msg = NULL; |
245 |
|
|
246 |
|
if( !event_handler( the_event ) ) interface_error( the_event ); |
247 |
+ |
#ifdef IS_MPI |
248 |
+ |
throwMPIEvent(the_event); |
249 |
+ |
#endif |
250 |
|
|
251 |
|
free( the_event ); |
252 |
|
} |
253 |
|
|
254 |
|
void interface_error( event* the_event ){ |
255 |
|
|
256 |
< |
fprintf( stderr, |
256 |
> |
sprintf( painCave.errMsg, |
257 |
|
"**Interface event error**\n" |
258 |
|
"%s\n", |
259 |
|
the_event->err_msg ); |
260 |
< |
exit(1); |
260 |
> |
painCave.isFatal = 1; |
261 |
> |
simError(); |
262 |
|
} |