Skip to content

Commit

Permalink
PYMOL-3155 MRC 2000 ORIGIN
Browse files Browse the repository at this point in the history
  • Loading branch information
speleo3 committed Nov 15, 2018
1 parent 9cae48d commit 895840e
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions layer2/ObjectMap.cpp
Expand Up @@ -2524,6 +2524,14 @@ static int ObjectMapCCP4StrToMap(ObjectMap * I, char *CCP4Str, int bytes, int st
ispg = *(i++);
sym_skip = *(i++);

// CCP4 Format:
// 25-37 skew transformation
// 38-52 future use "Storage space sometimes used by specific programs (default = 0)"

// MRC 2000 Format:
// 25-49 "Extra, user defined storage space (default = 0)"
// 50-52 ORIGIN

{
int skew = *(i++);

Expand Down Expand Up @@ -2553,9 +2561,17 @@ static int ObjectMapCCP4StrToMap(ObjectMap * I, char *CCP4Str, int bytes, int st
// TODO See "Origin Conventions" in http://situs.biomachina.org/fmap.pdf
float * mrc2000origin = (float *)(i + 49 - 25);
if (lengthsq3f(mrc2000origin) > R_SMALL4) {
double matrix[] = {
1., 0., 0., mrc2000origin[0],
0., 1., 0., mrc2000origin[1],
0., 0., 1., mrc2000origin[2],
0., 0., 0., 1.};

ObjectStateSetMatrix(&ms->State, matrix);

if (!quiet) {
PRINTFB(I->Obj.G, FB_ObjectMap, FB_Warnings)
" ObjectMapCCP4: MRC 2000 ORIGIN %.2f %.2f %.2f (unused)\n",
PRINTFB(I->Obj.G, FB_ObjectMap, FB_Details)
" ObjectMapCCP4: Applied MRC 2000 ORIGIN %.2f %.2f %.2f\n",
mrc2000origin[0], mrc2000origin[1], mrc2000origin[2]
ENDFB(I->Obj.G);
}
Expand Down

0 comments on commit 895840e

Please sign in to comment.