Thanks.
Yes it helps.

On Tue, 23 May 2023 at 15:21, Jared Sampson <jared.samp...@columbia.edu>
wrote:

> Hi Petro - It looks like that structure has a deuterium atom.  Assuming
> you're interested in the non-deuterated molecule, you can convert it to a
> hydrogen and the command will work.
>
> ```
> alter elem D, elem="H"
> rebuild
> print(cmd.centerofmass("polymer"))
> ```
>
> Or if you want to stick with Python API syntax, the first two commands
> would be:
>
> ```
> cmd.alter('elem D', 'elem="H"')  # note the second argument is a string
> for the `expression` keyword arg, thus double quotes inside single quotes
> cmd.rebuild()
> ```
>
> Hope that helps.
>
> Cheers,
> Jared
>
> On Tue, May 23, 2023 at 6:44 AM Petro <subscr...@khoroshyy.net> wrote:
>
>>
>> Hi everybody
>> I get the following error when I try to use center of mass commanand.
>> Any Idea what is wrong?
>> Thanks.
>> Petro.
>>
>> --------------------------------------------------------------------------KeyError
>>                                   Traceback (most recent call last)
>> Cell In[4], line 4      2 cmd.reinitialize()      3 cmd.fetch('1AKK')----> 4 
>> cmd.centerofmass('polymer')
>>
>> File ~\miniconda3\envs\pymol\lib\site-packages\pymol\querying.py:1565, in 
>> centerofmass(selection, state, quiet, _self)   1563 model = 
>> _self.get_model(selection, state)   1564 for a in model.atom:-> 1565     m = 
>> a.get_mass() * (a.q or 1.0)   1566     com = cpv.add(com, cpv.scale(a.coord, 
>> m))   1567     totmass += m
>>
>> File ~\miniconda3\envs\pymol\lib\site-packages\chempy\__init__.py:82, in 
>> Atom.get_mass(self)     80 def get_mass(self):     81     '''Given the 
>> chemical symbol the atomic mass is returned'''---> 82     return 
>> atomic_mass[self.symbol]
>> KeyError: 'D'
>>
>> _______________________________________________
>> PyMOL-users mailing list
>> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>> Unsubscribe:
>> https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe
>
>
_______________________________________________
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

Reply via email to