Fragment size calculation is usually determined by cross-correlation analysis, wherein you compute correlation between the positive and negative strand densities from a particular position. Then you shift the position of both strands by one position - you should expect to see maximum correlation between the two strands at fragment length.
You can use spp (used by ENCODE consortium) package to do this in R.
Snippet of code:
library(spp) chip.data <- read.bam.tags(bamfile) binding.characteristics <- get.binding.characteristics(chip.data,srange=c(50,500),bin=5, accept.all.tags = T) print(paste("binding peak separation distance =",binding.characteristics$peak$x))