mdtraj.dipole_moments¶
-
mdtraj.
dipole_moments
(traj, charges)¶ Calculate the dipole moments of each frame in a trajectory.
- Parameters
- trajTrajectory
An mdtraj trajectory.
- chargesnp.ndarray, shape=(n_atoms), dtype=float
Charges of each atom in the trajectory, expressed in units of the elementary charge constant.
- Returns
- momentsnp.ndarray, shape=(n_frames, 3), dtype=float
Dipole moments of trajectory, units of nm * elementary charge.
Notes
This code works by first calculating displacements relative to the first atom in each residue (e.g. local frame). Then, this is added to the PBC-corrected displacement between the first atom in the two molecules. This total displacement is then used as to calculate the box dipole moment.