Write midpoint

Not tested (not even run).