Application of the MHD energy principle to magnetostatic atmospheres. [and solar corona stability]