Skip to content

Commit

Permalink
Fix access to scale in CONTCAR
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-schlipf committed Oct 2, 2023
1 parent f51618f commit 9d82a2e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/py4vasp/_data/contcar.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,17 @@ def _topology(self):


def _cell_lines(cell):
yield _float_format(cell.scale, scientific=False).lstrip()
yield _float_format(_cell_scale(cell.scale), scientific=False).lstrip()
yield from _vectors_to_lines(cell.lattice_vectors)


def _cell_scale(scale):
if not scale.is_none():
return scale[()]
else:
return 1.0


def _ion_position_lines(positions, selective_dynamics):
if selective_dynamics.is_none():
yield from _vectors_to_lines(positions)
Expand All @@ -92,7 +99,8 @@ def _lattice_velocity_lines(velocities, cell):
return
yield "Lattice velocities and vectors"
yield from _vectors_to_lines(velocities, scientific=True)
yield from _vectors_to_lines(cell.scale * cell.lattice_vectors, scientific=True)
lattice_vectors = _cell_scale(cell.scale) * cell.lattice_vectors
yield from _vectors_to_lines(lattice_vectors, scientific=True)


def _ion_velocity_lines(velocities):
Expand Down

0 comments on commit 9d82a2e

Please sign in to comment.