| 60 |
|
OBMol* createMolFromFragment(OBMol& mol, vector<int>& fragment); |
| 61 |
|
void WriteMDFile(vector<OBMol*> mols, vector<int> numMols, ostream& os, |
| 62 |
|
OBMol& mol, vector<int>& indices); |
| 63 |
+ |
void CalcBoundingBox(OBMol &mol, |
| 64 |
+ |
double &min_x, double &max_x, |
| 65 |
+ |
double &min_y, double &max_y, |
| 66 |
+ |
double &min_z, double &max_z); |
| 67 |
+ |
|
| 68 |
|
}; |
| 69 |
|
|
| 70 |
|
//Make an instance of the format class |
| 200 |
|
char type_name[10]; |
| 201 |
|
char *element_name; |
| 202 |
|
int res_num; |
| 203 |
< |
OBChainsParser* chainParser = new OBChainsParser(); |
| 204 |
< |
|
| 203 |
> |
OBChainsParser* chainParser = new OBChainsParser(); |
| 204 |
> |
double min_x, max_x, min_y, max_y, min_z, max_z; /* Edges of bounding box */ |
| 205 |
|
|
| 206 |
|
os << "<OOPSE version=4>" << endl; |
| 207 |
|
os << " <MetaData>" << endl << endl; |
| 280 |
|
else |
| 281 |
|
os << "members(" << b2 << ", " << b1 << "); "; |
| 282 |
|
|
| 283 |
< |
os << "}\n"; |
| 283 |
> |
os << "}" << endl; |
| 284 |
|
} |
| 285 |
|
|
| 286 |
< |
os << "\n"; |
| 287 |
< |
|
| 283 |
< |
std::vector<int> possibleInversion; |
| 284 |
< |
FOR_ATOMS_OF_MOL(atom, *pmol) { |
| 285 |
< |
possibleInversion.clear(); |
| 286 |
< |
|
| 287 |
< |
FOR_NBORS_OF_ATOM(nbor, &*atom) { |
| 288 |
< |
possibleInversion.push_back(atomMap[&(*nbor)]); |
| 289 |
< |
} |
| 290 |
< |
|
| 291 |
< |
if (possibleInversion.size() == 3) { |
| 292 |
< |
|
| 293 |
< |
os << " inversion { "; |
| 294 |
< |
os << "center(" << atomMap[&(*atom)] << "); "; |
| 295 |
< |
os << "}\n"; |
| 296 |
< |
} |
| 297 |
< |
|
| 298 |
< |
} |
| 286 |
> |
os << endl; |
| 287 |
> |
|
| 288 |
|
os << "}" << endl; |
| 289 |
|
os << endl; |
| 290 |
|
} |
| 291 |
|
} |
| 292 |
|
|
| 293 |
|
os << endl; |
| 294 |
< |
|
| 306 |
< |
|
| 294 |
> |
|
| 295 |
|
for(i=0; i < mols.size(); ++i) { |
| 296 |
|
OBMol* pmol = mols[i]; |
| 297 |
|
os << "component{" << endl; |
| 312 |
|
sprintf(buffer, " Time: %.10g", 0.0); |
| 313 |
|
|
| 314 |
|
os << buffer << endl; |
| 327 |
– |
|
| 315 |
|
|
| 316 |
< |
// should really compute a bounding box here: |
| 317 |
< |
sprintf(buffer, " Hmat: {{ %.10g, %.10g, %.10g }, { %.10g, %.10g, %.10g }, { %.10g, %.10g, %.10g }}", 100.0, 0.0, 0.0, 0.0, 100.0, 0.0, 0.0, 0.0, 100.0); |
| 316 |
> |
CalcBoundingBox(mol, min_x, max_x, min_y, max_y, min_z, max_z); |
| 317 |
> |
|
| 318 |
> |
// still to do: should compute a bounding box here |
| 319 |
> |
sprintf(buffer, " Hmat: {{ %.10g, %.10g, %.10g }, { %.10g, %.10g, %.10g }, { %.10g, %.10g, %.10g }}", |
| 320 |
> |
max_x - min_x, 0.0, 0.0, 0.0, max_y - min_y, 0.0, 0.0, 0.0, max_z - min_z); |
| 321 |
|
|
| 322 |
|
os << buffer << endl; |
| 323 |
|
os << " </FrameData>" << endl; |
| 329 |
|
|
| 330 |
|
for(vector<int>::iterator i = indices.begin();i != indices.end(); ++i) { |
| 331 |
|
atom = mol.GetAtom(*i); |
| 332 |
< |
sprintf(buffer, "%10d %7s %18.10g %18.10g %18.10g %13e %13e %13e", *i - 1, "pv", atom->GetX(), atom->GetY(), atom->GetZ(), 0.0, 0.0, 0.0); |
| 332 |
> |
sprintf(buffer, "%10d %7s %18.10g %18.10g %18.10g %13e %13e %13e", *i - 1, |
| 333 |
> |
"pv", atom->GetX(), atom->GetY(), atom->GetZ(), 0.0, 0.0, 0.0); |
| 334 |
|
os << buffer << endl; |
| 335 |
|
} |
| 336 |
|
os << " </StuntDoubles>" << endl; |
| 337 |
|
os << " </Snapshot>" << endl; |
| 338 |
|
os << "</OOPSE>" << endl; |
| 339 |
|
} |
| 340 |
< |
|
| 340 |
> |
|
| 341 |
> |
void OOPSEFormat::CalcBoundingBox(OBMol &mol, |
| 342 |
> |
double &min_x, double &max_x, |
| 343 |
> |
double &min_y, double &max_y, |
| 344 |
> |
double &min_z, double &max_z |
| 345 |
> |
) |
| 346 |
> |
{ |
| 347 |
> |
/* ---- Init bounding-box variables ---- */ |
| 348 |
> |
min_x = (double) 0.0; |
| 349 |
> |
max_x = (double) 0.0; |
| 350 |
> |
min_y = (double) 0.0; |
| 351 |
> |
max_y = (double) 0.0; |
| 352 |
> |
min_z = (double) 0.0; |
| 353 |
> |
max_z = (double) 0.0; |
| 354 |
> |
|
| 355 |
> |
/* ---- Check all atoms ---- */ |
| 356 |
> |
for(unsigned int i = 1; i <= mol.NumAtoms(); ++i) |
| 357 |
> |
{ |
| 358 |
> |
|
| 359 |
> |
/* ---- Get a pointer to ith atom ---- */ |
| 360 |
> |
OBAtom *atom = mol.GetAtom(i); |
| 361 |
> |
|
| 362 |
> |
/* ---- Check for minimal/maximal x-position ---- */ |
| 363 |
> |
if (atom -> GetX() < min_x) |
| 364 |
> |
min_x = atom -> GetX(); |
| 365 |
> |
if (atom -> GetX() > max_x) |
| 366 |
> |
max_x = atom -> GetX(); |
| 367 |
> |
|
| 368 |
> |
/* ---- Check for minimal/maximal y-position ---- */ |
| 369 |
> |
if (atom -> GetY() < min_y) |
| 370 |
> |
min_y = atom -> GetY(); |
| 371 |
> |
if (atom -> GetY() > max_y) |
| 372 |
> |
max_y = atom -> GetY(); |
| 373 |
> |
|
| 374 |
> |
/* ---- Check for minimal/maximal z-position ---- */ |
| 375 |
> |
if (atom -> GetZ() < min_z) |
| 376 |
> |
min_z = atom -> GetZ(); |
| 377 |
> |
if (atom -> GetZ() > max_z) |
| 378 |
> |
max_z = atom -> GetZ(); |
| 379 |
> |
|
| 380 |
> |
} |
| 381 |
> |
} |
| 382 |
|
} //namespace OpenBabel |
| 383 |
|
|