| 14 |
|
n_bends = 0; |
| 15 |
|
n_torsions = 0; |
| 16 |
|
n_rigidbodies = 0; |
| 17 |
+ |
n_cutoffgroups = 0; |
| 18 |
|
n_integrable = 0; |
| 19 |
|
|
| 20 |
|
unhandled = NULL; |
| 23 |
|
bends = NULL; |
| 24 |
|
torsions = NULL; |
| 25 |
|
rigidBodies = NULL; |
| 26 |
+ |
cutoffGroups = NULL; |
| 27 |
|
|
| 28 |
|
have_name = 0; |
| 29 |
|
have_atoms = 0; |
| 31 |
|
have_bends = 0; |
| 32 |
|
have_torsions = 0; |
| 33 |
|
have_rigidbodies = 0; |
| 34 |
+ |
have_cutoffgroups = 0; |
| 35 |
|
|
| 36 |
|
} |
| 37 |
|
|
| 43 |
|
if( rigidBodies != NULL ) { |
| 44 |
|
for( i=0; i<n_rigidbodies; i++ ) delete rigidBodies[i]; |
| 45 |
|
} |
| 46 |
+ |
|
| 47 |
+ |
if( cutoffGroups != NULL ) { |
| 48 |
+ |
for( i=0; i<n_cutoffgroups; i++ ) delete cutoffGroups[i]; |
| 49 |
+ |
} |
| 50 |
|
|
| 51 |
|
if( atoms != NULL ){ |
| 52 |
|
for( i=0; i<n_atoms; i++ ) delete atoms[i]; |
| 158 |
|
for( i=0; i<n_rigidbodies; i++ ) rigidBodies[i] = NULL; |
| 159 |
|
} |
| 160 |
|
|
| 161 |
+ |
else if( !strcmp( lhs, "nCutoffGroups" ) ){ |
| 162 |
+ |
n_cutoffgroups = (int)rhs; |
| 163 |
+ |
|
| 164 |
+ |
if( have_cutoffgroups ){ |
| 165 |
+ |
sprintf( errMsg, |
| 166 |
+ |
"MoleculeStamp error, n_cutoffgroups already declared for" |
| 167 |
+ |
" molecule: %s\n", |
| 168 |
+ |
name ); |
| 169 |
+ |
return strdup( errMsg ); |
| 170 |
+ |
} |
| 171 |
+ |
have_cutoffgroups = 1; |
| 172 |
+ |
cutoffGroups = new CutoffGroupStamp*[n_cutoffgroups]; |
| 173 |
+ |
for( i=0; i<n_cutoffgroups; i++ ) cutoffGroups[i] = NULL; |
| 174 |
+ |
} |
| 175 |
+ |
|
| 176 |
|
else{ |
| 177 |
|
if( unhandled == NULL ) unhandled = new LinkedAssign( lhs, rhs ); |
| 178 |
|
else unhandled->add( lhs, rhs ); |
| 249 |
|
|
| 250 |
|
if( have_rigidbodies ){ |
| 251 |
|
sprintf( errMsg, |
| 252 |
< |
"RigidBodyStamp error, n_rigidbodies already declared for" |
| 252 |
> |
"MoleculeStamp error, n_rigidbodies already declared for" |
| 253 |
|
" molecule: %s\n", |
| 254 |
|
name); |
| 255 |
|
return strdup( errMsg ); |
| 258 |
|
rigidBodies = new RigidBodyStamp*[n_rigidbodies]; |
| 259 |
|
for( i=0; i<n_rigidbodies; i++ ) rigidBodies[i] = NULL; |
| 260 |
|
} |
| 261 |
+ |
else if( !strcmp( lhs, "nCutoffGroups" ) ){ |
| 262 |
+ |
n_cutoffgroups = rhs; |
| 263 |
+ |
|
| 264 |
+ |
if( have_cutoffgroups ){ |
| 265 |
+ |
sprintf( errMsg, |
| 266 |
+ |
"MoleculeStamp error, n_cutoffgroups already declared for" |
| 267 |
+ |
" molecule: %s\n", |
| 268 |
+ |
name); |
| 269 |
+ |
return strdup( errMsg ); |
| 270 |
+ |
} |
| 271 |
+ |
have_cutoffgroups = 1; |
| 272 |
+ |
cutoffGroups = new CutoffGroupStamp*[n_cutoffgroups]; |
| 273 |
+ |
for( i=0; i<n_cutoffgroups; i++ ) cutoffGroups[i] = NULL; |
| 274 |
+ |
} |
| 275 |
|
else{ |
| 276 |
|
if( unhandled == NULL ) unhandled = new LinkedAssign( lhs, rhs ); |
| 277 |
|
else unhandled->add( lhs, rhs ); |
| 314 |
|
return NULL; |
| 315 |
|
} |
| 316 |
|
|
| 317 |
+ |
char* MoleculeStamp::addCutoffGroup( CutoffGroupStamp* the_cutoffgroup, |
| 318 |
+ |
int cutoffGroupIndex ){ |
| 319 |
+ |
|
| 320 |
+ |
if( have_cutoffgroups && cutoffGroupIndex < n_cutoffgroups ) |
| 321 |
+ |
cutoffGroups[cutoffGroupIndex] = the_cutoffgroup; |
| 322 |
+ |
else { |
| 323 |
+ |
if( have_cutoffgroups ){ |
| 324 |
+ |
sprintf( errMsg, "MoleculeStamp error, %d out of nCutoffGroups range", |
| 325 |
+ |
cutoffGroupIndex ); |
| 326 |
+ |
return strdup( errMsg ); |
| 327 |
+ |
} |
| 328 |
+ |
else return strdup("MoleculeStamp error, nCutoffGroups not given before" |
| 329 |
+ |
" first CutoffGroup declaration." ); |
| 330 |
+ |
} |
| 331 |
+ |
|
| 332 |
+ |
return NULL; |
| 333 |
+ |
} |
| 334 |
+ |
|
| 335 |
|
char* MoleculeStamp::addBond( BondStamp* the_bond, int bondIndex ){ |
| 336 |
|
|
| 337 |
|
|
| 387 |
|
char* MoleculeStamp::checkMe( void ){ |
| 388 |
|
|
| 389 |
|
int i; |
| 390 |
< |
short int no_atom, no_rigidbody; |
| 390 |
> |
short int no_atom, no_rigidbody, no_cutoffgroup; |
| 391 |
|
|
| 392 |
|
if( !have_name ) return strdup( "MoleculeStamp error. Molecule's name" |
| 393 |
|
" was not given.\n" ); |
| 408 |
|
return strdup( errMsg ); |
| 409 |
|
} |
| 410 |
|
|
| 411 |
+ |
no_cutoffgroup = 0; |
| 412 |
+ |
for( i=0; i<n_cutoffgroups; i++ ){ |
| 413 |
+ |
if( cutoffGroups[i] == NULL ) no_cutoffgroup = 1; |
| 414 |
+ |
} |
| 415 |
+ |
|
| 416 |
+ |
if( no_cutoffgroup ){ |
| 417 |
+ |
sprintf( errMsg, |
| 418 |
+ |
"MoleculeStamp error. Not all of the CutoffGroups were" |
| 419 |
+ |
" declared in molecule \"%s\".\n", name ); |
| 420 |
+ |
return strdup( errMsg ); |
| 421 |
+ |
} |
| 422 |
+ |
|
| 423 |
|
no_atom = 0; |
| 424 |
|
for( i=0; i<n_atoms; i++ ){ |
| 425 |
|
if( atoms[i] == NULL ) no_atom = 1; |
| 432 |
|
return strdup( errMsg ); |
| 433 |
|
} |
| 434 |
|
|
| 369 |
– |
|
| 435 |
|
n_integrable = n_atoms; |
| 436 |
|
for (i = 0; i < n_rigidbodies; i++) |
| 437 |
|
n_integrable = n_integrable - rigidBodies[i]->getNMembers() + 1; //rigidbody is an integrable object |