14. (25 points) Let
$$
f(x)=A\left(x^{2}-2 x\right) \mathrm{e}^{x}-\mathrm{e}^{x}+1 \text {. }
$$

If for any $x \leqslant 0$, $f(x) \geqslant 0$, find the range of the real number $A$.
14. (1) When $A>0$, we have
$$
\begin{array}{l}
f(x)=A\left(x^{2}-2 x\right) \mathrm{e}^{x}-\mathrm{e}^{x}+1 \\
\geqslant-\mathrm{e}^{x}+1 \geqslant 0,
\end{array}
$$

which satisfies the problem condition.
(2) When $-\frac{1}{2} \leqslant A \leqslant 0$, we have
$$
\begin{array}{l}
f^{\prime}(x)=A(2 x-2) \mathrm{e}^{x}+A\left(x^{2}-2 x\right) \mathrm{e}^{x}-\mathrm{e}^{x} \\
=\left(A x^{2}-2 A-1\right) \mathrm{e}^{x} \leqslant 0 .
\end{array}
$$

Thus, $f(x)$ is monotonically decreasing in the interval $(-\infty, 0]$. Therefore, $f(x) \geqslant f(0)=0$, which satisfies the problem condition.
(3) When $A<-\frac{1}{2}$, we have
$$
\begin{array}{l}
f^{\prime}(x)=\left(A x^{2}-2 A-1\right) \mathrm{e}^{x} \\
>0 \text{ for } x \in \left(-\sqrt{2+\frac{1}{A}}, 0\right).
\end{array}
$$

Thus, $f(x)$ is monotonically increasing in the interval $\left(-\sqrt{2+\frac{1}{A}}, 0\right)$. Therefore, $f(x)<f(0)=0$, which does not satisfy the problem condition.
In summary, the range of real number $A$ is $\left\{A \left\lvert\, A \geqslant-\frac{1}{2}\right.\right\}$.