不同颜色的化学制品

不同颜色的化学制品

我正在尝试获取以下化学结构

在此处输入图片描述

我看到了这个,但我无法将其应用于我的情况。有人有解决方案吗?以下是我的 MWE:

\begin{tikzpicture}
\node (mol) at (0, 0){%
    \chemfig{
        [:0] H_2N
        -[::+30,2]
        -[::-60]
        -[::+60] \chemabove{N}{H}
        -[::-60]
        -[::+60]
        -[::-60] N (%-> START BRANCH 1
            -[::-60]
            -[::-60]
            -[::+60]
            NH -[::-60]
            -[::+60]
            -[::-60,,1,2]
            H_2N
            )%-> FINISH BRANCH 1
        -[::+60]
        -[::-60]
        -[::+60] N (%-> START BRANCH 2
            -[::+60]
            -[::-60]
            -[::+60] N (%-> START BRANCH 2.1
                -[::+60]
                -[::+60]
                -[::-60,,1,2] H_2N
                )%-> FINISH BRANCH 2.1
            -[::-60]
            -[::+60]
            -[::-60] NH_2
            )%-> FINISH BRANCH 2
        -[::-60]
        -[::+60]
        -[::-60] N (%-> START BRANCH 3
            -[::+60]
            -[::-60]
            -[::+60,2] NH_2
            )%-> FINISH BRANCH 3
        -[::-60]
        -[::+60]
        }
    };

\node[red] (per) at (2.2, -2.9){%
    \chemfig{
        -[::-90] N *6(% start ring 1
            -(=O)
            -*6(% start ring 2-left
                -
                =
                - *6(% start ring 3
                    - *6(% start ring 4-left
                        =
                        -
                        = *6(% start ring 5
                            - (=O)
                            - \chembelow{N}{R}
                            - (=O)
                            -
                            -
                            -
                            )% finish ring 5
                        -
                        -
                        -
                        )% finish ring 4-left
                    - *6(% start ring 4-right
                        =-=-=-
                        )% finish ring 4-right
                    -
                    -
                    -
                    -) % finish ring 3
                =
                -
                =
                ) % finish ring 2-left
            -*6(--=-=-) % ring 2-right
            -
            -(=O)
            -
            )% finish ring 1
        }
    };


%--> DRAW THE BRACES
%... define the braces sizes and positions
\def\bracew{ 0.2em} % brace width
\def\braceh{ 4.0em} % brace height
\def\bracex{11.5em} % brace x-position
\def\bracey{-1.5em} % brace y-position

%... draw right brace
\begin{scope}[xshift=-\bracex, yshift=\bracey]
    \draw[thick]
        (\bracew, 0)--
            (0, 0)--
            (0, \braceh)--
            (\bracew, \braceh)
        ;
\end{scope}

%... draw left brace
\begin{scope}[xshift=\bracex, yshift=\bracey]
    \draw[thick]
        (-\bracew, 0)--
            (0, 0)
            node[right]{$n$}--
            (0, \braceh)--
            (-\bracew, \braceh)
        ;
\end{scope}
\end{tikzpicture}

答案1

\documentclass{article}
\usepackage{chemfig}
\setchemfig{atom sep=2em, angle increment=30}
\def\RED{\gdef\printatom##1{\color{red}\ensuremath{\mathrm{##1}}}}
\def\BLACK{\gdef\printatom##1{\color{black}\ensuremath{\mathrm{##1}}}}
\definesubmol{red}{(-[,,,,draw=none]\RED)% start red atoms (global)
    ([,,,,red]% start red bonds (only between the parentheses of the submole)
    -[9]N
    *6(% start ring 1
    -(=O)
    -*6(% start ring 2-left
    -
    =
    - *6(% start ring 3
    - *6(% start ring 4-left
    =
    -
    = *6(% start ring 5
    - (=O)
    - \chembelow{N}{R}
    - (=O)
    -
    -
    -
    )% finish ring 5
    -
    -
    -
    )% finish ring 4-left
    - *6(% start ring 4-right
    =-=-=-
    )% finish ring 4-right
    -
    -
    -
    -) % finish ring 3
    =
    -
    =
    ) % finish ring 2-left
    -*6(--=-=-) % ring 2-right
    -
    -(=O)
    -
    ))% finish ring 1
    \BLACK}
\begin{document}
\chemfig{
    H_2N
    -[@{op,0.5}1,2]
    -[11]
    -[1]\chemabove{N}{H}
    -[11]
    -[1]
    -[11]N(-[9]-[7]-[9]NH-[7]-[9]-[7]H_2N)
    -[1]
    -[11]
    -[1]N(-[3]-[1]-[3]N(-[5]-[7]-[5]H_2N)-[1]-[3]-[1]NH_2)
    -[11]
    -[1]
    -[11]N(-[9]-[11]!{red})
    -[1]
    -[11]
    -[@{cl,0.5}1,2]NH_2
    }
\polymerdelim[
    delimiters ={[]},
    height = 5ex,
    depth = 3.5ex,
    indice = n
    ]
    {op}{cl}
\end{document}

在此处输入图片描述

相关内容