Methodology for optical force calculations