Skip to content

Commit

Permalink
Fixing bugs in Ang to Bohr conversion (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
elinscott authored Jan 31, 2024
1 parent 366ec09 commit 559da8b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/koopmans/utils/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ def read_atomic_positions(atoms: Atoms, dct: Dict[str, Any]):
if units == 'angstrom':
pass
elif units == 'bohr':
positions /= Bohr
positions *= Bohr
elif units == 'alat':
celldms = cell_to_parameters(atoms.cell).get('celldms')
assert isinstance(celldms, dict)
positions *= celldms[1] / Bohr
positions *= celldms[1] * Bohr
elif units == 'crystal':
scale_positions = True
else:
Expand Down Expand Up @@ -156,12 +156,12 @@ def read_cell_parameters(atoms: Atoms, dct: Dict[str, Any]):
elif units.lower() == 'angstrom':
pass
elif units.lower() == 'bohr':
cell = np.array(cell) / Bohr
cell = np.array(cell) * Bohr
elif units.lower() == 'alat':
alat = dct.get('celldms', {}).get(1, None)
if alat is None:
raise ValueError('Please provide celldm(1) for a cell specified in units of alat')
cell = np.array(cell) * alat / Bohr
cell = np.array(cell) * alat * Bohr
else:
raise ValueError('The combination of vectors, ibrav, & units in the cell_parameter block is not valid')
atoms.cell = cell
Expand Down

0 comments on commit 559da8b

Please sign in to comment.