af::double3 modShortDifference(const af::double3& Xf, const af::double3& Yf) { return fractional<double>(Xf - Yf).modShort(); }
BOOST_PYTHON_END_CONVERSION_NAMESPACEnamespace {# include <cctbx/basic/from_bpl_import.h>  // Python representation, e.g. output of "print UnitCell()"  python::string UnitCell_repr(const UnitCell& uc)  {    uc_params ucp = uc.getParameters();#ifdef USE_OSTRINGSTREAM    std::ostringstream ost;    ost << ucp.Len(0) << " "        << ucp.Len(1) << " "        << ucp.Len(2) << " "        << ucp.Ang(0) << " "        << ucp.Ang(1) << " "        << ucp.Ang(2);    return python::string(ost.str());#else    char buf[128];    sprintf(buf, "%.6g %.6g %.6g %.6g %.6g %.6g",      ucp.Len(0), ucp.Len(1), ucp.Len(2),      ucp.Ang(0), ucp.Ang(1), ucp.Ang(2));    return python::string(buf);#endif  }  // Support for pickle.  tuple UnitCell_getinitargs(const UnitCell& uc) {    tuple initargs(1);    initargs.set_item(0, ref(to_python(uc.getParameters(false))));    return initargs;  }  // Substitute default parameters.  uc_params UnitCell_getParameters_0(const UnitCell& uc) {    return uc.getParameters();  }  af::double9 UnitCell_getMetricalMatrix_0(const UnitCell& uc) {    return uc.getMetricalMatrix();  }  double  UnitCell_Length2(const UnitCell& uc,                   const fractional<double>& Xf) {    return uc.Length2(Xf);  }  double  UnitCell_Length(const UnitCell& uc,                  const fractional<double>& Xf) {    return uc.Length(Xf);  }  double  UnitCell_Distance2(const UnitCell& uc,                     const fractional<double>& Xf,                     const fractional<double>& Yf) {    return uc.Distance2(Xf, Yf);  }  double  UnitCell_Distance(const UnitCell& uc,                    const fractional<double>& Xf,                    const fractional<double>& Yf) {    return uc.Distance(Xf, Yf);  }  double  UnitCell_modShortLength2(const UnitCell& uc,                           const fractional<double>& Xf) {    return uc.modShortLength2(Xf);  }  double  UnitCell_modShortLength(const UnitCell& uc,                          const fractional<double>& Xf) {    return uc.modShortLength(Xf);  }  double  UnitCell_modShortDistance2(const UnitCell& uc,                             const fractional<double>& Xf,                             const fractional<double>& Yf) {    return uc.modShortDistance2(Xf, Yf);  }  double  UnitCell_modShortDistance(const UnitCell& uc,                            const fractional<double>& Xf,                            const fractional<double>& Yf) {    return uc.modShortDistance(Xf, Yf);  }  UnitCell  UnitCell_ChangeBasis_1(const UnitCell& uc, const af::double9& InvCBMxR) {    return uc.ChangeBasis(InvCBMxR);  }  fractional<double>  UnitCell_fractionalize(const UnitCell& uc,                         const cartesian<double>& Xc) {    return uc.fractionalize(Xc);  }  cartesian<double>  UnitCell_orthogonalize(const UnitCell& uc,                         const fractional<double>& Xf) {    return uc.orthogonalize(Xf);  }  bool UnitCell_isEqual_1(const UnitCell& uc, const UnitCell& other) {    return uc.isEqual(other);  }}