<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Feb 22, 2008, at 7:59 AM, Jean-Didier Maréchal wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Monaco" size="4" style="font: 14.0px Monaco">Hi again,</font></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Monaco; min-height: 19.0px"><br></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Monaco" size="4" style="font: 14.0px Monaco">that follows an e-mail exchange with Eric a while ago.<span class="Apple-converted-space"> </span></font></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Monaco; min-height: 19.0px"><br></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Monaco" size="4" style="font: 14.0px Monaco">I am trying to place a given atom (for the moment, helium is fine) to</font></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Monaco" size="4" style="font: 14.0px Monaco">given x,y,z coordinates. You told me that the new BuildStructure module</font></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Monaco" size="4" style="font: 14.0px Monaco">could do that, unfortunately after having imported the module</font></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Monaco" size="4" style="font: 14.0px Monaco">import BuildStructure</font></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Monaco" size="4" style="font: 14.0px Monaco">when I do<span class="Apple-converted-space"> </span></font></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Monaco" size="4" style="font: 14.0px Monaco">BuildStructure.placeHelium(res,model=0,position=13.2909,75.4474,25.4248)</font></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Monaco" size="4" style="font: 14.0px Monaco">I have<span class="Apple-converted-space"> </span></font></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Monaco" size="4" style="font: 14.0px Monaco">SyntaxError: non-keyword arg after keyword arg</font></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Monaco" size="4" style="font: 14.0px Monaco">I tried different argumentations of this but I can't have it working, if</font></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Monaco" size="4" style="font: 14.0px Monaco">you can tell me how to do this, that would be perfect.</font></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Monaco; min-height: 19.0px"><br></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Monaco" size="4" style="font: 14.0px Monaco">All the best,</font></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Monaco" size="4" style="font: 14.0px Monaco">JD</font></p> </blockquote><br></div><div>Hi JD,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>The are a few things wrong with your placeHelium() call, some of them due to incorrect Python syntax (thereby producing the SyntaxError) and some from not providing the kind of input the routine expects. They are actually interrelated in your case.<br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>As mentioned in the doc string for the placeHelium() function, the 'model' argument has to be a string or a chimera.Molecule instance, not an integer. If it's a string, a new Molecule will be created with that string as its name. If you want to put the atom in model 0 (it seems like you do), you need to get the Molecule instance of model 0. Like so:<br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>from chimera import openModels, Molecule<br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>model0 = openModels.list(id=0, modelTypes=[Molecule])[0]<br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div>The 'modelTypes=' part isn't necessary if the only thing in model 0 is a structure, but if you have a surface on the structure (which is a separate model of type MSMSModel) then you do need it.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Similarly, the 'position' argument needs to be a chimera.Point instance or None. If None, the atom will be placed in the center of the view. Clearly, you want a Point, like so:<br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>from chimera import Point<br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>pt = Point(13.2909,75.4474,25.4248)</div><div><br class="webkit-block-placeholder"></div><div>This also where the syntax error occurred. Commas separate arguments in Python calls, so the second and third numbers in your placeHelium() call were interpreted as additional arguments, not as part of the value being specified for the 'position' keyword. You would have needed to surround the three numbers with parentheses to have them treated as a single argument (which would have avoided the SyntaxError but would have still failed since it wasn't a Point instance).</div><div><br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>With the above, your call to placeHelium would be:<br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div>BuildStructure.placeHelium(res, model=model0, position=pt)</div><div><br class="webkit-block-placeholder"></div><div>--Eric</div><div><br class="webkit-block-placeholder"></div></body></html>