Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Making Sense of Number of bins in 2D MAB setup

83 views
Skip to first unread message

Hayden Scheiber

unread,
Jul 5, 2024, 4:01:37 PM7/5/24
to westpa-users
Hello,

I just wanted to check my understanding of how MAB parameters affect total bin numbers, as the docs and original paper are a bit unclear. I have set up a 2D recursive binning scheme including 3 inner MAB bins with the following configuration in WESTPA 2022.10.

      bins:
        # To use MAB binning, define a recursive bin mapper
        type: RecursiveBinMapper
        base:
            # This defines outer binning scheme
            type: RectilinearBinMapper
            boundaries:
                - [0, 22.17, inf] # Pcoord 0: SASA
                - [0, 3.0, inf] # Pcoord 1: Distance
        mappers:
          # Here we define the MAB binning scheme
          - type: MABBinMapper # MAB Step 1: Unpeeling
            direction: [1, 86]
            skip: [0, 0]
            bottleneck: True
            nbins: [5, 1]
            at: [1.0, 1.0]
            mab_log: true
            bin_log: true
          - type: MABBinMapper # MAB Step 2: Dissociation
            direction: [1, 1]
            skip: [0, 0]
            bottleneck: True
            nbins: [4, 1]
            at: [25.0, 1.0]
            mab_log: true
            bin_log: true
          - type: MABBinMapper # MAB Step 3: Separation
            direction: [86, 1]
            skip: [0, 0]
            bottleneck: False # Not needed for unhindered diffusion
            nbins: [1, 3]
            at: [25.0, 5.0]
            mab_log: true
            bin_log: true

Note the outer bin located at [5.0, 1.0] is not reachable.
By my calculations...
  • 2 x 2 = 4 Outer bins
  • MAB Step 1: 5x1 evenly spaced + 2 bottleneck + 1 leading (pcoord 0 only) = 8 bins
  • MAB Step 2: 4x1 evenly spaced + 2 bottleneck + 2 leading (both pcoords) = 8 bins
  • MAB Step 3: 1x3 evenly spaced + 0 bottleneck + 1 leading (pcoord 1 only) = 4 bins
...I expected 4 + 8 + 8 + 4 = 24 total bins, of which 20 are accessible. (None of the outer bins should not be accessible).

However, running the simulation logs 23 total active bins, and 20 of them become occupied.
Is this because the direction parameter also sets the number of bottleneck bins, such that MAB Step 1 only has the pcoord 0 bottleneck bin? If so, then setting direction = 86 with a single bin along a particular dimension should be equivalent to skipping that dimension, correct? (This is notable because I believe the skip parameter is still bugged as of version 2022.10).
But if that were the case, I would have expected 23 total bins, 19 of which are unreachable.
Fri Jul  5 18:34:48 2024
Iteration 81 (130 requested)
Beginning iteration 81
960 segments remain in iteration 81 (960 total)
20 of 23 (86.956522%) active bins are populated
per-bin minimum non-zero probability:       8.38777e-27
per-bin maximum probability:                0.806459
per-bin probability dynamic range (kT):     59.8279
per-segment minimum non-zero probability:   1.48945e-28
per-segment maximum non-zero probability:   0.0250834
per-segment probability dynamic range (kT): 60.3884
norm = 1, error in norm = -1.55431e-15 (-7*epsilon)
MAB binning in use
Bottleneck bin occupancy may not be accurately reported
Waiting for segments to complete...
################ MAB stats ################
minima in each dimension:      [7.99428, 1.4336749]
maxima in each dimension:      [22.157143, 2.3668966]
direction in each dimension:   [1, 86]
skip in each dimension:        [0, 0]
###########################################
################ MAB stats ################
minima in each dimension:      [22.185326, 1.5147547]
maxima in each dimension:      [29.632336, 2.9872193]
direction in each dimension:   [1, 1]
skip in each dimension:        [0, 0]
###########################################
################ MAB stats ################
minima in each dimension:      [25.288773, 3.0009027]
maxima in each dimension:      [29.196918, 20.145935]
direction in each dimension:   [86, 1]
skip in each dimension:        [0, 0]
###########################################
Iteration completed successfully
Iteration wallclock: 0:57:46.790739, cputime: 3 days, 8:02:44.459711
Is this discrepancy because the bottleneck bin occupancy is not accurately reported? Why does this occur? Here are the corresponding MAB bin logs:
iteration: 81
bin boundaries: [ 7.99427986 10.82685242 13.65942497 16.49199753 19.32457008 22.15714264]   [1.43367493 2.36689663]
min/max pcoord: [7.99428, 1.4336749] [22.157143, 2.3668966]
bottleneck bins: 3
bottleneck pcoord: [8.4495, 1.4767015] [13.026292, 1.9145263]

iteration: 81
bin boundaries: [22.18532562 24.04707813 25.90883064 27.77058315 29.63233566]   [1.51475465 2.98721933]
min/max pcoord: [22.185326, 1.5147547] [29.632336, 2.9872193]
bottleneck bins: 2
bottleneck pcoord: [22.18816, 1.5358068] [29.493408, 2.4841874]

iteration: 81
bin boundaries: [25.28877258 29.19691849]   [ 3.00090265  8.71591345 14.43092426 20.14593506]  
min/max pcoord: [25.288773, 3.0009027] [29.196918, 20.145935]
bottleneck bins: 0
The log for the first bin doesn't make sense to me, why are there three bottleneck bins?

Thanks,
Hayden

Hayden Scheiber

unread,
Jul 5, 2024, 6:18:28 PM7/5/24
to westpa-users
Sorry there are a couple of typos above.
"(None of the outer bins should not be accessible)." Should read "(None of the outer bins should be accessible)."
"19 of which are unreachable." Should read "19 of which are reachable."

Here is a visualization of my binning scheme:binning.png

Here is the distribution of walkers at the end of iteration 80:
frame_01599.png
At the first new time step of iteration 81:

frame_01600.png
And the final step of iteration 81:
frame_01619.png
I overlaid the outer bin boundaries on these plots. As you can see, no walkers are accessing outer bin 1.

Cheers,
Hayden

Jeremy Leung

unread,
Jul 8, 2024, 12:33:59 PM7/8/24
to westpa-users
Hi Hayden,

Just a heads up that reporting and actual behavior is decoupled in the code. I had a look at the code and it seems like with '86', it would still report a bin into "total count" (+ 1 extra if bottle neck is turned on). This is a bug, with 86, it should report 0 with bottleneck=False and 2 with bottleneck=True. If bottleneck is True, the behavior is that 86 will always have bottleneck bins in both directions.

- In bin (5,1), There will be 9 bins: 1 leading + 2 bottlenecks from 86 + 1 bottlenecks from 1 + 5 linear bins.
- In bin (25, 1), There will be 8 bins: 2 leading + 2 bottlenecks + 4 linear bins
- in bin (25, 5) There will be 5 bins: 1 leading + 1 extra from 86 + 3 linear bins
- In bin (1, 25) There will be 1 bin (no additional mapper).

That totals to 23. Correct should be 22 (the 86 bin from (25,5) should be removed from reporting). Behavior should be correct, though. Bin occupancy reporting might be off because there may be instances where fewer segments are selected for bottleneck (i.e. there isn't one, or there are more than 1), which is why we put in that warning that bin occupancy may be inaccurately reported. We'll aim to fix the reporting in the future.

As for the bottleneck_filled: There are 3 bottleneck bins filled in (5,1). Currently, 86 always has both bottleneck bins on for both directions (and they all happened to be filled this iteration). There were three segments that fit the latter three pcoord dimensions ([8.4495, 1.4767015] [13.026292, 1.9145263]). Segments considered bottleneck when at least one of the dimensions fit the pcoord presented here.

Best,

Jeremy L.

Hayden Scheiber

unread,
Jul 9, 2024, 9:35:23 PM7/9/24
to westpa-users
Hi Jeremy,

Thanks for your reply regarding this. I understand the behavior of MAB a lot better now.
After reading your reply, I looked into the westpa MAB code. I believe I found and resolved the bug that prevents skip from working correctly in 2D MAB cases.
See my PR on github for more info.

Cheers,
Hayden

Jeremy Leung

unread,
Jul 11, 2024, 11:21:59 AM7/11/24
to westpa-users
Hi Hayden,

Thanks for the making PR (and fixes)!  We'll review it shortly.

Cheers,

Jeremy L.
Reply all
Reply to author
Forward
0 new messages