We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It would be convenient to obtain the dipole or quadrupole moment of a group or compounds within a group.
import MDAnalysis as mda u = mda.Universe("peptide.data") # From LAMMPS example data.peptide peptide = u.select_atoms("not type 13 and not type 14") water = u.select_atoms("type 13 or type 14")tmp_dpl = peptide.dipole_moment() print("Peptide Dipole", np.sqrt(np.sum(tmp_dpl**2)), tmp_dpl) print("Peptide Quadrupole", peptide.quadrupole_moment()) print("Peptide Dipole", np.sqrt(np.sum(tmp_dpl**2))/0.2081943, "Debye") print("Peptide Quadrupole", peptide.quadrupole_moment()/0.2081943, "Debye*A") > Peptide Dipole 2.2182727658215424 [-0.10292139 -2.21468175 -0.07297934] > Peptide Quadrupole 18.4693874744808 > Peptide Dipole 10.654819876536209 Debye > Peptide Quadrupole 88.7122628932723 Debye*A water = u.select_atoms("type 13 or type 14") water = water.residues[:5] tmp_dpl = water.dipole_moment(compound="residues", unwrap=True) tmp_qud = water.quadrupole_moment(compound="residues", unwrap=True) print("Water Dipole", np.sqrt(np.sum(tmp_dpl**2, axis=1))/0.2081943, "Debye") print("Water Quadrupole", tmp_qud/0.2081943, "Debye*A") > Water Dipole [2.34705817 2.34703033 2.34697288 2.34697048 2.34709711] Debye > Water Quadrupole [1.98943791 1.9893828 1.98939536 1.98937966 1.98941399] Debye*A ag = peptide + mda.AtomGroup(water.atoms.ix, u) tmp_dpl = ag.dipole_moment(compound="residues", unwrap=True) tmp_qud = ag.quadrupole_moment(compound="residues", unwrap=True) print("Dipole Moments:", np.sqrt(np.sum(tmp_dpl**2, axis=1))/0.2081943, "Debye") print("Quad Moments:", tmp_qud/0.2081943, "Debye*A") > Dipole Moments: [10.65481988 2.34705817 2.34703033 2.34697288 2.34697048 2.34709711] Debye > Quad Moments: [88.71226289 1.98943791 1.9893828 1.98939536 1.98937966 1.98941399] Debye*A
The text was updated successfully, but these errors were encountered:
This looks like a sensible addition.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Is your feature request related to a problem?
It would be convenient to obtain the dipole or quadrupole moment of a group or compounds within a group.
Describe the solution you'd like
The text was updated successfully, but these errors were encountered: