update the write matrix format, fix a bug in run_self_consistent