| 109 |
|
molIndex = stamp[i]->getMolIndex(); |
| 110 |
|
} |
| 111 |
|
|
| 112 |
< |
Molecule* mol = info_->getMoleculeByGlobalIndex(molIndex); |
| 113 |
< |
|
| 114 |
< |
if (mol == NULL) { |
| 112 |
> |
if (molIndex < 0) { |
| 113 |
|
sprintf(painCave.errMsg, |
| 114 |
< |
"Restraint Error: A molecular restraint was specified, but\n" |
| 115 |
< |
"\tno molecule was found with global index %d.\n", |
| 118 |
< |
molIndex); |
| 114 |
> |
"Restraint Error: A molecular restraint was specified\n" |
| 115 |
> |
"\twith a molIndex that was less than 0\n"); |
| 116 |
|
painCave.isFatal = 1; |
| 117 |
|
simError(); |
| 118 |
|
} |
| 119 |
+ |
if (molIndex >= info_->getNGlobalMolecules()) { |
| 120 |
+ |
sprintf(painCave.errMsg, |
| 121 |
+ |
"Restraint Error: A molecular restraint was specified with\n" |
| 122 |
+ |
"\ta molIndex that was greater than the total number of molecules\n"); |
| 123 |
+ |
painCave.isFatal = 1; |
| 124 |
+ |
simError(); |
| 125 |
+ |
} |
| 126 |
+ |
|
| 127 |
+ |
Molecule* mol = info_->getMoleculeByGlobalIndex(molIndex); |
| 128 |
|
|
| 129 |
+ |
if (mol == NULL) { |
| 130 |
+ |
#ifdef IS_MPI |
| 131 |
+ |
// getMoleculeByGlobalIndex returns a NULL in parallel if |
| 132 |
+ |
// this proc doesn't have the molecule. Do a quick check to |
| 133 |
+ |
// make sure another processor is supposed to have it. |
| 134 |
+ |
|
| 135 |
+ |
int myrank = MPI::COMM_WORLD.Get_rank(); |
| 136 |
+ |
if (info_->getMolToProc(molIndex) == myrank) { |
| 137 |
+ |
// If we were supposed to have it but got a null, then freak out. |
| 138 |
+ |
#endif |
| 139 |
+ |
|
| 140 |
+ |
sprintf(painCave.errMsg, |
| 141 |
+ |
"Restraint Error: A molecular restraint was specified, but\n" |
| 142 |
+ |
"\tno molecule was found with global index %d.\n", |
| 143 |
+ |
molIndex); |
| 144 |
+ |
painCave.isFatal = 1; |
| 145 |
+ |
simError(); |
| 146 |
+ |
|
| 147 |
+ |
#ifdef IS_MPI |
| 148 |
+ |
} |
| 149 |
+ |
#endif |
| 150 |
+ |
} |
| 151 |
+ |
|
| 152 |
|
MolecularRestraint* rest = new MolecularRestraint(); |
| 153 |
|
|
| 154 |
|
std::string restPre("mol_"); |