| 1 |
|
|
| 2 |
< |
#include <cstring> |
| 3 |
< |
#include <cstdio> |
| 4 |
< |
#include <cstdlib> |
| 2 |
> |
#include <string.h> |
| 3 |
> |
#include <stdio.h> |
| 4 |
> |
#include <stdlib.h> |
| 5 |
|
|
| 6 |
|
#include "Globals.hpp" |
| 7 |
|
#include "BASS_interface.h" |
| 15 |
|
// Globals ************************************************ |
| 16 |
|
|
| 17 |
|
typedef enum { GLOBAL_BLK, MOLECULE_BLK, ATOM_BLK, BOND_BLK, BEND_BLK, |
| 18 |
< |
TORSION_BLK, COMPONENT_BLK, ZCONSTRAINT_BLK } block_type; |
| 18 |
> |
TORSION_BLK, COMPONENT_BLK, ZCONSTRAINT_BLK, |
| 19 |
> |
RIGIDBODY_BLK, CUTOFFGROUP_BLK } block_type; |
| 20 |
|
|
| 21 |
|
block_type current_block = GLOBAL_BLK; |
| 22 |
|
#define MAX_NEST 20 // the max number of nested blocks |
| 42 |
|
|
| 43 |
|
int handled = 0; |
| 44 |
|
|
| 44 |
– |
if( the_event->event_type == ASSIGNMENT){ |
| 45 |
– |
fprintf( stderr, |
| 46 |
– |
"global assign %s\n", |
| 47 |
– |
the_event->evt.asmt.lhs ); |
| 48 |
– |
} |
| 49 |
– |
|
| 50 |
– |
|
| 51 |
– |
the_globals->printIC(); |
| 52 |
– |
|
| 45 |
|
switch( current_block ){ |
| 46 |
|
|
| 47 |
|
case GLOBAL_BLK: |
| 101 |
|
handled = the_stamps->newTorsion( the_event ); |
| 102 |
|
break; |
| 103 |
|
|
| 104 |
+ |
case RIGIDBODY: |
| 105 |
+ |
incr_block( RIGIDBODY_BLK ); |
| 106 |
+ |
handled = the_stamps->newRigidBody( the_event ); |
| 107 |
+ |
break; |
| 108 |
+ |
|
| 109 |
+ |
case CUTOFFGROUP: |
| 110 |
+ |
incr_block( CUTOFFGROUP_BLK ); |
| 111 |
+ |
handled = the_stamps->newCutoffGroup( the_event ); |
| 112 |
+ |
break; |
| 113 |
+ |
|
| 114 |
|
case ASSIGNMENT: |
| 115 |
|
handled = the_stamps->moleculeAssign( the_event ); |
| 116 |
|
break; |
| 123 |
|
default: |
| 124 |
|
the_event->err_msg = |
| 125 |
|
strdup( "Not a valid molecule event\n" ); |
| 126 |
+ |
return 0; |
| 127 |
+ |
} |
| 128 |
+ |
break; |
| 129 |
+ |
|
| 130 |
+ |
|
| 131 |
+ |
case RIGIDBODY_BLK: |
| 132 |
+ |
|
| 133 |
+ |
switch( the_event->event_type ){ |
| 134 |
+ |
|
| 135 |
+ |
case ASSIGNMENT: |
| 136 |
+ |
handled = the_stamps->rigidBodyAssign( the_event ); |
| 137 |
+ |
break; |
| 138 |
+ |
|
| 139 |
+ |
case MEMBERS: |
| 140 |
+ |
handled = the_stamps->rigidBodyMembers( the_event ); |
| 141 |
+ |
break; |
| 142 |
+ |
|
| 143 |
+ |
case BLOCK_END: |
| 144 |
+ |
decr_block(); |
| 145 |
+ |
handled = the_stamps->rigidBodyEnd( the_event ); |
| 146 |
+ |
break; |
| 147 |
+ |
|
| 148 |
+ |
default: |
| 149 |
+ |
the_event->err_msg = |
| 150 |
+ |
strdup( "Not a valid RigidBody event\n" ); |
| 151 |
|
return 0; |
| 152 |
|
} |
| 153 |
|
break; |
| 154 |
|
|
| 155 |
+ |
case CUTOFFGROUP_BLK: |
| 156 |
+ |
|
| 157 |
+ |
switch( the_event->event_type ){ |
| 158 |
+ |
|
| 159 |
+ |
case ASSIGNMENT: |
| 160 |
+ |
handled = the_stamps->cutoffGroupAssign( the_event ); |
| 161 |
+ |
break; |
| 162 |
+ |
|
| 163 |
+ |
case MEMBERS: |
| 164 |
+ |
handled = the_stamps->cutoffGroupMembers( the_event ); |
| 165 |
+ |
break; |
| 166 |
+ |
|
| 167 |
+ |
case BLOCK_END: |
| 168 |
+ |
decr_block(); |
| 169 |
+ |
handled = the_stamps->cutoffGroupEnd( the_event ); |
| 170 |
+ |
break; |
| 171 |
+ |
|
| 172 |
+ |
default: |
| 173 |
+ |
the_event->err_msg = |
| 174 |
+ |
strdup( "Not a valid CutoffGroup event\n" ); |
| 175 |
+ |
return 0; |
| 176 |
+ |
} |
| 177 |
+ |
break; |
| 178 |
+ |
|
| 179 |
+ |
|
| 180 |
|
case ATOM_BLK: |
| 181 |
|
|
| 182 |
|
switch( the_event->event_type ){ |
| 213 |
|
handled = the_stamps->bondAssign( the_event ); |
| 214 |
|
break; |
| 215 |
|
|
| 216 |
< |
case MEMBER: |
| 217 |
< |
handled = the_stamps->bondMember( the_event ); |
| 216 |
> |
case MEMBERS: |
| 217 |
> |
handled = the_stamps->bondMembers( the_event ); |
| 218 |
|
break; |
| 219 |
|
|
| 220 |
|
case CONSTRAINT: |
| 241 |
|
handled = the_stamps->bendAssign( the_event ); |
| 242 |
|
break; |
| 243 |
|
|
| 244 |
< |
case MEMBER: |
| 245 |
< |
handled = the_stamps->bendMember( the_event ); |
| 244 |
> |
case MEMBERS: |
| 245 |
> |
handled = the_stamps->bendMembers( the_event ); |
| 246 |
|
break; |
| 247 |
|
|
| 248 |
|
case CONSTRAINT: |
| 269 |
|
handled = the_stamps->torsionAssign( the_event ); |
| 270 |
|
break; |
| 271 |
|
|
| 272 |
< |
case MEMBER: |
| 273 |
< |
handled = the_stamps->torsionMember( the_event ); |
| 272 |
> |
case MEMBERS: |
| 273 |
> |
handled = the_stamps->torsionMembers( the_event ); |
| 274 |
|
break; |
| 275 |
|
|
| 276 |
|
case CONSTRAINT: |