Primitivity of subgroups in the Picard groups of anticanonical $K3$ surfaces Let $X$ be a smooth projective threefold with $h^{0,1}(X) = h^{0,2}(X)=0$ that has a smooth anticanonical section $D$.
Then $D$ is necessarily a $K3$ surface. 
Consider a subgroup
$$Pic_X(D) = i^*(Pic(X))$$ 
of $Pic(D)$, where $i:D \hookrightarrow X$ is the inclusion map. 
I tried several examples of $X$, including some blow-ups of toric Fano threefolds and found that $Pic_X(D)$ is a primitive subgroup of $Pic(D)$(i.e. the quotient $Pic(D) / Pic_X(D)$ has no torsion)
Is it generally true or are there any counterexamples? 
If $X$ is a smooth Fano threefold, then it is obvious but I am not sure about the general cases.
 A: I think the following may give an example $X$ where the image of the map in question is not primitive.
Let $S$ be the blow-up of $\mathbb{P}^2$ in 9 points that are the intersection of two cubics (so $|{-}K_S|$ is an elliptic pencil). Let $Y \subset \mathbb{P}^1 \times S$ be a general element of $|2H -2K_S|$, for $H$ the hyperplane class of $\mathbb{P}^1$. The linear system is base-point-free, so $Y$ can be taken to be smooth. Let $X$ be the double cover of $\mathbb{P}^1 \times S$ branched over $Y$.
Then anticanonical divisors $D$ of $X$ are double covers of $S$, branched over an element of $|{-}2K_S|$, so $D$ is a K3 with non-symplectic involution whose fixed set is a disjoint union of two elliptic curves. According to Nikulin's classification, the invariant part $N \subset H^2(D)$ (which is generically equal to $\mathrm{Pic}(D)$) is a rank 10 even lattice with signature (1,9), discriminant group $N^*/N \cong (\mathbb{Z}/2)^8$ and alternating discriminant form (in the sense that $t^2 \in \mathbb{Z}$ for every $t \in N^*$). (In other words $N$ is isometric to $2E_8 \oplus U$.) The image $N'$ of the pull-back of the projection $D \to S$ is a sublattice of $N$, with $N' \cong 2H^2(S)$. So $(N')^*/N' \cong (\mathbb{Z}/2)^{10}$, and $N'$ must be an index 2 sublattice of $N$. Concretely, $-K_S$ is a primitive element of $H^2(S)$ whose image in $H^2(D)$ is even.
Meanwhile, I think that one can prove that the pull-back map $H^2(\mathbb{P}^1 \times S) \to H^2(X)$ is an isomorphism. Consider the projectivisation $Z$ of the rank 2 bundle $-K_S \oplus \underline{\mathbb{C}}^2$ over $S$ (so $\pi : Z \to S$ is a $\mathbb{P}^2$-bundle), and let $T$ be the tautological line bundle over $Z$. Then $X$ can be viewed as an element of the linear system $|{-}2T -2 \pi^*(K_S)|$, and I think one can apply a version of the Lefschetz hyperplane theorem (Goretsky-MacPherson or de Cataldo-Migliorini) to show that $H^2(Z) \to H^2(X)$ is an isomorphism.
If correct, this means that the image of $H^2(X) \to H^2(D)$ equals $N'$, so isn't primitive in $H^2(D)$.
Edit: Here is a rather easier example. Fix a line in $\mathbb{P}^3$, and consider a generic quartic K3 $D$ containing that line. Its Picard lattice is generated by the hyperplance class $H$ and by the Poincare dual $L$ to the line, and is isometric to
$$ \begin{pmatrix} 4 & 1 \\ 1 & -2 \end{pmatrix}  $$
Now take a class like $5H+2L$, which is ample. Thus $|5H+2L|$ contains a smooth curve $C$. Let $X$ be the blow-up of $\mathbb{P}^3$ in $C$. The proper transform of $D$ in $X$ is isomorphic to $D$, and is an anticanonical divisor of $X$. The image of $H^2(X) \to H^2(D)$ is generated by $H$ and the Poincare dual to $C$ (i.e. $5H+2L$), so is not primitive.
