Dimensions analysis in Differential equation Differential equation of solitary wave oscillons  is defined by,
$$ \Delta S -S +S^3=0 $$
How can we write this equation as,
\begin{equation}
\langle(\vec{\nabla}S)^2\rangle+\langle S^2\rangle-\langle S^4\rangle=0 \tag{1}
\end{equation}
where $\langle f\rangle:=\int d^Dx f(x)$. Furthermore, another virial identity
can be found
from the scaling transformation ($\vec{x}\to \mu \vec{x}$)
by extremizing the scaled ($\vec{x}\to\mu \vec{x}$)
of the action corresponding to 
$ \int d^Dx[(\vec{\nabla}S)^2+S^2-S^4/2]$ ( why $\frac{-S^4}{2}$):
\begin{equation}
(D-2)\langle(\vec{\nabla}S)^2\rangle+D\langle S^2\rangle-\frac{D}{2}\langle S^4\rangle=0 \tag{2}
\end{equation}
From Eqs. (1) and (2) one immediately finds
\begin{equation}
2\langle S^2\rangle+\frac{1}{2}(D-4)\langle S^4\rangle=0\,,
\end{equation}
which equality can only be satisfied if $D<4$.
D= Refers dimension.

I didn't understand the equation (2). Can someone do elaborately?

If you have any Query then ask me please.
Thanks in advance.
I think this article will give you enough information: link check equations (21, 41, 42 43) 
 A: The first part is simply multiplication by $S$, adding an integral sign,  integration by parts for the first term.
For the second part consider a variation $\hat S(x;\mu)=S(x/\mu)$. Then do a change of variables $x=\mu y$. If the action is stationary under this spatial rescaling of $S$ then $d/d\mu$ at $\mu=1$ vanishes. Since the first term scales to $\mu^{D-2}$ with 2 from the derivative and $D$ from the Jacobian factor, this derivative gives a factor of $D-2$ as shown in the expression given. The rest are just Jacobian factors.
Edit: For example,
$$ \left< (\nabla\hat  S)^2\right> =  \int d^Dx (\nabla_x S(x/\mu))^2 = \int \mu^D d^Dy (\mu^{-1} \nabla_y S(y))^2 = \mu^{D-2} \left< (\nabla S)^2\right>$$
The derivative at $\mu=1$ is exactly $(D-2) \left< (\nabla S)^2\right>$.

To clarify the first part, first multiply the equation by $-S$. Then integrate over all space. This gives the last two terms in the next line. Then for the first one, notice that $-S\nabla\cdot\nabla S$ can be integrated by parts using the divergence theorem. This shifts the $\nabla$ to the other term and changes the sign giving the shown result. If you prefer $\nabla\cdot(S\nabla S)$ can be expanded using the product rule and then the result substituted into the integral.
The factor of a half in the action arises from wanting the Euler-Lagrange equation for this action to be the given equation. The EL eqn contains $\partial L/\partial S$ so $L=S^2 + \alpha S^4$ results in a term $2S+ 4\alpha S^3$ so to get this agreeing with the eqn, up to an overall factor, choose $\alpha=-1/2$.
The deduction of (2) follows as I discuss above; rescale by $\mu$, then differentiate at $\mu=1$.
