  By means of ab initio calculations, we study the effect of charge transfer
and symmetry mismatch on the magnetic and electronic properties of CaMnO$_3$
ultrathin films, epitaxially grown on SrTiO$_3$ (001). We find that the
interplay of these degrees of freedom, together with the low dimensionality and
the strain imposed by the substrate, changes the bulk occupancy of the Mn e_$g$
orbitals, which determines the magnetic configuration of the ultrathin CMO
films. A transition from an insulating G-type to a metallic A-type
antiferromagnetic configuration is stabilized.
