\unprotect

% ========= Aditya code ============
\def\placesubformulawithnumber{%
  \dodoubleempty\doplacesubformulawithnumber}

\def\doplacesubformulawithnumber[#1][#2]%#2 gobbles spaces
  {\iffirstargument
    \incrementnumber[\v!formula]
    \makesectionnumber[\v!formula]
    \rawreference{\s!for}{#1}{\composedsectionnumber}
  \else
    \incrementnumber[\v!formula]
  \fi\placesubformula}

\startmathcollection[default]
  \definemathcommand [div]      [nolop] {\mfunction{div}}
  \definemathcommand [rot]      [nolop] {\mfunction{rot}}
\stopmathcollection 
% =================================
\definereferenceformat [informula] 
    [left=(, right=), text=]

\protect 

\starttext
Some math tests, use of formula/subformula numbering.
\placesubformulawithnumber[kem-chapter1-eqn1]
\startformula
\startalign
\NC \div  \vec{E} \NC =  \frac{\rho}{\epsilon_{0}}\NR[kem-chapter1-eqn1:A][a]
\NC \rot  \vec{B}  \NC =  \mu_{0}  \:\vec{j}          \NR[kem-chapter1-eqn1:B][b]
\NC \div  \vec{B} \NC =  0                        \NR[kem-chapter1-eqn1:C][c]
\NC \rot  \vec{E} + \frac{\partial \vec{B} }{\partial t} \NC = 0  \NR[kem-chapter1-eqn1:D][d]
\stopalign
\stopformula
See \informula[kem-chapter1-eqn1] or alternatively
\informula[kem-chapter1-eqn1:A], \informula[kem-chapter1-eqn1:B],\informula[kem-chapter1-eqn1:C] or
\informula[kem-chapter1-eqn1:D].
\blank
Another test to check that the formula numbers work as expected
\placeformula[kem-chapter-eqn11]
\startformula
\cases{
\eqalign{
\widehat{\vec{x}} &= - \vec{x} \cr
\widehat{t} & = t \cr
}}
\quad \text{resp.} \quad
\cases{\eqalign{
\widehat{\vec{x}} &=  \vec{x} \cr
\widehat{t} & = -t \cr
}}
\stopformula

\stoptext

