And then comes the Gaussian Z-matrix in either compact or full form.Next line again must be absolutely empty.Next line can contain anything You want.First line of the file must begin with a hash sign (#) – a substitute for the Route line.What does OpenBabel require for conversion: One can see them by pressing the button with a paragraph sign (¶) on it in Your favourite text editor ( Notepad++, or even MS Word or LibreOffice Writer), or by entering :set list in vim or M-x whitespace-mode in Emacs. In my case, this was the blank line between the route and the title line. Turns out that OpenBabel is sensitive to whether blank lines are really blank lines or lines with space characters only. I sincerely don't know whether this question belongs better to the Chemistry StackExchange or to other forum, but I presume the question might appear to be useful for someone someday. This is OpenBabel version 2.4.1 on Debian 10. H2O2 H2O2 GeometryOptimization GeomOpt GeometryOptimization 1 The file which fails to convert: #T HF/3-21G Opt Integral(Grid=SG1) This can be used to perform read subsampling analyses, (though generally the subsample function. The file which converts without any problem: # This is a dummy route line, required for OpenBabel for the conversion Generate a subsampled matrix from an original count matrix. Some other file was converting just fine, with no obvious differences between their contents! I spent a long time trying to understand what is wrong with the second file, but to no avail. OpenBabel::Read molecule Gaussian Z-Matrix Input *** Open Babel Audit Log in ReadChemObjectImpl The problem is that probably major flaw of OpenBabel are very terse error messages (mostly just " 0 molecules converted", and even with -errorlevel 25 option I got only: = Constructs a spatial weights matrix file (.swmb) which is used for expressing the spatial relationships between each elements. The bond vector definition is here: def get_bond_vector(r, a, t):Īgain, the only part I don't understand is # get local axis system from 3 coordinates.I ran into an issue when OpenBabel (a great and extremely useful problem) could not convert my custom-generated Gaussian Z-matrix to XYZ format. Here is some context of how this function is used: bond_vector = get_bond_vector(atom.rval, atom.aval, al)ĭisp_vector = np.array(np.dot(bond_vector, _axes))Ītom.coords = + disp_vector What is "getting local axis system from 3 coordinates"? U23c21 = get_ucp(u23, u21) # unit cross product Print('\nError: Co-linear atoms in an internal coordinate definition') U23 = get_u12(coords2, coords3) #calculating vector between that points 2-3 U21 = get_u12(coords1, coords2) #calculating vector between that points 1-2 However, in his work, there is a mathematical part that I don't understand: # get local axis system from 3 coordinatesĭef get_local_axes(coords1, coords2, coords3): While searching I found TMPChem's work on GitHub and it does exactly what I want. What is it you are planning on doing with the molecule If you are going to do a geometry optimization for the ground state, then it would be a good idea to enforce symmetry. Sometimes it is a good idea to think before attempting to write a Z-matrix. If there aren't any mistakes up to this point, how I will calculate Cartesian coordinates of the 4th atom using these $x,y,z$ values? We will show a few simple examples of how to make Z-matrices in this text. To calculate $x,y,z$ values from the formulas x = r * sin(theta) * cos(phi) I am not sure if I should calculate this as z2 + s(angle) or z2 - s(angle) and what it depends on, if both are possible.įor the 4th atom, I use spherical coordinates r, theta, phi = (0.976, 96.572, -179.995) The 3rd atom must have coordinates that are something like this if read correctly: 3 H 0 distance*sin(angle) z2+distance*cos(angle) How should I treat the 3rd and 4th atoms? My question is after setting first atom as 0,0,0 1 O 0 0 0Īnd the second one as 0,0,(distance from first) to put it on the z-axis 2 O 0 0 1.45335189476 This is converting a Z-matrix to Cartesian coordinates. Now I need to perform the reverse operation and use this Z-matrix as input and define $x,y,z$ coordinates for each atom. If one has Cartesian coordinates for the RDKit molecule, one can also generate the Z-Matrix coordinates or convert the Z-Matrix coordinates back to Cartesian coordinates. Then, the script constructs a Z-matrix with them, like this: Z-mat : setup.py README.md Z-matrix conversion with RDkit molecules With this little python implementation, RDkit molecules can be converted to a Z-Matrix topology representation. These are $x,y,z$ coordinates of H2O2 molecule. To begin with, I wrote a script that gets Cartesian coordinates of molecule as input in the below.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |