Skip to content

Commit

Permalink
Merge pull request #2629 from ghutchis/dont-wrap-cif-coordinates
Browse files Browse the repository at this point in the history
By default do not wrap atomic coordinates to the unit cell
  • Loading branch information
ghutchis committed Sep 20, 2023
2 parents f495cc6 + b0dae46 commit e7aa094
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/formats/cifformat.cpp
Expand Up @@ -83,6 +83,7 @@ namespace OpenBabel
" B Use bonds listed in CIF file from _geom_bond_etc records (overrides option b)\n\n"

"Write Options e.g. -xg:\n"
" w Wrap atomic coordinates to unit cell (default = off)\n"
" g Write bonds using _geom_bond_etc fields \n\n";
}

Expand Down Expand Up @@ -1565,6 +1566,9 @@ namespace OpenBabel
return false;
ostream &ofs = *pConv->GetOutStream();

// default is false - leave coordinates as they are
bool wrapFractional = pConv->IsOption("w", OBConversion::OUTOPTIONS);

char buffer[BUFF_SIZE];

ofs <<"# CIF file generated by openbabel "<<BABEL_VERSION<<", see https://openbabel.org"<<endl;
Expand Down Expand Up @@ -1621,7 +1625,8 @@ namespace OpenBabel
vector3 v = atom->GetVector();
if (pUC != nullptr) {
v = pUC->CartesianToFractional(v);
v = pUC->WrapFractionalCoordinate(v);
if (wrapFractional)
v = pUC->WrapFractionalCoordinate(v);
}
X = v.x();
Y = v.y();
Expand Down

0 comments on commit e7aa094

Please sign in to comment.