Hi Leo,

Hi, phenix.refine outputs "WILSON B" value into PDB header after 
refinement, which is not the same as average B-factor of all the atoms 
in the structure, and not exactly the same as Wilson B-factor from SCALA 
scaling. How exactly is Wilson B-factor for phenix header calculated 

Wilson B is computed using Peter's procedure as described in:

Zwart, P.H., Grosse-Kunstleve, R.W. & Adams, P.D. (2005). CCP4 newsletter. No. 42.

or in one of there references in this paper. Peter may comment on this some more.

and 
would it be possible to output there also the average B-factor of all 
the atoms in the structure?
  

It is reported by phenix.refine many times in many different places:

- in PDB file header:

REMARK            |-----overall-----|---macromolecule----|------solvent-------|
REMARK   stage    b_max  b_min  b_ave  b_max  b_min  b_ave  b_max  b_min  b_ave
REMARK    0    : 100.80   7.48  28.20 100.80   7.48  27.43  78.39  12.05  40.43
REMARK    1_bss: 101.17   7.85  28.57 101.17   7.85  27.80  78.76  12.42  40.80
REMARK    1_xyz: 101.17   7.85  28.18 101.17   7.85  27.80  58.46  14.33  35.27
REMARK    1_adp: 113.33  11.63  27.68 113.33  11.63  27.44  55.19  16.55  32.10
REMARK    2_bss: 113.47  11.78  27.82 113.47  11.78  27.58  55.33  16.70  32.24
REMARK    2_xyz: 113.47  11.78  27.93 113.47  11.78  27.58  55.28  14.61  34.43
REMARK    2_adp: 114.56  11.66  27.71 114.56  11.66  27.46  52.95  16.40  32.23
REMARK    3_bss: 114.64  11.73  27.79 114.64  11.73  27.54  53.03  16.48  32.30
REMARK    3_xyz: 114.64  11.73  27.86 114.64  11.73  27.54  57.12  13.65  33.94
REMARK    3_adp: 115.09  11.32  27.64 115.09  11.32  27.42  53.24  16.30  31.94
REMARK    3_bss: 115.15  11.38  27.68 115.15  11.38  27.48  53.31  16.37  31.63

- in log file:

|-ADP statistics--------------------------------------------------------------|
|    Atom    | Number of   | Isotropic or equivalent| Anisotropy lmin/max     |
|    type    |iso    aniso | min     max     mean   | min   max    mean       |
|    - - - - |- - - - - - -| - - - - - - - - - - - -| - - - - - - - - - -     |
|    all     : 3549   0      11.38   115.15  27.68    None  None   None       |
|    all(noH): 3549   0      11.38   115.15  27.68    None  None   None       |
|    Sol.    : 169    0      16.37   53.31   31.63    None  None   None       |
|    Mac.    : 3380   0      11.38   115.15  27.48    None  None   None       |
|    Hyd.    : 0      0      None    None    None     None  None   None       |
|    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -      |
|       Distribution of isotropic (or equivalent) ADP for non-H atoms:        |
|    Bin#      value range     #atoms | Bin#      value range     #atoms      |
|      0:    11.384 -  21.760: 1339   |   5:    63.266 -  73.643:   30        |
|      1:    21.760 -  32.137: 1407   |   6:    73.643 -  84.019:   24        |
|      2:    32.137 -  42.513:  442   |   7:    84.019 -  94.396:   18        |
|      3:    42.513 -  52.890:  200   |   8:    94.396 - 104.772:   18        |
|      4:    52.890 -  63.266:   68   |   9:   104.772 - 115.149:    3        |
|                               =>continue=>                                  |
|-----------------------------------------------------------------------------|


- finally, you can type:

phenix.pdbtools model.pdb --show-adp-statistics [optionally, give a CIF file]

Also, deposition into PDB requires only Luzzati coordinate errors, while 
phenix produces only ML based ones. Presumably ML estimate is better 
than Luzzati?, 

ML error estimate is better than Luzzati one, indeed. That's exactly why phenix.refine outputs ML error estimate. And even ML error estimate has it's own known problems (not just in phenix, but in general), so it shouldn't be taken too literally.

phenix.refine outputs PDB file almost ready for PDB deposition, and "almost" means here that you have to remove the upper part of the header till where the REMARK 3 section starts.

Pavel.