  The magnetic properties of a nanoscale system are inextricably linked to its
local environment. In ad-atoms on surfaces and inorganic layered structures the
exchange interactions result from the relative lattice positions, layer
thicknesses and other environmental parameters. Here, we report on a
sample-dependent sign inversion of the magnetic exchange coupling between the
three unpaired spins of an organic triradical molecule embedded in a
three-terminal device. This ferro-to-antiferromagnetic transition is due to
structural distortions and results in a high-to-low spin ground state change in
a molecule traditionally considered to be a robust high-spin quartet. Moreover,
the flexibility of the molecule yields an in-situ electric tunability of the
exchange coupling via the gate electrode. These findings open a route to the
controlled reversal of the magnetic states in organic molecule-based
nanodevices by mechanical means, electrical gating or chemical tailoring.
