Place an op amp using the input anchor’s position

circuitikzopamptikz-pgf

I have a circuit that consists of a few components, and would like to know how can I draw an op amp without knowing the center position of the op amp.

Here is the code I currently have

Note: This is extremely simplified, I have many more components in the drawing.

\documentclass{standalone}
\usepackage{circuitikz}

\begin{document}
\begin{circuitikz}[american]
    \draw (0, 0) to[R=$R_s$, *-*] ++ (0, -3) coordinate (vp) ++ (0, -3) to[zzD=$v_Z$, *-] ++ (0, 3);
    % How to initialise the op amp on the RHS of the resistor and Zener diode?
    \node[op amp, yscale=-1] (opamp) {};
    \draw (opamp.+) to[short] (vp);
\end{circuitikz}
\end{document}

Output:

Output of code.

As you can see, the op amp initialises at the origin, and vp does not go to the RHS of the node between the resistor and diode.

Here is what I would like:

Desired output.

As you can see, the "center" anchor of the op amp is unknown, so how can I initialise the op amp using the positive input anchor (which is known)?

Thanks in advance.

Best Answer

You draw the wire and then position the op-amp with the appropriate anchor:

\documentclass{standalone}
\usepackage{circuitikz}

\begin{document}
\begin{circuitikz}[american]
    \draw (0, 0) to[R=$R_s$, *-*] ++ (0, -3) coordinate (vp) ++ (0, -3) to[zzD=$v_Z$, *-] ++ (0, 3);
    % How to initialise the op amp on the RHS of the resistor and Zener diode?
    \draw (vp) -- ++(2,0) node[op amp, yscale=-1, anchor=+] (opamp) {};
\end{circuitikz}
\end{document}

enter image description here

Although is better to use

\draw (vp) -- ++(2,0) node[op amp, noinv input up, anchor=+] (opamp) {};

instead of yscale=-1, for reasons explained in the manual around page 19 (as for the current version):

enter image description here