Skip to content

Commit

Permalink
Remove starting offset
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippRue committed Nov 30, 2023
1 parent 38b5466 commit 90107a0
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions aiida_kkr/tools/tools_STM_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,26 @@ def get_r_offset(clust1, clust2, host_structure, add_position):
pos2 = np.array(host_structure.sites[ilayer2].position)
r_out_of_plane = pos2 - pos1

# convert from Ang to alat units (used internally in KKR)
alat = get_alat_from_bravais(np.array(host_structure.cell), host_structure.pbc[2])
r_out_of_plane /= alat

# remove spurious offsets that might be there due to the choice of the unit cell positions
r_out_of_plane = np.round(r_out_of_plane, 7)
r_out_of_plane[:2] %= 1 # modulo 1 for x and y coordinate

# calculate in-plane vector from da, db inputs
da = add_position.get_dict().get('da', 0)
db = add_position.get_dict().get('db', 0)
cell = np.array(host_structure.cell)
r_in_plane = da * cell[0] + db * cell[1]

# convert from Ang to alat units (used internally in KKR)
r_in_plane /= alat

# combine to offset vector
r_offset = r_out_of_plane + r_in_plane

# convert from Ang to alat units (used internally in KKR)
alat = get_alat_from_bravais(np.array(host_structure.cell), host_structure.pbc[2])
r_offset /= alat

return r_offset


Expand Down

0 comments on commit 90107a0

Please sign in to comment.