| 1 |
|
/********************************************************************** |
| 2 |
|
Copyright (C) 2000 by OpenEye Scientific Software, Inc. |
| 3 |
< |
Some portions Copyright (C) 2001-2005 by Geoffrey R. Hutchison |
| 3 |
> |
Some portions Copyright (C) 2001-2006 by Geoffrey R. Hutchison |
| 4 |
|
Some portions Copyright (C) 2004 by Chris Morley |
| 5 |
< |
Some portions Copyright (C) 2008 by J. Daniel Gezelter |
| 5 |
> |
Some portions Copyright (C) 2008-2009 by J. Daniel Gezelter |
| 6 |
|
|
| 7 |
|
This program is free software; you can redistribute it and/or modify |
| 8 |
|
it under the terms of the GNU General Public License as published by |
| 40 |
|
virtual const char* Description() //required |
| 41 |
|
{ |
| 42 |
|
return |
| 43 |
< |
"OpenMD combined meta-data / cartesian coordinates format\nNo comments yet\n"; |
| 43 |
> |
"OpenMD combined meta-data / cartesian coordinates format\n\ |
| 44 |
> |
No comments yet\n"; |
| 45 |
|
}; |
| 46 |
|
|
| 47 |
|
virtual const char* SpecificationURL() |
| 129 |
|
return false; |
| 130 |
|
} |
| 131 |
|
|
| 132 |
+ |
|
| 133 |
+ |
|
| 134 |
|
WriteMDFile(mdMols, numMols, ofs, *pmol, indices); |
| 135 |
|
|
| 136 |
|
for(vector<OBMol*>::iterator i = mdMols.begin(); i != mdMols.end(); ++i) { |
| 173 |
|
vector<int>& fragment) { |
| 174 |
|
|
| 175 |
|
OBMol* newMol = new OBMol(); |
| 176 |
+ |
|
| 177 |
|
newMol->ReserveAtoms(fragment.size()); |
| 178 |
|
newMol->BeginModify(); |
| 179 |
|
for(vector<int>::iterator i = fragment.begin(); i != fragment.end(); ++i) { |
| 198 |
|
const int BUFFLEN = 1024; |
| 199 |
|
char buffer[BUFFLEN]; |
| 200 |
|
string str, str1, str2, str3; |
| 197 |
– |
OBAtom *a, *b, *c, *d; |
| 201 |
|
bool molIsWater = false; |
| 202 |
|
OBResidue *r; |
| 200 |
– |
int resKey, myserial; |
| 201 |
– |
char type_name[10]; |
| 202 |
– |
char *element_name; |
| 203 |
– |
int res_num; |
| 204 |
– |
OBChainsParser* chainParser = new OBChainsParser(); |
| 203 |
|
double min_x, max_x, min_y, max_y, min_z, max_z; /* Edges of bounding box */ |
| 204 |
|
|
| 205 |
< |
os << "<OpenMD version=1>" << endl; |
| 205 |
> |
os << "<OpenMD version=2>" << endl; |
| 206 |
|
os << " <MetaData>" << endl << endl; |
| 207 |
|
|
| 208 |
|
for(i = 0; i < mols.size(); ++i) { |
| 209 |
|
OBMol* pmol = mols[i]; |
| 210 |
|
map<OBAtom*, int> atomMap; |
| 211 |
|
|
| 214 |
– |
//chainParser->PerceiveChains(*pmol, false); |
| 212 |
|
molIsWater = false; |
| 213 |
|
FOR_RESIDUES_OF_MOL(residue, *pmol) { |
| 217 |
– |
std::cerr << "residue = " << residue->GetName() << "\n"; |
| 214 |
|
if (residue->GetName().compare("HOH") == 0) { |
| 215 |
|
molIsWater = true; |
| 216 |
|
} |
| 223 |
|
} else { |
| 224 |
|
|
| 225 |
|
os << "molecule {\n"; |
| 226 |
< |
sprintf(buffer, "%d", i); |
| 226 |
> |
sprintf(buffer, "%u", i); |
| 227 |
|
os << " name = \"" << molPrefix << buffer << "\";\n"; |
| 228 |
|
|
| 229 |
|
int ai = 0; |
| 346 |
|
size_t endpos = str.find_last_not_of(" "); |
| 347 |
|
str = str.substr( startpos, endpos-startpos+1 ); |
| 348 |
|
str1 = resName + "-" + str; |
| 349 |
< |
} |
| 349 |
> |
} |
| 350 |
|
os << " atom[" << ai << "] { "; |
| 351 |
|
os << "type = " << "\"" << str1 << "\"" << "; "; |
| 352 |
|
os << "position( " << (&*atom)->GetX() << ", " << (&*atom)->GetY() << ", " << (&*atom)->GetZ() << ");"; |
| 385 |
|
OBMol* pmol = mols[i]; |
| 386 |
|
os << "component{" << endl; |
| 387 |
|
if (std::string(pmol->GetTitle()).compare("HOH") == 0) { |
| 388 |
< |
os << " type = " << "HOH" << ";" << endl; |
| 388 |
> |
os << " type = " << "\"HOH\"" << "; // change to appropriate water model" << endl; |
| 389 |
|
} else { |
| 390 |
< |
sprintf(buffer, "%d", i); |
| 390 |
> |
sprintf(buffer, "%u", i); |
| 391 |
|
os << " type = " << molPrefix << buffer << ";" << endl; |
| 392 |
|
} |
| 393 |
|
os << " nMol = " << numMols[i]<< ";" << endl; |
| 411 |
|
os << buffer << endl; |
| 412 |
|
os << " </FrameData>" << endl; |
| 413 |
|
os << " <StuntDoubles>" << endl; |
| 414 |
< |
|
| 414 |
> |
|
| 415 |
|
OBAtom *atom; |
| 416 |
< |
|
| 421 |
< |
// still to do: intercept waters and recompute pvqj lines |
| 422 |
< |
|
| 416 |
> |
|
| 417 |
|
for(vector<int>::iterator i = indices.begin();i != indices.end(); ++i) { |
| 418 |
+ |
|
| 419 |
|
atom = mol.GetAtom(*i); |
| 420 |
|
sprintf(buffer, "%10d %7s %18.10g %18.10g %18.10g %13e %13e %13e", *i - 1, |
| 421 |
|
"pv", atom->GetX(), atom->GetY(), atom->GetZ(), 0.0, 0.0, 0.0); |