Skip to content

Commit

Permalink
eigv instead
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-24 committed Oct 21, 2023
1 parent 9e01a7a commit c9dcbe5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions phonopy_vibspec/phonons_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@ def make_vesta_for_modes(
self,
directory: pathlib.Path,
modes: Optional[List[int]] = None,
scaling: float = 10,
scaling: float = 2.0,
radius: float = 0.15,
color: Tuple[int, int, int] = (0, 255, 0)
):
"""Make a VESTA file for each `modes` (or all except acoustic if `mode` is None) containing a vector for
each atom, corresponding to the eigendisps.
each atom, corresponding to the eigenvector.
"""

l_logger.info('Make VESTA files for each mode')
Expand All @@ -223,14 +223,16 @@ def make_vesta_for_modes(
norms = numpy.linalg.norm(cell, axis=1)
cart_to_cell = numpy.linalg.inv(cell)

eigv = self.eigenvectors.reshape(-1, self.N, 3)

for mode in modes:
if mode < 0 or mode >= 3 * self.N:
raise IndexError(mode)

l_logger.info('Creating file for mode {}'.format(mode))

# convert to coordinates along cell vectors
ceignedisps = numpy.einsum('ij,jk->ik', self.eigendisps[mode], cart_to_cell)
ceignedisps = numpy.einsum('ij,jk->ik', eigv[mode], cart_to_cell)
ceigendisps = ceignedisps[:] * norms * scaling

vectors = [
Expand Down
4 changes: 2 additions & 2 deletions phonopy_vibspec/scripts/vesta_modes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Create a VESTA file containing the atomic displacement for each mode
Create a VESTA file containing the eigenvector for each mode
"""

import argparse
Expand Down Expand Up @@ -32,7 +32,7 @@ def main():
parser = argparse.ArgumentParser(description=__doc__)
add_common_args(parser)

parser.add_argument('-s', '--scaling', help='Scaling factor', type=float, default=10.0)
parser.add_argument('-s', '--scaling', help='Scaling factor', type=float, default=2.0)
parser.add_argument('-r', '--radius', help='Radius of the vectors', type=float, default=0.15)
parser.add_argument('--color', help='Color of the vectors', type=get_color, default='0 255 0')

Expand Down

0 comments on commit c9dcbe5

Please sign in to comment.