support other boundary conditions in the bulk matrix code