scripts to calculate flux linkage