# Possible configurations of NR red balls and NB blue balls on a circle of L sites with D doubly occupied sites and B bonds (occupied nearest neighbors)

I am a physicist working on metal-insulator transition in crystalline materials due to Coulomb interaction between their electrons (with both spins up and down) depending whether they occupy the same lattice site (double occupancy of the opposite spins) or two adjacent sites (bond occupancy). In particular, I am interested in the ground-state energy of a toy model for interacting electrons on a circular ring. In order to find the energy, I must find all the possible configurations electrons can make. Here is the statement of the problem:

Suppose there are NR identical red balls (spin-up electrons) and NB identical blue balls (spin-down electrons) to occupy L sites (site # 1 through L) of a circular ring. Each site can be either empty, singly occupied with a red or blue ball, and doubly occupied with both red and blue balls; no site can be occupied with two balls with the same color. The two occupied adjacent sites with either balls are labelled by a bond, B; therefore, bonds are indistinguishable.

The question is how many configurations I can make for given L sites and NR and NB balls such that they make B bonds and D doubly-occupied sites. I denote the desired number by K(B,D,NR,NB,L) and I assume that the balls occupy the sites independently; therefore, I have the following identity:

Sum [K(B,D,NR,NB,L),{B,0,4L},{D,0,L}]=N_T=C(NR,L)C(NB,L)=[L!/NR!(L-NR)!][L!/NB!(L-NB)!]

I would like to know if a closed form for K(B,D,NR,NB,L) can be found.