Re: [chimera-dev] AIMAll extension update 1

Hi Rodrigo, I covered this in my initial, novella-length response: Fake Atoms In this scenario, you would create a second Molecule as you read the file and add the critical points as atoms to that. You include the additional Molecule in the list of models you return ("return [m, m2]"). You would not call connectMolecule() on the second Molecule, but might add pseudobonds from the critical points to the appropriate atoms (you can't add regular bonds between models). The second molecule will have the same ID and sub-ID # as the first one, and will move in tandem with it. It will show up in the model panel. There really is no such thing as a fake Molecule per se. You just use the Molecule class in exactly the same way as for a normal molecule. It's just that what you're trying to depict isn't an actual chemical entity. One thing I probably should have added, is that for the "fake" Molecule that will hold the critical points you should set the attribute "isRealMolecule" to False, like so: m2.isRealMolecule = False This will prevent the critical-points Molecule from being listed in various interfaces that really only want to list actual chemical entities (e.g. the Minimize interface). --Eric On Jan 7, 2015, at 11:59 AM, ros <rodrigogalindo@gmail.com> wrote:
That did the trick, the bonds are now correctly being displayed! Thank you!
Could you please provide an example for drawing or placing a fake atom? I do not seem to find the correct command in the Programmers manual.
Thank you again,
Rodrigo.
On Wed, Jan 7, 2015 at 12:50 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
On Jan 7, 2015, at 11:45 AM, Eric Pettersen <pett@cgl.ucsf.EDU> wrote:
So I guess the question is: what is up with the AIMAll coordinates?
I see. AIMAll units are bohrs. So you need to multiply by 0.52918.
--Eric

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? Thank you! Rodrigo. On Wed, Jan 7, 2015 at 2:01 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
Hi Rodrigo, I covered this in my initial, novella-length response:
Fake Atoms In this scenario, you would create a second Molecule as you read the file and add the critical points as atoms to that. You include the additional Molecule in the list of models you return ("return [m, m2]"). You would not call connectMolecule() on the second Molecule, but might add pseudobonds from the critical points to the appropriate atoms (you can't add regular bonds between models). The second molecule will have the same ID and sub-ID # as the first one, and will move in tandem with it. It will show up in the model panel.
There really is no such thing as a fake Molecule per se. You just use the Molecule class in exactly the same way as for a normal molecule. It's just that what you're trying to depict isn't an actual chemical entity. One thing I probably should have added, is that for the "fake" Molecule that will hold the critical points you should set the attribute "isRealMolecule" to False, like so:
m2.isRealMolecule = False
This will prevent the critical-points Molecule from being listed in various interfaces that really only want to list actual chemical entities (e.g. the Minimize interface).
--Eric
On Jan 7, 2015, at 11:59 AM, ros <rodrigogalindo@gmail.com> wrote:
That did the trick, the bonds are now correctly being displayed! Thank you!
Could you please provide an example for drawing or placing a fake atom? I do not seem to find the correct command in the Programmers manual.
Thank you again,
Rodrigo.
On Wed, Jan 7, 2015 at 12:50 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
On Jan 7, 2015, at 11:45 AM, Eric Pettersen <pett@cgl.ucsf.EDU> wrote:
So I guess the question is: what is up with the AIMAll coordinates?
I see. AIMAll units are bohrs. So you need to multiply by 0.52918.
--Eric

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

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

On Jan 9, 2015, at 9:18 AM, ros <rodrigogalindo@gmail.com> wrote:
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 dummy atoms)
you need either: import chimera a.color = chimera.MaterialColor(1,0,0,1) or: from chimera import MaterialColor a.color = MaterialColor(1,0,0,1) You might be well served by perusing the Python tutorial: The Python Tutorial — Python 2.7.9 documentation Ah, it also occurs to me that you have to prevent Chimera from trying to "smart display" your fake molecule, which will change colors and display. Do that by setting the "noprefs" attribute to True, in analogous fashion to isRealMolecule: mNACP.noprefs = True mBCP.noprefs = True
Same thing happens with the a.radius command.
Really? A NameError? What did that code look like? --Eric
participants (2)
-
Eric Pettersen
-
ros