| 1 |
<?xml version="1.0" ?> |
| 2 |
<!DOCTYPE html |
| 3 |
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
| 4 |
"DTD/xhtml1-strict.dtd"> |
| 5 |
|
| 6 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
| 7 |
<head> |
| 8 |
<link href="css/style.css" rel="stylesheet" type="text/css"/> |
| 9 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> |
| 10 |
<title>Creating custom templates</title> |
| 11 |
</head> |
| 12 |
<body> |
| 13 |
<h2>How to create a custom template</h2> |
| 14 |
|
| 15 |
<h3>Foreword</h3> |
| 16 |
|
| 17 |
<p>Even if the possibility to create custom templates in BKChem existed from the version 0.1.0, there was no way |
| 18 |
how to actually use them afterwards and therefore it was not documented. Starting from BKChem version 0.9.0-pre1 a special mode |
| 19 |
for custom templates was added and here is the documentation how to use it.</p> |
| 20 |
|
| 21 |
<h3>How to do it?</h3> |
| 22 |
<p>Creating a new template is straightforward and easy, however not so easy as you might think :). |
| 23 |
Even if it would be possible for the program to guess how to attach the template to another molecule |
| 24 |
when you use it, I did not implement anything like this, because explicit is usually better than |
| 25 |
implicit. Therefore you have to tell BKChem which position you would like to use for attaching a template |
| 26 |
to a new molecule and which bond should be used when you click on a bond in an existing molecule.</p> |
| 27 |
|
| 28 |
<p>I will demonstrate the process on creating a template of naphthalene-2-yl. To do so, you have to draw naphthalene |
| 29 |
and then add a substituent (usually methyl but it does not matter as this atom is ignored) to the position |
| 30 |
you would like this template to connect with. In this case to the position 2.</p> |
| 31 |
|
| 32 |
<!--<img src="../img/custom_templates-1.png" alt="screenshot 1"/>--> |
| 33 |
|
| 34 |
<p>Now we have to tell BKChem which atom is the <i>template atom</i> - the atom that marks the position of |
| 35 |
molecule concatenation. To do it, you have to switch to the <i>template mode</i> (click on the |
| 36 |
cyclohexane icon in the upper button menu), focus the atom you want to mark (put the cursor above it so |
| 37 |
that a circle appears around it) and hit the keys <b>C-t</b> (press <b>t</b> while holding the |
| 38 |
<b>Control</b> key). In the status bar a message "<i>focused atom was marked template atom</i>" |
| 39 |
should appear.</p> |
| 40 |
|
| 41 |
<p><b>NOTE:</b> The <i>template atom</i> is deleted when you use the template, it serves only |
| 42 |
as a marker to precisely specify the direction and distance in which to place the template.</p> |
| 43 |
|
| 44 |
<img src="img/custom_templates-2.png" alt="screenshot 2"/> |
| 45 |
|
| 46 |
<p>Now we have to specify the bond that will be used when you want to add the template to a bond and not to an atom |
| 47 |
(as for instance when you create the naphthalene molecule from 2 benzene molecules). The procedure is the same as for an atom, |
| 48 |
however in this case the bond really exists in the molecule and is not deleted when the template is used. You have to <i>focus</i> |
| 49 |
the bond in <i>template mode</i> and hit <b>C-t</b>. You will get a message informing you that the focused bond was marked |
| 50 |
as <i>template bond</i>.</p> |
| 51 |
|
| 52 |
<p>Now, as the access points of the template are defined, only one thing remains to be done and this is to name your template. |
| 53 |
You can do it by selecting the molecule or any part of it and using the <i>Menu/Chemistry/Set molecule name</i> command. Under this name you |
| 54 |
will be able to access the prepared template.</p> |
| 55 |
|
| 56 |
|
| 57 |
<p>The only thing that remains now, is to store the newly created template in a directory where BKChem can find it. |
| 58 |
This directory is site-dependent - on Unix systems its <i>~/.bkchem/templates/</i> on Windows <i>.bkchem/templates</i> in |
| 59 |
the directory where BKChem is installed. You can do it either by hand, or use the command <i>Save As Template</i> in the |
| 60 |
<i>File</i> menu, which will also check the content of the file and warn you when there is some problem with your template(s).</p> |
| 61 |
|
| 62 |
<p>Now, when everything went OK, you can restart BKChem and you should see your newly created templates in the menu of the |
| 63 |
<i>Custom templates mode</i>.</p> |
| 64 |
|
| 65 |
<h3>Last word</h3> |
| 66 |
|
| 67 |
<p>I welcome any suggestions and bug reports related to this text, the procedures described here or BKChem in general |
| 68 |
on my <a href="mailto:[email protected]">email address</a>.</p> |
| 69 |
|
| 70 |
</body> |
| 71 |
</html> |