--- trunk/OOPSE/libBASS/MoleculeStamp.cpp 2003/10/28 16:03:06 828 +++ trunk/OOPSE/libBASS/MoleculeStamp.cpp 2004/01/27 19:37:48 988 @@ -13,18 +13,21 @@ MoleculeStamp::MoleculeStamp(){ n_bonds = 0; n_bends = 0; n_torsions = 0; + n_rigidbodies = 0; unhandled = NULL; atoms = NULL; bonds = NULL; bends = NULL; torsions = NULL; + rigidBodies = NULL; have_name = 0; have_atoms = 0; have_bonds = 0; have_bends = 0; have_torsions = 0; + have_rigidbodies = 0; } @@ -32,7 +35,11 @@ MoleculeStamp::~MoleculeStamp(){ int i; if( unhandled != NULL) delete unhandled; - + + if( rigidBodies != NULL ) { + for( i=0; iadd( lhs, rhs ); @@ -197,6 +220,21 @@ char* MoleculeStamp::assignInt( char* lhs, int rhs ){ torsions = new TorsionStamp*[n_torsions]; for( i=0; iadd( lhs, rhs ); @@ -215,12 +253,30 @@ char* MoleculeStamp::addAtom( AtomStamp* the_atom, int return strdup( errMsg ); } else return strdup("MoleculeStamp error, nAtoms not given before" - "first atom declaration." ); + " first atom declaration." ); } return NULL; } +char* MoleculeStamp::addRigidBody( RigidBodyStamp* the_rigidbody, + int rigidBodyIndex ){ + + if( have_rigidbodies && rigidBodyIndex < n_rigidbodies ) + rigidBodies[rigidBodyIndex] = the_rigidbody; + else{ + if( have_rigidbodies ){ + sprintf( errMsg, "MoleculeStamp error, %d out of nRigidBodies range", + rigidBodyIndex ); + return strdup( errMsg ); + } + else return strdup("MoleculeStamp error, nRigidBodies not given before" + " first rigidBody declaration." ); + } + + return NULL; +} + char* MoleculeStamp::addBond( BondStamp* the_bond, int bondIndex ){ @@ -276,14 +332,27 @@ char* MoleculeStamp::checkMe( void ){ char* MoleculeStamp::checkMe( void ){ int i; - short int no_atom; + short int no_atom, no_rigidbody; + + if( !have_name ) return strdup( "MoleculeStamp error. Molecule's name" + " was not given.\n" ); - if( !have_name || !have_atoms ){ - if( !have_name ) return strdup( "MoleculeStamp error. Molecule's name" - " was not given.\n" ); - else return strdup( "MoleculeStamp error. Molecule contains no atoms." ); + if( !have_atoms ){ + return strdup( "MoleculeStamp error. Molecule contains no atoms." ); } + no_rigidbody = 0; + for( i=0; i