Modified force calculation function