
Hello Eric! Thank you for your reply. I have been trying to add the color and radius properties in my code but it seems that it gets overwritten because I do not see any changes when I open the molecule. With this code: ################################################################### ## Critical points idNACP = 1 mNACP = Molecule() rNACP = mNACP.newResidue("Nuclear atractors critical points", " ", 1, " ") idBCP = 1 mBCP = Molecule() rBCP = mBCP.newResidue("Bond critical points", " ", 1, " ") cpnumber = 1 cpread = 0 getcriticalpoints = osOpen(fileName) for text in getcriticalpoints: text = text.strip() if cpread == 0: if text.startswith("CP#"): readtext = text cpread = 1 elif cpread == 1: if text.startswith("Type = (3,-3)"): a,b,signature,type,atom1 = text.split() cpnum,id,a,b,x,y,z = readtext.split() x, y, z = [float(c) for c in [x,y,z]] atomNACP = mNACP.newAtom(atom1, Element("He")) atomNACP.color = chimera.MaterialColor(1,0,0,1) rNACP.addAtom(atomNACP) atomNACP.setCoord(Coord((x*0.52918), (y*0.52918), (z*0.52918))) cpread = 0 elif text.startswith("Type = (3,+3)"): print 'CCP' cpread = 0 elif text.startswith("Type = (3,+1)"): print 'RCP' cpread = 0 elif text.startswith("Type = (3,-1)"): a,b,signature,type,atom1,atom2 = text.split() cpnum,id,a,b,x,y,z = readtext.split() x, y, z = [float(c) for c in [x,y,z]] atomBCP = mBCP.newAtom("%s%s" % ("BCP", id), Element("He")) atomBCP.setCoord(Coord((x*0.52918), (y*0.52918), (z*0.52918))) rBCP.addAtom(atomBCP) cpnumber += 1 cpread = 0 mNACP.isRealMolecule = False mBCP.isRealMolecule = False ################################################################### I get an: NameError: global name 'chimera' is not defined File "/home/ros/work2/chimera-plugin/ReadAimall/__init__.py", line 54, in readAimall a.color = chimera.MaterialColor(1,0,0,1) See reply log for Python traceback. I tried adding: import chimera or add MaterialColor in: ;;;from chimera import Coord, connectMolecule, MaterialColor at the start of the code and it stills shows the default color for Helium atoms (which I am using as dummyatoms) Same thing happens with the a.radius command. Am I having the command overwritten somewhere? Thank you for your help. Rodrigo. On Thu, Jan 8, 2015 at 5:19 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
On Jan 8, 2015, at 10:46 AM, ros <rodrigogalindo@gmail.com> wrote:
Hello! I have been making progress with the extension. Now you can open the mgpviz file and the atoms will be displayed properly with their corresponding bonds in #0.1, the nuclear atractors in #0.2 and the bond critical bonds in #0.3 It works great!!
I am adding Helium atoms to represent the critical points:
atomNACP = mNACP.newAtom(atom1, Element("He")
and it works fine. Is there a way to modify the color and size of each individual atom while it is reading the input? Is it possible to modify the default properties generated from the connectMolecule() ? The idea is that it displays the original molecule (extracted from the XYZ coordinates) in wire representation, and the bond critical points in red (as an example) and the other critical points in blue. Each point group are generated in their own separate molecule with different Molecule() commands, so, is it possible to modify the visualization properties?
Yes:
a.color = chimera.MaterialColor(red, green, blue, opacity) a.radius = radius
red / green / blue / opacity all in the range 0-1.
To change to ball and stick, you would set the atoms to balls as you make them:
a.drawMode = chimera.Atom.Ball
and change all the bonds after you've called connectMolecule():
for b in m.bonds: b.drawMode = chimera.Bond.Stick
--Eric