From a structure representation like the one below for Bacteriochlorophyll A, how do I make the ZMAT or XYZ file? The closest similar question asked here was about converting a PDB entry into XYZ, but what I have here is not in PDB format, it is just the image of the molecular structure, reported in a paper.
I know of two three ways to do this, but in either case it's quite a bit of work since I don't know any software that can read molecular structures from pictures. The second and third way use freeware only.
Draw the structure in Chem3D. For whatever stupid reason Chem3D doesn't support xyz files but you can save as
*.pdb. If you need
- save as Gaussian input
- delete the first 3 lines
- Put the total number of atoms in the resulting first line
- remove any "atoms" labeled as LP (lone pair, Chem3D uses them for force field optimization)
- remove the second column next to the elemental symbol (if you sue Notepad++ you can select that by using ALT)
- change file extension
Use openbabel 2.2.0 or higher to convert SMILES into
*.pdbusing the "gen3d" keyword. Of course for this you need the SMILES so you either have to produce that yourself or you need to draw it in a software that is able to produce SMILES like, again, Chem3D or this free website
It turns out this NIH website is also able to produce 3D structures, also in pdb file format, directly from SMILES or drawing the structure in their editor.
Building such large structures can be a nasty task, and as it is quite large, you can easily loose track of parts of it. You should try a couple of molecular editors and find something you are comfortable with, then editing molecules becomes something routine and even a large one like your example is less tedious.
Apart from this very general advice, here are some additional tips. Like DVSA states there are some more or less tedious ways to do it. The most error-prone is obviously trying to build them one atom at the time. That is not only hard work, but it also consumes a lot of time. Using smaller (pre-optimised) fragments can help a lot. Obviously you'll need a molecular editor capable of merging/joining structures.
Probably the best way to built a structure from scratch is to start from something you know, like a literature known structure of a derivative, or a substructure from a database. Unfortunately conversion from InChI or SMILES with open babel does not always work as you might intend it to, especially in those cases, where the SMILES or InChI becomes ambiguous.
Let's take a look at your example: Bacteriochlorophyll A. It is easy enough to find on PubChem, where they provide you with an InChI, and some SMILES.
If you try to convert the following to a 3D structure with openbabel 2.4.1, you will get an error, and I assume this is due to the fact that there are essentially two entities stored in the InChI (the dot
. separates those entities).
I have executed open babel with the following command, where the above InChI was stored in
obabel -iinchi structure.inchi -oxyz -Ostructure.xyz --gen3d
The result is breathtakingly awful, and I am probably going to file a bug-report later on. The full output is:
*** Open Babel Warning in InChI code For InChI=1S/C55H75N4O6.Mg/c1-13-39-34(7)41-29-46-48(38(11)60)36(9)43(57-46)27-42-35(8)40(52(58-42)50-51(55(63)64-12)54(62)49-37(10)44(59-53(49)50)28-45(39)56-41)23-24-47(61)65-26-25-33(6)22-16-21-32(5)20-15-19-31(4)18-14-17-30(2)3;/h25,27-32,34-35,39-40,51H,13-24,26H2,1-12H3,(H-,56,57,58,59,60,62);/q-1;+2/p-1/b33-25+;/t31-,32-,34-,35+,39-,40+,51-;/m1./s1 Problems/mismatches: Mobile-H( Hydrogens: Number; Mobile-H groups: Number; Charge(s): Do not match) 1 molecule converted
The magnesium is somewhere, and the porphyrin ring is all crooked; that does not help at all. (I have also tried SMILES, but that did not work any better.) In some cases you might be luckier, so that approach is something to keep in mind.
I tried the NIH website as DVSA suggested, and apart from the manganese being somewhere, that worked reasonably well. (If you try this approach then you can skip the next sections.)
If you have accesses to the ChemOffice suite things may become a little easier. Copy the InChI into the paste buffer, open ChemDraw, choose Edit > Paste Special > InChI. You will hopefully see something like the Lewis-like structure from your post then. You will need to clean it up a little, you should definitely delete the metal. Now copy the cleaned structure into the paste buffer and open Chem3D. On the right side you should have the ChemDraw - LiveLink, where you can paste your structure. This will create a 3D image on the main screen. I have tried it with the example molecule and it worked reasonably well. (I can only recommend this for organic molecules.) You can already use the implemented force field to optimise it (and you should). Depending on what molecule you are doing, there might be parameters missing (mostly metals, very heavy atoms), charges wrong applied, or other problems. It is basically trial and error, it might not always lead to a success.
Safe the resulting file as something another molecular editor can open. Since ChemOffice handles even common file formats badly, I recommend
pdb as the best (still bad) option. (I should really try MarvinSketch or similar software.) It still produces plenty of warnings in open babel, which can mysteriously still recover most of it, and you'll have a somewhat reasonable structure to riff off on.
I was unable to open the
pdb directly with molden (unrecognised elements, probably bad formatting), but it was no problem reading it with Chemcraft (payware). Since Avogadro (open source) works on top of open babel, I assume it should be able to read the file, too.
If you edit molecules a lot I recommend spending some money on Chemcraft (that is my personal preference, but I am not affiliated with it), in my experience it is one of the best molecular editors. It has a rather extended fragments database (which you can customise), that may even take care of 'clicking together' a rather huge molecule. It comes with some more nice features, but things like that are better discussed in chat. (I have used it occasionally on the site, so you might find some interesting showcases here, too.) Some people love their GaussView, but I simply cannot see the appeal of that program.
Obviously you can use open babel to transform even the garbage
pdb to a xyz file, which you then can view/edit with molden. Unfortunately the
zmat interface of molden is quite tedious, but it comes with a few pre-built fragments which makes extending molecules easier. The most tedious thing about that program is, that it does not support drag and drop. In the ZMAT Editor there is an option called 'substitute atom by fragment', I suggest you give that a look. (Chain-like organics can be easily prepared with that starting from methane.)
I believe Avogadro also has a fairly sophisticated molecular editing tool, however I currently have no access to it, so I can't really comment.
There is no harm in trying a few molecular editors and sticking with what works best for you.
Eventually you should have a somewhat good structure to start a calculation on. Keep in mind that whatever you created is only one conformation and likely not the minimum structure. You should use conformation generators to test whether what you have is good or bad.
I have developed a preference for GFN2-xTB from Stefan Grimme's group (semi-empirical program package capable of optimising largen structures) for these tasks.