Chemistry - Visualizing atoms in XYZ file with colors representing partial charges
Solution 1:
As far as I know, no software can do this right away but with some work, this should be possible.
Use CYLview to create a povray file, change the atoms to the desired color and render it with Povray. The problem here is that the coordinates of the xyz file and the povray are not the same. But as far as I can tell the numbering stays the same. So if the 3rd atom in your xyz is this:
N -1.227679000 0.558365000 0.000000000
the 3rd sphere in the povray file would look like that:
sphere {<-1.9762436, 0.9491377, 0.0000000> 0.2812500
pigment{color rgbt <0.4,0.4,1.0,0.00>}
finish{F_normal}
All you need to do is change the color here. It should also be pretty easy to automate this color change with some lines of code.
So you can go from this
to for example this
by simply changing the color value shown above to
pigment{color rgbt <0.2,0.8,1.0,0.00>}
Solution 2:
It's actually very easy to do this with the free visualization software OVITO (www.ovito.org), where you can color-code atoms according to any particle property you import with your structure (like in your case the partial charges).
Simply import your .xyz file with the partial charges appended as an additional column. During file import you can specify which column contains which information, e.g. positions or charge. Then use the Color Coding modifier and choose "Charge" as "Input Property". Here's the corresponding manual entry: http://www.ovito.org/manual/particles.modifiers.color_coding.html and an example of how that would look like:
Hope that helps!
Solution 3:
This is easy to do in Avogadro v1.x. For any display type, you can set the color scheme, e.g. through the settings dialog:
Then in the settings window, you pick a color scheme:
Voila, you have a molecule colored by partial charges:
If the file doesn’t come in with partial charges, you can set them via View ⇒ Properties ⇒ Atom Properties:
Solution 4:
Have you tried VMD link? It's free, up-to-date, will work with .xyz format files, and would allow you to set charge (or other property) as a color-sensitive characteristic. Here's an example using the bonding coordination (number of nearest neighbors) in a crystal (although only the surface is loaded to conserve memory)
Solution 5:
I know you asked for an xyz file, but it is no problem to convert it into a mol2 file. And from there on, you can do this using Chimera.
I take the example molecule from the linked question in the comment section to your question. The corresponding mol2 file would look something like this:
@<TRIPOS>MOLECULE
bla2.xyz
78 84 0 0 0
SMALL
GASTEIGER
@<TRIPOS>ATOM
1 N -0.2152 -3.6116 1.0137 N.2 1 UNL1 -0.980426
2 N -0.9072 -3.6634 -1.2690 N.3 1 UNL1 -1.159281
3 H -1.0201 -4.5161 -1.2392 H 1 UNL1 0.451727
4 H 0.5924 -3.5332 3.4084 H 1 UNL1 0.466050
5 H 1.1383 -4.0685 -6.6623 H 1 UNL1 0.121348
6 ZN 1.0488 0.3616 1.4618 Zn 1 UNL1 1.085568
7 C 0.8262 0.8063 4.1826 C.2 1 UNL1 0.885122
8 C 0.4171 1.4943 5.4556 C.ar 1 UNL1 -0.158259
9 C -0.1860 2.7336 5.4577 C.ar 1 UNL1 -0.038223
10 H -0.3201 3.1852 4.6583 H 1 UNL1 0.111225
11 N 3.0298 0.2152 1.0137 N.ar 1 UNL1 -0.989702
12 N 2.9780 0.9072 -1.2690 N.pl3 1 UNL1 -1.323792
13 H 2.1252 1.0201 -1.2392 H 1 UNL1 0.552920
14 H 3.1082 -0.5924 3.4084 H 1 UNL1 0.599787
15 O 0.6110 1.4120 3.0769 O.3 1 UNL1 -0.805465
16 O 1.3256 -0.3161 4.2420 O.2 1 UNL1 -0.786727
17 C -0.8262 -0.8063 -9.1420 C.2 1 UNL1 0.932072
18 C -0.4171 -1.4943 -7.8689 C.ar 1 UNL1 -0.116686
19 C 0.1860 -2.7336 -7.8668 C.ar 1 UNL1 -0.092391
20 H 0.3201 -3.1852 -8.6663 H 1 UNL1 0.116237
21 O -0.6110 -1.4120 -10.2476 O.co2 1 UNL1 -0.908737
22 O -1.3256 0.3161 -9.0825 O.co2 1 UNL1 -0.838830
23 C -0.4875 -3.0059 -0.1834 C.3 1 UNL1 1.029873
24 C 0.2178 -2.5742 1.7916 C.cat 1 UNL1 1.084450
25 N -0.2869 -1.7042 -0.1394 N.3 1 UNL1 -0.556339
26 N 0.1740 -1.4213 1.1643 N.pl3 1 UNL1 -0.669532
27 H -1.0626 -3.2357 -1.9987 H 1 UNL1 0.479136
28 N 0.5884 -2.7456 3.0646 N.pl3 1 UNL1 -1.219932
29 H 0.8222 -2.0668 3.5390 H 1 UNL1 0.535669
30 ZN -1.0488 -0.3616 -1.4618 Zn 1 UNL1 1.115312
31 C -0.8262 -0.8063 -4.1826 C.2 1 UNL1 0.930235
32 C -0.4171 -1.4943 -5.4556 C.ar 1 UNL1 -0.165126
33 C 0.1860 -2.7336 -5.4577 C.ar 1 UNL1 -0.068129
34 H 0.3201 -3.1852 -4.6583 H 1 UNL1 0.125910
35 C -3.6355 -0.4875 0.1834 C.ar 1 UNL1 1.112801
36 C -4.0672 0.2178 -1.7916 C.ar 1 UNL1 1.089920
37 N -4.9372 -0.2869 0.1394 N.ar 1 UNL1 -0.669012
38 N -5.2201 0.1740 -1.1643 N.ar 1 UNL1 -0.683650
39 N -3.0298 -0.2152 -1.0137 N.ar 1 UNL1 -1.010564
40 N -2.9780 -0.9072 1.2690 N.pl3 1 UNL1 -1.379275
41 H -3.4057 -1.0626 1.9987 H 1 UNL1 0.465316
42 H -2.1252 -1.0201 1.2392 H 1 UNL1 0.591458
43 N -3.8958 0.5884 -3.0646 N.pl3 1 UNL1 -1.359821
44 H -4.5746 0.8222 -3.5390 H 1 UNL1 0.462374
45 H -3.1082 0.5924 -3.4084 H 1 UNL1 0.595021
46 O -0.6110 -1.4120 -3.0769 O.3 1 UNL1 -0.846291
47 O -1.3256 0.3161 -4.2420 O.2 1 UNL1 -0.789904
48 C 0.4875 3.0059 0.1834 C.3 1 UNL1 1.054807
49 C -0.2178 2.5742 -1.7916 C.cat 1 UNL1 1.079690
50 N 0.2869 1.7042 0.1394 N.3 1 UNL1 -0.596520
51 N -0.1740 1.4213 -1.1643 N.pl3 1 UNL1 -0.651619
52 N 0.2152 3.6116 -1.0137 N.2 1 UNL1 -0.982105
53 N 0.9072 3.6634 1.2690 N.3 1 UNL1 -1.153898
54 H 1.0626 3.2357 1.9987 H 1 UNL1 0.472248
55 H 1.0201 4.5161 1.2392 H 1 UNL1 0.448303
56 N -0.5884 2.7456 -3.0646 N.pl3 1 UNL1 -1.192789
57 H -0.8222 2.0668 -3.5390 H 1 UNL1 0.511494
58 H -0.5924 3.5332 -3.4084 H 1 UNL1 0.458606
59 C 0.5990 -3.3114 -6.6623 C.ar 1 UNL1 -0.253677
60 C -0.7385 -0.8939 -6.6623 C.ar 1 UNL1 -0.060650
61 H -1.1769 -0.0744 -6.6623 H 1 UNL1 0.135692
62 C 0.8262 0.8063 9.1420 C.2 1 UNL1 0.921571
63 C 0.4171 1.4943 7.8689 C.ar 1 UNL1 -0.136263
64 C -0.1860 2.7336 7.8668 C.ar 1 UNL1 -0.033469
65 H -0.3201 3.1852 8.6663 H 1 UNL1 0.092701
66 O 0.6110 1.4120 10.2477 O.co2 1 UNL1 -0.900753
67 O 1.3256 -0.3161 9.0825 O.co2 1 UNL1 -0.836472
68 C -0.5990 3.3114 6.6623 C.ar 1 UNL1 -0.299314
69 H -1.1383 4.0685 6.6623 H 1 UNL1 0.134260
70 C 0.7385 0.8939 6.6623 C.ar 1 UNL1 -0.048643
71 H 1.1769 0.0744 6.6623 H 1 UNL1 0.130420
72 C 3.6355 0.4875 -0.1834 C.ar 1 UNL1 1.071205
73 C 4.0672 -0.2178 1.7916 C.ar 1 UNL1 1.085316
74 N 4.9372 0.2869 -0.1394 N.ar 1 UNL1 -0.660949
75 N 5.2201 -0.1740 1.1643 N.ar 1 UNL1 -0.672967
76 H 3.4057 1.0626 -1.9987 H 1 UNL1 0.459743
77 N 3.8958 -0.5884 3.0646 N.pl3 1 UNL1 -1.356568
78 H 4.5746 -0.8222 3.5390 H 1 UNL1 0.457166
@<TRIPOS>BOND
1 21 17 ar
2 17 22 ar
3 17 18 1
4 20 19 1
5 18 19 ar
6 18 60 ar
7 19 59 ar
8 5 59 1
9 61 60 1
10 60 32 ar
11 59 33 ar
12 33 32 ar
13 33 34 1
14 32 31 1
15 47 31 2
16 31 46 1
17 57 56 1
18 44 43 1
19 45 43 1
20 58 56 1
21 56 49 1
22 43 36 1
23 76 12 1
24 27 2 1
25 49 51 1
26 49 52 2
27 36 38 ar
28 36 39 ar
29 2 3 1
30 2 23 1
31 12 13 1
32 12 72 1
33 38 37 ar
34 51 50 1
35 39 35 ar
36 52 48 1
37 72 74 ar
38 72 11 ar
39 23 25 1
40 23 1 1
41 74 75 ar
42 25 26 1
43 50 48 1
44 37 35 ar
45 35 40 1
46 48 53 1
47 11 73 ar
48 1 24 2
49 26 24 1
50 75 73 ar
51 42 40 1
52 55 53 1
53 53 54 1
54 40 41 1
55 24 28 1
56 73 77 1
57 28 4 1
58 28 29 1
59 77 14 1
60 77 78 1
61 15 7 1
62 7 16 2
63 7 8 1
64 10 9 1
65 8 9 ar
66 8 70 ar
67 9 68 ar
68 68 69 1
69 68 64 ar
70 70 71 1
71 70 63 ar
72 64 63 ar
73 64 65 1
74 63 62 1
75 67 62 ar
76 62 66 ar
We open it with chimera and then choose Tools > Depiction > Render by Attribute
, choose the Attribute to be the charge and click on Apply
. This results in a structure that is colored by its partial charges.