My pymol settings (pymolrc,

 After playing with them for a long time, and struggling a bit because of the oddity of pymol that invented its own language (pymol command syntax) which is similar to Python (but not fully), I finally managed to get everything arranged such that it works without any problems. Once you have placed these files, the only thing you have to do when opening XYZ files with pymol is to type 'ms', and magic will happen. See below for the contents of the files and let me know if you have questions/comments.


The most important thing to realize is that pymol will search for a .pymolrc (notice the . in front of it) in your $HOME directory (I suppose under Windows it will also do so, but won't deal with that here since I don't have Windoze machines). This contains in my case:

#_ feedback disable,all,everything

from pymol import cmd

set antialias=2

set seq_view, off

set all_states=off

set virtual_trackball, off

set label_color, black

set label_size, 16

set label_font_id, 9

set label_position,(0,1.5,0)

set label_distance_digits, 3

set bg_rgb, [1.0,1.0,1.0]

set ray_opaque_background, 0

set ray_trace_frames=true

set movie_loop, 1

set stick_radius, 0.2

set sphere_scale=0.2

alias ms, hide; show spheres; show sticks; set all_states, off; set ray_trace_frames=false;\

  color atomic; color grey40, elem C; color gold, elem Fe; color cyan, elem Sc;\

  set sphere_scale=0.25, elem N; set sphere_scale=0.4, elem Cu; set sphere_scale=0.4, elem Fe;\

  set sphere_scale=0.4, elem Mn; set sphere_scale=0.4, elem Co; set sphere_scale=0.4, elem Ni;\

  set sphere_scale=0.3, elem Sc; set sphere_scale=0.3, elem Zn; set sphere_scale=0.4, elem Pd;\

  run ~/

This part is the essential core business of setting things up correctly, because here you can run Python code normally. Similar to .pymolrc, this should be placed as (notice the dot in front) in your $HOME directory. In my case, I want to make pymol to create all bonds between transition-metals and coordinating ligands (which I roughly define as anything smaller than 2.6 Å).

for n in cmd.get_names("objects"):

  elems = ['Cu', 'Fe', 'Co', 'Ni', 'Mn', 'Sc', 'Zn', 'Pd', 'Ru', 'Cr']

  for el in elems:

    atoms = cmd.get_model("elem "+el+" and "+n)

    for at in atoms.atom:"id "+str(at.index)+" and "+n,n+" and id "+str(at.index)+" around 2.6 and not elem H")

and that's it. Enjoy! 


Popular Posts