--- branches/mmeineke/OOPSE/libBASS/interface.c 2003/03/21 17:42:12 377 +++ trunk/OOPSE/libBASS/interface.c 2004/05/11 04:21:52 1153 @@ -2,11 +2,11 @@ #include #include -#include -#include -#include +#include "parse_interface.h" +#include "BASS_interface.h" +#include "simError.h" #ifdef IS_MPI -#include +#include "mpiBASS.h" #endif void interface_error( event* the_event ); @@ -45,6 +45,40 @@ void init_atom( int atom_index ){ free( the_event ); } +void init_rigidbody( int rigidbody_index ){ + event* the_event; + + the_event = (event* )malloc( sizeof( event ) ); + + the_event->event_type = RIGIDBODY; + the_event->err_msg = NULL; + the_event->evt.blk_index = rigidbody_index; + + if( !event_handler( the_event ) ) interface_error( the_event ); +#ifdef IS_MPI + throwMPIEvent(the_event); +#endif + + free( the_event ); +} + +void init_cutoffgroup( int cutoffgroup_index ){ + event* the_event; + + the_event = (event* )malloc( sizeof( event ) ); + + the_event->event_type = CUTOFFGROUP; + the_event->err_msg = NULL; + the_event->evt.blk_index = cutoffgroup_index; + + if( !event_handler( the_event ) ) interface_error( the_event ); +#ifdef IS_MPI + throwMPIEvent(the_event); +#endif + + free( the_event ); +} + void init_atom( int atom_index ){ event* the_event; @@ -104,7 +138,24 @@ void init_torsion( int torsion_index ){ the_event->event_type = TORSION; the_event->err_msg = NULL; the_event->evt.blk_index = torsion_index; + + if( !event_handler( the_event ) ) interface_error( the_event ); +#ifdef IS_MPI + throwMPIEvent(the_event); +#endif + + free( the_event ); +} +void init_zconstraint( int zconstraint_index ){ + event* the_event; + + the_event = (event* )malloc( sizeof( event ) ); + + the_event->event_type = ZCONSTRAINT; + the_event->err_msg = NULL; + the_event->evt.blk_index = zconstraint_index; + if( !event_handler( the_event ) ) interface_error( the_event ); #ifdef IS_MPI throwMPIEvent(the_event); @@ -121,21 +172,28 @@ void init_members( struct node_tag* the_node, void init_members( struct node_tag* the_node, struct namespc the_namespc ){ event* the_event; + int i; the_event = (event* )malloc( sizeof( event ) ); - the_event->event_type = MEMBER; + the_event->event_type = MEMBERS; the_event->err_msg = NULL; - the_event->evt.mbr.a = the_node->the_data.mbr.a; - the_event->evt.mbr.b = the_node->the_data.mbr.b; - the_event->evt.mbr.c = the_node->the_data.mbr.c; - the_event->evt.mbr.d = the_node->the_data.mbr.d; + the_event->evt.mbrs.nMembers = the_node->the_data.mbrs.nMembers; + + the_event->evt.mbrs.memberList = (int *) calloc(the_node->the_data.mbrs.nMembers, + sizeof(int)); + + for (i = 0; i < the_node->the_data.mbrs.nMembers; i++) { + the_event->evt.mbrs.memberList[i] = the_node->the_data.mbrs.memberList[i]; + } + if( !event_handler( the_event ) ) interface_error( the_event ); #ifdef IS_MPI throwMPIEvent(the_event); #endif + free( the_event->evt.mbrs.memberList ); free( the_event ); } @@ -222,9 +280,9 @@ void init_orientation( struct node_tag* the_node, the_event->event_type = ORIENTATION; the_event->err_msg = NULL; - the_event->evt.ornt.x = the_node->the_data.ort.x; - the_event->evt.ornt.y = the_node->the_data.ort.y; - the_event->evt.ornt.z = the_node->the_data.ort.z; + the_event->evt.ornt.phi = the_node->the_data.ort.phi; + the_event->evt.ornt.theta = the_node->the_data.ort.theta; + the_event->evt.ornt.psi = the_node->the_data.ort.psi; if( !event_handler( the_event ) ) interface_error( the_event ); #ifdef IS_MPI