// test_xyzbins.cc // Kevin Karplus // 8 April 2002 // This is a crude test fixture for testing the XYZbins class. // // Two Pointlists are created: // one is used to set up XYZbins, the other to query the bins. // The "correct" answers are determined by brute-force comparison of // all points. #include // for drand48 #include "XYZbins.h" const double XRange = 25. ; // range of coordinates XYZpoint gen_point(void) { XYZpoint temp; temp.X = XRange*(drand48()-0.5); temp.Y = XRange*(drand48()-0.5); temp.Z = XRange*(drand48()-0.5); return temp; } static int Count_for_func; void Count_reported_pairs(int index_in_bins, const XYZpoint& bin_point, int in_query, const XYZpoint& query_point, double dist2) { Count_for_func++; } main() { // atoms in dense part of proteins are about 40/cubic nanometer const int num_atoms = (int)ceil(XRange*XRange*XRange*0.040); const int num_queries = num_atoms/5; const int num_tries = 10; // number of repetitions of test Pointlist atoms(num_atoms), queries(num_queries); XYZpoint A; for (int outer=0; outer