Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug on Build when Make pk1 to different valence #408

Open
zhongxiang117 opened this issue Nov 29, 2024 · 0 comments
Open

Bug on Build when Make pk1 to different valence #408

zhongxiang117 opened this issue Nov 29, 2024 · 0 comments

Comments

@zhongxiang117
Copy link

The bug is on when using Build change pk1 valence.

Reproduce:

  • load any molecule
  • pick two atoms
  • ExternalGUI -> Build -> Make (pk1) Positive

The error will be:

PyMOL>alter pk1, formal_charge=0.
Traceback (most recent call last):
  File "/MY/BUILD/PYMOL/PATH/lib/python/pymol/editing.py", line 1472, in alter
    return _cmd.alter(_self._COb, selection, expression, False, int(quiet), dict(space))
  File "", line 1, in <module>
TypeError: 'float' object cannot be interpreted as an integer

Reason:

By checking the info, we know that this error is caused by the float and int conversion, and we notice that predefined expression, formal_charge=0. (end with a period) is wrong.

Fix:

Checking the codes:

Path: master -> modules -> pymol -> _gui.py L230-L232
Link: https://github.com/schrodinger/pymol-open-source/blob/master/modules/pymol/_gui.py#L230-L232

                ... # original
                ('command', 'Make (pk1) Positive [Ctrl-Shift-K]',   'alter pk1, formal_charge=1.'),
                ('command', 'Make (pk1) Negative [Ctrl-Shift-J]',   'alter pk1, formal_charge=-1.'),
                ('command', 'Make (pk1) Neutral [Ctrl-Shift-U]',    'alter pk1, formal_charge=0.'),

The int number should be used, then:

                ... # update
                ('command', 'Make (pk1) Positive [Ctrl-Shift-K]',   'alter pk1, formal_charge=1'),  # no period
                ('command', 'Make (pk1) Negative [Ctrl-Shift-J]',   'alter pk1, formal_charge=-1'), # no period
                ('command', 'Make (pk1) Neutral [Ctrl-Shift-U]',    'alter pk1, formal_charge=0'),  # no period
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant