Python scripting for Dipole moment calculation

Hi all! I am trying to calculate the dipole moment of different proteins at different pH values. The .pdb and .dx files are generated with pdb2pqr and apbs software. I have found a script that is written for chimera, but it seems that the modules are not translated to ChimeraX, or at least I am not able to make it work. So I have decided to try to write my own script. So far I am able to obtain the center of mass of the protein as well as the charges of all the atoms in the molecule, but I cannot find a way to build a vector to where calculate the dipole (as it is done in the chimera script). Can anyone give me some insights? Does ChimeraX have as well the class Vector and Point? Thank you very much for your help! Best, Andreu

Hi Andreu, ChimeraX uses the NumPy <https://numpy.org/> module instead of Chimera's bespoke Point and Vector classes. Therefore for structure 's', the center of mass can be computed with: masses = s.atoms.elements.masses weighted = s.atoms.coords * masses[:, None] com = sum(weighted) / sum(masses) And instead of the script's "dipole = Vector()" you can use "dipole = numpy.zeros(3)" (after "import numpy" of course). --Eric Eric Pettersen UCSF Computer Graphics Lab
On May 28, 2024, at 1:30 AM, andreumormaldon--- via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi all! I am trying to calculate the dipole moment of different proteins at different pH values. The .pdb and .dx files are generated with pdb2pqr and apbs software. I have found a script that is written for chimera, but it seems that the modules are not translated to ChimeraX, or at least I am not able to make it work. So I have decided to try to write my own script. So far I am able to obtain the center of mass of the protein as well as the charges of all the atoms in the molecule, but I cannot find a way to build a vector to where calculate the dipole (as it is done in the chimera script).
Can anyone give me some insights? Does ChimeraX have as well the class Vector and Point?
Thank you very much for your help!
Best, Andreu _______________________________________________ ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/
participants (2)
-
andreumormaldon@outlook.com
-
Eric Pettersen