This is a follow up of
drawing cellulose and aligning monomers in chemfig.
I'm trying to refine the structure adding some hydrogen bonds.
No problem with the intra-chain ones, but I cannot figure out how to join atoms in two adjacent \chemfig
command.
Here you are my attempt.
Note that the red bond (emerging from OH
in C6
) is not properly placed. It should emerge from H instead than from O
.
This is another problem, but the main one is to connect the H
bonds between the two chains.
I suppose I have to manipulate the bounding boxes, but I do not have the palest idea on how to do it.
\documentclass{article}
\usepackage{chemfig}
\begin{document}
\definesubmol{180-glucoBeta}{
-[:-10,.7,,,magenta]4
(
-[:10](-[:-150,0.7]-[6,0.7]OH)
-[:-10]O(-[:50,.75])(-[:8,1.1,,,dash pattern=on 1pt off 1pt,green])
)
-[:50](-[:-170]HO)
-[:-10](-[:55,0.7]OH)
-[:10]1(-[2,0.7]H)
-[:-10,.7,,,magenta]{\color{magenta}{O}}
}
\definesubmol{glucoBeta_H_bond}{
-[:10,.7,,,magenta]4
(
-[:-10](-[:150,0.7]-[2,0.7]OH(-[:100,1,,,dash pattern=on 1pt off 1pt,red]))
-[:10]O(-[:-50,.75])(-[:-8,1.1,,,dash pattern=on 1pt off 1pt,green])
)
-[:-50](-[:170]HO(-[:-80,,,,dash pattern=on 1pt off 1pt,brown]))
-[:10](-[:-55,0.7]OH)
-[:-10]1(-[6,0.7]H)
-[:10,.7,,,magenta]{\color{magenta}{O}}
}
\chemfig[][scale=.75]{
-[:-10,.7,,,,dash pattern=on 2pt off 2pt, magenta]O
!{glucoBeta_H_bond}
!{180-glucoBeta}
!{glucoBeta_H_bond}
!{180-glucoBeta}
!{glucoBeta_H_bond}
-[:-10,.7,,,dash pattern=on 2pt off 2pt, magenta]
}
\chemfig[blue][scale=.75]{
-[:-10,.7,,,dash pattern=on 2pt off 2pt, magenta]O
!{glucoBeta_H_bond}
!{180-glucoBeta}
!{glucoBeta_H_bond}
!{180-glucoBeta}
!{glucoBeta_H_bond}
-[:-10,.7,,,dash pattern=on 2pt off 2pt, magenta]
}
\end{document}
Best Answer
connections between two molecules
If the question is how to draw connections between two molecules created with separate calls of
\chemfig
then the answer is in principle an easy one. ChemFig's molecules are TikZ pictures, really, and the atoms are nodes in this sense. As such they can be named through ChemFig's@{<node name>}
syntax and connected afterwards through some\tikz[remember picture, overlay]...;
or ChemFig's wrapper\chemmove{}
.The following example
gives after two compilations:
In your case, however, I don't think this is the best approach. In order to be able to connect the nodes they need to have unique names. If you use one node name repeatedly only the last instance is remembered:
As a consequence the method is not so nice when the nodes to be connected are hidden in repeated submols:
Finding the right atom
This addresses your second question:
ChemFig provides a solution for this. Every bond in
\chemfig{}
has an optional arguments with five parameters:The ones interesting here are
<departure>
and<arrival>
which are integers specifying the numbers of the desired departure and arrival atoms. ChemFig's manual has the following example:Proposed solution
In order to get two strands of cellulose I would suggest to save one submol of two glucoses with hydrogen bonds. Here's a possible definition using the
turned-glucoBeta
submol from my answer to the question you linked:This submol can now be used repeatedly to get the polymer:
The full code