  The shapes of solar coronal loops are sensitive to the presence of electrical
currents that are the carriers of the nonpotential energy available for
impulsive activity. We use this information in a new method for modeling the
coronal magnetic field of AR 11158 as a nonlinear force-free field (NLFFF). The
observations used are coronal images around time of major flare activity on
2011/02/15, together with the surface line-of-sight magnetic field
measurements. The data are from the Helioseismic and Magnetic Imager and
Atmospheric Imaging Assembly (HMI and AIA, respectively) onboard the Solar
Dynamics Observatory (SDO). The model fields are constrained to approximate the
coronal loop configurations as closely as possible, while also subject to the
force-free constraints. The method does not use transverse photospheric
magnetic field components as input, and is thereby distinct from methods for
modeling NLFFFs based on photospheric vector magnetograms. We validate the
method using observations of AR 11158 at a time well before major flaring, and
subsequently review the field evolution just prior to and following an X2.2
flare and associated eruption. The models indicate that the energy released
during the instability is about $1\times10^{32}$ erg, consistent with what is
needed to power such a large eruptive flare. Immediately prior to the eruption
the model field contains a compact sigmoid bundle of twisted flux that is not
present in the post-eruption models, which is consistent with the observations.
The core of that model structure is twisted by $\approx0.9$ full turns about
its axis.
