Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 36 additions & 14 deletions src/xmipp/libraries/reconstruction/volume_to_pseudoatoms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -935,21 +935,43 @@ void ProgVolumeToPseudoatoms::writeResults()
if (allowIntensity)
intensity=0.01+ROUND(100*a*(atoms[n].intensity-minIntensity))/100.0;
if (col==1)
fprintf(fhOut,
"ATOM %5d DENS DENS%5d %8.3f%8.3f%8.3f%6.2f 1 DENS\n",
n+1,n+1,
(float)(atoms[n].location(2)*sampling),
(float)(atoms[n].location(1)*sampling),
(float)(atoms[n].location(0)*sampling),
(float)intensity);
if (n+1 < 10000)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? You can print both with %5d and it will be justified to right with no leading zeros.
If you need justification to right, you can use %-5d

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. I'll try that

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, right. The reason is I wanted to use the 5th column only if I need it. Probably, that's unnecessary complexity though.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand.
The formatting needs to follow the standard, what does the standard say about the length?

fprintf(fhOut,
// ATOM 1DENS DEN 1 -29.425 5.511 53.019 0.05 1 DENS
"ATOM %5dDENS DEN %4d %8.3f%8.3f%8.3f%6.2f 1 DENS\n",
n+1,n+1,
(float)(atoms[n].location(2)*sampling),
(float)(atoms[n].location(1)*sampling),
(float)(atoms[n].location(0)*sampling),
(float)intensity);
else
fprintf(fhOut,
// ATOM 14491DENS DEN 14491 12.840 44.940 25.680 0.07 1 DENS
"ATOM %5dDENS DEN %5d %8.3f%8.3f%8.3f%6.2f 1 DENS\n",
n+1,n+1,
(float)(atoms[n].location(2)*sampling),
(float)(atoms[n].location(1)*sampling),
(float)(atoms[n].location(0)*sampling),
(float)intensity);
else
fprintf(fhOut,
"ATOM %5d DENS DENS%5d %8.3f%8.3f%8.3f 1%6.2f DENS\n",
n+1,n+1,
(float)(atoms[n].location(2)*sampling),
(float)(atoms[n].location(1)*sampling),
(float)(atoms[n].location(0)*sampling),
(float)intensity);
if (n+1 < 10000)
fprintf(fhOut,
// ATOM 1DENS DEN 1 -29.425 5.511 53.019 1 0.05 DENS
"ATOM %5dDENS DEN %4d %8.3f%8.3f%8.3f 1%6.2f DENS\n",
n+1,n+1,
(float)(atoms[n].location(2)*sampling),
(float)(atoms[n].location(1)*sampling),
(float)(atoms[n].location(0)*sampling),
(float)intensity);
else
fprintf(fhOut,
// ATOM 14491DENS DEN 14491 12.840 44.940 25.680 1 0.07 DENS
"ATOM %5dDENS DEN %5d %8.3f%8.3f%8.3f 1%6.2f DENS\n",
n+1,n+1,
(float)(atoms[n].location(2)*sampling),
(float)(atoms[n].location(1)*sampling),
(float)(atoms[n].location(0)*sampling),
(float)intensity);
}
fclose(fhOut);

Expand Down