# Can't draw the loop by using feynmf-auto package

I've tried to draw the vacuum polarization diagram by using feynmf-auto package. Here is the code which I've used:

\begin{fmffile}{45}
\begin{fmfgraph}(200,200)
\fmfleft{i,v1}
\fmfright{v2,o}
\fmf{photon,tension=5}{i,v1}
\fmf{fermion,tension=5}{v1,v2,v1}
\fmf{photon,tension=5}{v2,o}
\end{fmfgraph}
\end{fmffile}

However, instead of desired result, I obtain following:

There are a couple of issues with your code:

First: you don't need to anchor v1 and v2, let feynmp position them.

Secondly, the tension options aren't helping you here. In general there's no point setting the tension the same for all lines; it has the same effect as not setting it all.

This gives you:

\documentclass{article}
\usepackage{feynmp-auto}
\begin{document}
\begin{fmffile}{45}
\begin{fmfgraph*}(200,200)
\fmfleft{i}
\fmfright{o}
\fmf{photon}{i,v1}
\fmf{fermion}{v1,v2,v1}
\fmf{photon}{v2,o}
\end{fmfgraph*}
\end{fmffile}
\end{document}

but this produces:

which isn't quite what you want. To get the fermion to curve, you need to tell it to bend left with the left option. Like this:

\fmf{fermion,left=1}{v1,v2,v1}

Adding this option produces a better result:

Except that there is still a lot of white space above and below, and the photons are too long. You can fix this by adjusting the shape of the figure you start with and increasing the tension on the photons so they get shorter. Here's the finished article.

And the code to produce it.

\documentclass{article}
\usepackage{feynmp-auto}
\begin{document}
\begin{fmffile}{45}
\begin{fmfgraph*}(233,144)
\fmfleft{i}
\fmfright{o}
\fmf{photon,tension=3}{i,v1}
\fmf{fermion,left=1}{v1,v2,v1}
\fmf{photon,tension=3}{v2,o}
\end{fmfgraph*}
\end{fmffile}
\end{document}

Although you mention using feynmf/feynmp, I'll provide an answer that uses another package: TikZ-Feynman (CTAN). Don't feel obliged to accept this answer if you need to use feynmf/feynmp.

In TikZ-Feynman, this can be achieved with:

\feynmandiagram [layered layout, horizontal=b to c] {
a -- [photon] b
-- [fermion, half left] c
-- [fermion, half left] b,
c -- [photon] d,
};

and if you wanted to add momentum arrows, you can do this quite simply with:

\feynmandiagram [layered layout, horizontal=b to c] {
a -- [photon, momentum=$$p$$] b
-- [fermion, half left, momentum=$$p+k$$] c
-- [fermion, half left, momentum=$$k$$] b,
c -- [photon, momentum=$$p$$] d,
};

The full example is:

\documentclass[tikz]{standalone}

\usepackage[compat=1.1.0]{tikz-feynman}

\begin{document}
\feynmandiagram [layered layout, horizontal=b to c] {
a -- [photon] b
-- [fermion, half left] c
-- [fermion, half left] b,
c -- [photon] d,
};

\feynmandiagram [layered layout, horizontal=b to c] {
a -- [photon, momentum=$$p$$] b
-- [fermion, half left, momentum=$$p+k$$] c
-- [fermion, half left, momentum=$$k$$] b,
c -- [photon, momentum=$$p$$] d,
};
\end{document}