def minimal_driver(): DUMP_DATA = bool(int(os.environ.get("DUMP_DATA", "0"))) n_atoms = [32768] n_bins = 16384 coords = util.generate_random_coordinate_set(n_atoms) box = None # box = get_triclinic_box() # box = get_orthorhombic_box() force_triclinic = False # box = get_orthorhombic_triclinic_box() # force_triclinic = True histo = pydh.histograms(coords, r_max, n_bins, box=box, precision="double", force_triclinic=force_triclinic, n_threads=util.get_n_cpu_cores(), verbose=True) if DUMP_DATA: file_name = sys._getframe().f_code.co_name + ".dat" util.dump_histograms(file_name, histo, r_max, n_bins)
def test_generate_random_coordinate_set(): n_atoms = [1024] coords = util.generate_random_coordinate_set(n_atoms=n_atoms) for coord_set in coords: # print coord_set assert (np.min(coord_set) >= 0.0) assert (np.max(coord_set) <= 1.0)
def test_generate_random_coordinate_set_max(): n_atoms = [1024] coord_max = (2., 3., 4.) coords = util.generate_random_coordinate_set(n_atoms=n_atoms, coord_max=coord_max) for coord_set in coords: # print coord_set assert (np.min(coord_set) >= 0.0) assert (np.all(np.max(coord_set, axis=0) <= coord_max))
def test_generate_random_coordinate_set_min(): n_atoms = [1024] coord_min = (-1., -2., -3.) coords = util.generate_random_coordinate_set(n_atoms=n_atoms, coord_min=coord_min) for coord_set in coords: # print coord_set assert (np.all(np.min(coord_set, axis=0) >= coord_min)) assert (np.max(coord_set) <= 1.0)
def fixture_medium_manybins(): global testcase_medium_manybins if testcase_medium_manybins is None: n_atoms = [3000, 5000, 3500] n_bins = 68000 coords = util.generate_random_coordinate_set(n_atoms) histo_ref = dist.histograms(coords, r_max, n_bins) testcase_medium_manybins = (n_atoms, n_bins, coords, histo_ref) return testcase_medium_manybins
def fixture_small_invalid(): global testcase_small_invalid if testcase_small_invalid is None: n_atoms = [2000, 1000] n_bins = 1000 coords = util.generate_random_coordinate_set(n_atoms, blowup_factor=3.14) histo_ref = None testcase_small_invalid = (n_atoms, n_bins, coords, histo_ref) return testcase_small_invalid
def fixture_small(): """Create a reference case using the very first dist implementation.""" global testcase_small if testcase_small is None: n_atoms = [2847, 3918] n_bins = 1000 coords = util.generate_random_coordinate_set(n_atoms) histo = dist.histograms(coords, r_max, n_bins) # if DUMP_DATA: # file_name = sys._getframe().f_code.co_name + ".dat" # util.dump_histograms(file_name, histo, r_max, n_bins) testcase_small = (n_atoms, n_bins, coords, histo) return testcase_small
def fixture_large(): global testcase_large if testcase_large is None: n_atoms = [105000, 110000, 133000] n_bins = 16000 coords = util.generate_random_coordinate_set(n_atoms) # --- note that we use pydh to generate the test dataset histo_ref = pydh.histograms(coords, r_max, n_bins, precision="double", n_threads=n_threads[-1]) testcase_large = (n_atoms, n_bins, coords, histo_ref) return testcase_large
def fixture_xlarge(): global testcase_xlarge if testcase_xlarge is None: n_atoms = [250000, 275000, 225000] n_bins = 18000 coords = util.generate_random_coordinate_set(n_atoms) # --- note that we use pydh to generate the test dataset, max number of threads and no blocking histo_ref = pydh.histograms(coords, r_max, n_bins, precision="double", n_threads=n_threads[-1], blocksize=-1) testcase_xlarge = (n_atoms, n_bins, coords, histo_ref) return testcase_xlarge
def fixture_small_triclinic(): """Create a triclinic reference case in double precision using pydh.""" global testcase_small_triclinic if testcase_small_triclinic is None: n_atoms = [2847, 3918] n_bins = 1000 coords = util.generate_random_coordinate_set(n_atoms) box = get_triclinic_box() histo = pydh.histograms(coords, r_max, n_bins, box=box, precision="double", n_threads=1) testcase_small_triclinic = (n_atoms, n_bins, coords, box, histo) return testcase_small_triclinic
def get_frame(self, i): """Create coordinate data sets for a single frame.""" # Cadishi and Capriqorn use base.Container() instances to handle data frm = base.Container() # Generate list of (Nx3) NumPy coordinate arrays. # NOTE: This is the location where you would want to feed your own data in! # We use random data in this simple example. coord_set = util.generate_random_coordinate_set(self.n_objects) for idx, coords in enumerate(coord_set): # Each species carries a label. # NOTE: You need to take care about labels fitting to your data! label = "species_" + str(idx) # add coordinates to frame at the following standardized location location = base.loc_coordinates + '/' + label frm.put_data(location, coords.astype(np.float64)) # finally, each frame is uniquely numbered frm.i = i return frm
bap += old_div(float(n_atoms[i] * n_atoms[j]), 1.e9) else: if not run_values['histo2']: bap += old_div( float(old_div((n_atoms[j] * (n_atoms[j] - 1)), 2)), 1.e9) return bap # ------------------------------------------------------------------------------ if run_values['numa']: numa_topology = util.get_numa_domains() util.set_numa_domain(0, numa_topology) coords = util.generate_random_coordinate_set(run_values['size']) n_bins = run_values['bins'] if run_values['box'].startswith('t'): # triclinic dummy box box = np.asarray([0.30, 0.32, 0.34, 60., 60., 90.]) elif run_values['box'].startswith('o'): # orthorhombic dummy box box = np.zeros((3, 3)) box[0][0] = 0.66 box[1][1] = 0.68 box[2][2] = 0.70 else: # no box box = []