2020#include < mutex>
2121#include < nlohmann/json.hpp>
2222#include < optional>
23+ #include < sstream>
2324#include < string>
2425#include < thread>
2526#include < vector>
@@ -372,14 +373,6 @@ int main(int argc, char **argv) {
372373 expt.set_crystal (best_xtal);
373374 expt.beam ().set_s0 (best_beam.get_s0 ());
374375 expt.detector ().update (best_panel.get_d_matrix ());
375- gemmi::UnitCell bestcell = best_xtal.get_unit_cell ();
376- logger.info (" Best cell (P1): {:.2f} {:.2f} {:.2f} {:.2f} {:.2f} {:.2f}" ,
377- bestcell.a ,
378- bestcell.b ,
379- bestcell.c ,
380- bestcell.alpha ,
381- bestcell.beta ,
382- bestcell.gamma );
383376
384377 // Save the indexed experiment list.
385378 json elist_out = expt.to_json ();
@@ -396,7 +389,7 @@ int main(int argc, char **argv) {
396389
397390 // Recalculate the rlp and s1 vectors based on the updated models.
398391 xyz_to_rlp_results final_results =
399- xyz_to_rlp (xyzobs_px, detector.panels ()[0 ], expt.beam (), scan, gonio);
392+ xyz_to_rlp (xyzobs_px, expt. detector () .panels ()[0 ], expt.beam (), scan, gonio);
400393 strong_reflections.add_column (std::string (" xyzobs.mm.value" ),
401394 final_results.xyzobs_mm .extent (0 ),
402395 3 ,
@@ -432,9 +425,73 @@ int main(int argc, char **argv) {
432425 // Index the data with the refined models.
433426 assign_indices_results assign_results = assign_indices_global (
434427 expt.crystal ().get_A_matrix (), final_results.rlp , final_results.xyzobs_mm );
435- logger.info (" Indexed {}/{} reflections using the refined models" ,
436- assign_results.number_indexed ,
437- xyzobs_px.extent (0 ));
428+
429+ // Print useful log output of results.
430+ int n_indexed = assign_results.number_indexed ;
431+ int n_total = xyzobs_px.extent (0 );
432+ double percentage_indexed = 100.0 * static_cast <double >(n_indexed) / n_total;
433+ logger.info (
434+ " Indexed {}/{} reflections using the refined models ({:.2f}\% indexed)" ,
435+ n_indexed,
436+ n_total,
437+ percentage_indexed);
438+ gemmi::UnitCell cell = expt.crystal ().get_unit_cell ();
439+ Matrix3d U = expt.crystal ().get_U_matrix ();
440+ Matrix3d B = expt.crystal ().get_B_matrix ();
441+ Matrix3d A = expt.crystal ().get_A_matrix ();
442+
443+ const std::string msg = fmt::format (
444+ " Crystal:\n "
445+ " Unit cell: {:.4f} {:.4f} {:.4f} {:.4f} {:.4f} {:.4f}\n "
446+ " Space group: P 1\n "
447+ " U matrix: [[{:>7.4f}, {:>7.4f}, {:>7.4f}],\n "
448+ " [{:>7.4f}, {:>7.4f}, {:>7.4f}],\n "
449+ " [{:>7.4f}, {:>7.4f}, {:>7.4f}]]\n "
450+ " B matrix: [[{:>7.4f}, {:>7.4f}, {:>7.4f}],\n "
451+ " [{:>7.4f}, {:>7.4f}, {:>7.4f}],\n "
452+ " [{:>7.4f}, {:>7.4f}, {:>7.4f}]]\n "
453+ " A = UB: [[{:>7.4f}, {:>7.4f}, {:>7.4f}],\n "
454+ " [{:>7.4f}, {:>7.4f}, {:>7.4f}],\n "
455+ " [{:>7.4f}, {:>7.4f}, {:>7.4f}]]" ,
456+ cell.a ,
457+ cell.b ,
458+ cell.c ,
459+ cell.alpha ,
460+ cell.beta ,
461+ cell.gamma ,
462+ U (0 , 0 ),
463+ U (0 , 1 ),
464+ U (0 , 2 ),
465+ U (1 , 0 ),
466+ U (1 , 1 ),
467+ U (1 , 2 ),
468+ U (2 , 0 ),
469+ U (2 , 1 ),
470+ U (2 , 2 ),
471+ B (0 , 0 ),
472+ B (0 , 1 ),
473+ B (0 , 2 ),
474+ B (1 , 0 ),
475+ B (1 , 1 ),
476+ B (1 , 2 ),
477+ B (2 , 0 ),
478+ B (2 , 1 ),
479+ B (2 , 2 ),
480+ A (0 , 0 ),
481+ A (0 , 1 ),
482+ A (0 , 2 ),
483+ A (1 , 0 ),
484+ A (1 , 1 ),
485+ A (1 , 2 ),
486+ A (2 , 0 ),
487+ A (2 , 1 ),
488+ A (2 , 2 ));
489+ std::istringstream iss (msg);
490+ std::string line;
491+ while (std::getline (iss, line)) {
492+ logger.info (" {}" , line);
493+ }
494+
438495 strong_reflections.add_column (std::string (" miller_index" ),
439496 assign_results.miller_indices .extent (0 ),
440497 assign_results.miller_indices .extent (1 ),
0 commit comments