X-Ray to Cartesian conversion
Hi All,
Few months back (Feb or March 2000) from CCL list I got some
summary for the conversion of X-ray fractional coordinates
to cartesian coordinates (which is appended below). I tried
both the programs to convert one x-ray set of data to cartesian,
but the programs could not correctly convert the data set. Of course,
the program written in fortran is specific for some space group, but I
don't know why the another program (written in C) could not work
for my molecule (it has generated some correct cartesian coordinates
and some incorrect (absurd) coordinates, as verified
>from the bond length and
bond angle values which I have with the X-ray structure),
although it worked fine for the supplied input file
with the program. Also, in my following fractional coordinate file,
obtained from Cambridge Crystallographic Data Center (CCDC),
some of the coordinates are more than 1.0, I wonder how it is possible.
To my knowledge, x-ray fractional coordinates are always less equal to
1.0 .
I have following input file whose structure should be
-CH2-C5H4N (a radical), that is in Pyridine molecule one
H is substituted by -CH2 group. I also tried Babel,
but do not know what is meant by "Free format fractional
coordinates" as mentioned in Babel Readme file. I tried
with the following fractional coordinate file as well as
by changing the format little bit but it is giving input
conversion error or something like that. Also, I have tried
with the Cambridge CCDC file (clf format)
directly as input, but could not get any result using Babel.
X-RAY DATA to CARTESIAN ANGSTROM CONVERSION
5.033 9.900 10.598 a, b, c parametrs
64.70 82.24 87.94 alpha, beta, gamma
13 No. of atoms
N1 0.8845 0.1809 0.2503
C4 0.993 0.2712 0.1233
H4 0.9185 0.3644 0.0796
C5 0.214 0.2354 1.0500
H5 0.2875 0.3048 0.9614
C6 0.3220 0.0963 1.1101
C7 1.205 0.0005 0.2443
H7 1.2721 -0.0942 0.2910
C8 0.985 0.0484 0.3076
H8 0.9056 -0.0180 0.3963
C9 0.5440 0.0441 1.0352
H9A 0.6478 0.1305 0.9652
H9B 0.6617 -0.0164 1.1024
I would highly appreciate if somebody from CCL would shed some
light on this problem. Also, I would like to know what is
meant by "free format fractional coordinate" as mentioned in
Babel Readme file.
With thanks in advance,
Dr. Tapan K. Ghanty
Scientific Officer
Chemistry Division
BARC, Mumbai 400 085, INDIA
############## appended file ##################################
----- Original Message -----
From: Scheila <scheila %-% at %-% ifi.unicamp.br>
To: <CHEMISTRY %-% at %-% ccl.net>
Sent: Thursday, February 24, 2000 9:02 AM
Subject: CCL:X-RAY - SUMMARIZED ANSWERS
>I would like to thanks all the contributions of the CClers. I'm going to
>summarize the answers received.
>Scheila
>
>___________________________________________________
>QUESTION
>
>
>I need a help to convert some x-ray data disposed in a paper. This paper
>shows the data group, the a, b and c parameters and the atomic coordinates
>in the format:
>x y z
>C1 7866(3) 3480(6) -1818(4)
>C2 7641(2) 4107(6) -2989(4)
>C3 7896(2) 5715(6) -3240(4)
>:
>:
>OMEI 9490(2) 7341(7) 3845(4)
>CMEI 9845(5) 5894(15) 3795(10)
>W1/2* 9230 923 2984
>W2/2* 8963 2070 3358
>
>
>*occupancy factor f=0.5
>
>
>______________________________________________________
>ANSWERS
>
>
>1-
>There is a good converter named BABEL or BABELWIN (for
>windows). You can convert to many file formats. I don't know
>which format you are using but what you need to know is
>name of the program you used to get the result you have given
>in your mail.
>
>You can find the program at the following site
>
>ftp://laue.chem.ncsu.edu/pub/X-ray/babel/
>
>I hope this will help you.
>
>Dr Ivan Basic
>Rudjer Boskovic Institute
>Bijenicka 54
>HR-10001 Zagreb
>CROATIA
>
>
>2-
>a very good and free program is BABEL. You can find a download site at
>http://www.eyesopen.com/download/babelwin.zip or at
>ftp://www.ccl.net/pub/chemistry/software/UNIX/babel/ (also win and mac and
>unix)
>
>It handles over 50 different formats.
>
>Find other related chemistry software in my chemistry software list (>300
in
>categories) at
>
>http://www.claessen.net/chemistry/soft_en.html
>
>Regards,
>
>Rolf Claessen
>
>3-
>It doesn't appear to be in any particular format, so it's up to you to
>put it into some machine readable format, like PDB
>
>Cambridge FDAT format has a rather complicated header, and I don't
>recommend it as a starting point, unless you have access to the CCDB
>programs and data.
>
>Since it's crystal data, the coords are probably fractional, and have an
>implied decimal point in front, e.g. 7866 is really 0.7866 (fractional
>coords are mostly less than 1.0).
>
>Rick Venable [rvenable %-% at %-% deimos.cber.nih.gov]
>
>4-
>Following is a C program that will convert crystal structure coordinates
to
>cartesians. It expects the first line to have the a, b, c axis lengths,
and
>and the alpha, beta, and gamma angles. Subsequent lines are an atom label
>and fractional coordinates. I'll include a sample input and output file
for
>comparison.
>
>--------
>acamox.abc -- input file
>--------
> 6.0690 7.5820 7.3640 84.970 79.660 114.160
> C1 .21800 .25770 .10540
> C2 .32530 .16210 -.03000
> C3 .39920 .15780 .34360
> C4 .14350 .33540 .41450
> H10 .01900 .45500 -.14400
> H21 .29300 .18400 -.14600
> H22 .26100 .01600 .01900
> H23 .50500 .20800 -.04900
> H31 .56300 .26100 .32500
> H32 .34600 .11400 .46200
> H33 .38300 .04700 .29100
> H41 0 .33200 .41000
> H42 .12700 .28800 .53900
> H43 .23600 .47000 .38700
> N1 .22880 .22820 .28880
> N2 .10890 .36370 .06280
> O1 .08840 .36910 -.12780
>--------
>acamox.xyz -- output file
>--------
>Unit cell volume = 299.2115
>C1 0.662659 1.919812 0.751155
>C2 1.431563 1.082369 -0.213801
>C3 2.387214 1.538509 2.448738
>C4 0.377954 2.859331 2.954022
>H10 -1.486982 2.960348 -1.026246
>H21 1.014250 1.083006 -1.040500
>H22 1.559471 0.135396 0.135408
>H23 2.354612 1.375188 -0.349209
>H31 3.036481 2.228242 2.316181
>H32 2.356760 1.389492 3.292541
>H33 2.563208 0.703601 2.073873
>H41 -0.488344 2.829957 2.921952
>H42 0.589466 2.693343 3.841297
>H43 0.485297 3.754710 2.758037
>N1 1.062159 1.954256 2.058194
>N2 -0.384716 2.597701 0.447557
>O1 -0.777815 2.387172 -0.910794
>--------
>abc2xyz.c
>--------
>#include <stdlib.h>
>#include <stdio.h>
>#include <strings.h>
>#include <math.h>
>
>#define MAXLINLEN 81
>#define MAXLABLEN 8
>char line [MAXLINLEN+1];
>char lab [MAXLABLEN+1];
>
>/*
>* prototype for utility routine
>*/
>char *fgetln (char *s, int n, FILE *str);
>
>/*
>* convert crystal structure fractional coordinates to cartesian
>*/
>int main (int argc, char *argv []) {
>
> double a, b, c;
> double alpha, beta, gamma;
> double z, x [2], y [3];
> double yy;
> char *tok, *sep = "\t ,";
> double degrad = M_PI / 180.0;
> double vol;
>
>/*
>* first line of input is unit cell dimensions and angles in degrees
>*/
> fgetln (line, MAXLINLEN, stdin);
> sscanf (line, "%lf %lf %lf %lf %lf %lf", &a, &b,
&c, &alpha, &beta,
>&gamma);
> alpha *= degrad;
> beta *= degrad;
> gamma *= degrad;
>
>/*
>* put 'a' along the z axis
>*/
> z = a;
>
>/*
>* put 'b' in the zx plane
>*/
> x [0] = b * sin (gamma);
> x [1] = b * cos (gamma);
>
>/*
>* <c,a> = |c| |a| cos (beta)
>* <c,b> = |c| |b| cos (alpha)
>* from this 'c' can be determined
>*/
> yy = (cos (alpha) - cos (gamma) * cos (beta)) / (sin (gamma) * sin
>(beta));
> y [0] = c * sin (beta) * yy;
> y [1] = c * sin (beta) * sqrt (1.0 - yy * yy);
> y [2] = c * cos (beta);
>
>/*
>* volume = (a X b) . c
>* with the conventions above, (a X b) is along the y axis
>*/
> vol = z * x [0] * y [1];
> printf ("Unit cell volume = %8.4lf\n", vol);
>
>/*
>* the rest of the file is lines of atom label and fractional coordinates
>*/
> while (fgetln (line, MAXLINLEN, stdin)) {
> fprintf (stderr, "%s\n", line);
> (void) strncpy (lab, strtok (line, sep), MAXLABLEN);
> tok = strtok (0, sep); a = atof (tok);
> tok = strtok (0, sep); b = atof (tok);
> tok = strtok (0, sep); c = atof (tok);
> a = a * z + b * x [1] + c * y [2];
> b = b * x [0] + c * y [0];
> c = c * y [1];
> printf ("%-8s %11.6lf %11.6lf %11.6lf\n", lab, a, b, c);
> }
>
> return 0;
> }
>
>/*
>* fgetln
>* like fgets but always reads a full line
>* newline character is never returned in s
>*/
>char *fgetln (char *s, int n, FILE *str) {
>
> int ch, nc;
>
> nc = 0;
> ch = getc (str);
> while ((ch != EOF) && (ch != '\n') && (nc < n-1)) {
> s [nc++] = (char) ch;
> ch = getc (str);
> }
> s [nc] = 0;
>
>/*
>* if EOF and no characters read, return null
>*/
> if ((ch == EOF) && (nc == 0)) s = 0;
>
>/*
>* if a newline hasn't been read, keep reading
>*/
> while ((ch != EOF) && (ch != '\n')) {
> ch = getc (str);
> }
>
> return s;
> }
>--------
>Dave Heisterberg
>
>5-
>I dont know if this helps. it depends on what software you have at
>your disposal. I've solved the same problem by writing a small
>spreadsheet program to convert from crystalographic coordinates
>to x,y,z's. Unfortunatly the one I built was specific to the molecule
>I was working on but it should be pretty trivial, its just a matrix
>multiplication. The I used Gaussian's newzmat to convert this file
>to pdf which spartan could then read.
>I dont know if this helps
>Larry Cuffe
>
>6-
>A FORTRAN PROGRAM
>
>C program convert
>
>C This program is able to convert fractional X-Ray coordinates
>C to cartesian orthonormal coordinates
>
>
>C Eduardo Lemos de Sa
>
> REAL*8 AA, BB, CC, FACTOR, ALPHA, BETHA, GAMMA
> REAL*8 XX, YY, ZZ, XXCART, YYCART, ZZCART
> REAL*8 PI
> INTEGER NCOUNT
> CHARACTER TITLE*80, ATOM*5
>C
>C FACTOR IS THE NUMBER THAT SHOULD MULTIPLIED THE FRACTIONAL COORDINATE
>
> READ(5,10) TITLE
> 10 FORMAT(A80)
> READ(5,*) AA, BB, CC, FACTOR
> 20 FORMAT(4(D14.7))
> READ(5,*) ALPHA, BETHA, GAMMA
> 30 FORMAT(3(F10.3))
> READ(5,*) NCOUNT
> 40 FORMAT(I4)
>
>C SETS THE PI (3.141592..) VALUE
> PI=4*ATAN(1.0D0)
>C
>C CONVERT THE ANGLE (DEG - > RADIAN)
>
> ALPHA=ALPHA*PI/180.0D0
> BETHA=BETHA*PI/180.0D0
> GAMMA=GAMMA*PI/180.0D0
>
> WRITE(6,40) NCOUNT
> WRITE(6,10) TITLE
>C
> 150 FORMAT(A2, 3F10.5)
>C BEGINS THE READ DATA INPUT (TITLE)
>
> DO 100 J=1,NCOUNT
>
> READ(5,150) ATOM, XX, YY, ZZ
> XX=XX*AA*FACTOR
> YY=YY*BB*FACTOR
> ZZ=ZZ*CC*FACTOR
> XXCART=XX+YY*COS(GAMMA)+ZZ*COS(BETHA)
> YYCART=YY*SIN(GAMMA)-ZZ*SIN(BETHA)*COS(ALPHA)
> ZZCART=ZZ*SIN(BETHA)*SIN(ALPHA)
> WRITE(6,150) ATOM, XXCART, YYCART, ZZCART
>
> 100 CONTINUE
>
> STOP
> END
>
>
>
>
> INPUT MODEL
>Dados provenientes do raios-X de Giovana - dimero Ti
>10.8611 10.5932 15.3648 1.000D-4
>90.000 102.826 90.000
>4
>ti 1139.0 967.0 346.0
>cl 3057.0 546.0 1406.0
>o 388.0 -794.0 596.0
>o 304.0 1635.0 1170.0
>
>
>OUTPUT MODEL
> 4
>Dados provenientes do raios-X de Giovana - dimero Ti
>ti 1.11906 1.02436 .51836
>cl 2.84067 .57839 2.10639
>o .21812 -.84110 .89289
>o -.06889 1.73199 1.75283
>
>
>EDUARDO LEMOS DE SÁ
>
>
>
************************************************************************
Dr. Tapan K. Ghanty
Theoretical Chemistry Section
Chemistry Division
Bhabha Atomic Research Centre
Trombay, Mumbai 400 085
India
Phone: 550 5050, 550 5010, 550 5000, 556 3120
Extn. 2675
-----------------------------------------------------------------------