示例#1
0
    def initialize(self):

        #   pcoord dimensionality and length. This should match your outside bin
        self.pcoord_ndim = 2
        self.pcoord_len = pcoordlength
        self.pcoord_dtype = pcoord_dtype

        #   These are your "outer" bins in both dimensions
        outer_mapper = RectilinearBinMapper([[0.00, numpy.inf],
                                             [0.00, 8.00, numpy.inf]])
        #   These define the "inner" adaptive bins. Each one indicates an independent
        #   adaptive binning scheme. Copy for more. Respects the parameters at the start.
        adaptive_mapper0 = FuncBinMapper(function_map,
                                         prod(binsperdim) + numberofdim *
                                         (2 + 2 * splitIsolated) +
                                         activetarget,
                                         kwargs={"multi_idx": 0})  # Bottom bin
        adaptive_mapper1 = FuncBinMapper(function_map,
                                         prod(binsperdim) + numberofdim *
                                         (2 + 2 * splitIsolated) +
                                         activetarget,
                                         kwargs={"multi_idx": 1})  # Top bin

        #   These are the bins where you'll place each adaptive scheme.
        self.bin_mapper = RecursiveBinMapper(outer_mapper)
        self.bin_mapper.add_mapper(adaptive_mapper0, [5, 1])  #Bottom mapper
        self.bin_mapper.add_mapper(adaptive_mapper1, [5, 10])  #Top mapper

        ######################### JL ##########################################
        #    This is the what the example looks like.
        #
        #   inf --------------------------------------------------------
        #      |                                                        |
        #      |                    adaptive_mapper1                    |
        #      |                                                        |
        #     8 --------------------------------------------------------
        #  D2  |        |                                               |
        #      | TARGET |           adaptive_mapper0                    |
        #      | STATE  |                                               |
        #     0 --------------------------------------------------------
        #              3.5(soft bound via mincap)                      inf
        #                        Dimension 1 of pcoord
        #
        #######################################################################

        self.bin_target_counts = numpy.empty((self.bin_mapper.nbins, ),
                                             dtype=numpy.int)

        #   Number of walkers per bin
        self.bin_target_counts[...] = bintargetcount
示例#2
0
 def initialize(self):
     self.pcoord_ndim = 2
     self.pcoord_len = 2
     self.pcoord_dtype = numpy.float32
     minfrag = 90
     outer_mapper = RectilinearBinMapper([[0, minfrag - 0.5,
                                           float('inf')], [0,
                                                           float('inf')]])
     binbounds1 = [1.0 * i - 0.5
                   for i in xrange(minfrag, 121)] + [float('inf')]
     binbounds2 = [15.0 * i * (i - 1) / 2
                   for i in xrange(1, 20)] + [float('inf')]
     self.bin_mapper = RecursiveBinMapper(outer_mapper)
     self.bin_mapper.add_mapper(
         RectilinearBinMapper([binbounds1, binbounds2]), [minfrag, 1])
     self.bin_target_counts = numpy.empty((self.bin_mapper.nbins, ),
                                          numpy.int)
     self.bin_target_counts[...] = 4
     #this is intended to change the bins where distance < 200 A to 16 simulations per bin
     for q1 in xrange(minfrag, 121):
         for q2 in [0.5 + 15.0 * i * (i - 1) / 2 for i in xrange(1, 8)]:
             print(q1, q2)
             bin = self.bin_mapper.assign(numpy.array([(q1, q2)]))  #tuple?
             self.bin_target_counts[bin] = 16