Skip to content

Commit

Permalink
Possibly translating in the wrong direction
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexsp32 committed Aug 16, 2023
1 parent 43420a2 commit a040b84
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ function quantise_diatomic(sim::Simulation, v::Matrix, r::Matrix;
if isa(sim.cell,PeriodicCell)
# If the simulation used a `PeriodicCell`, translate `atom_indices` so they are at their minimum distance. (This is necessary if atoms were translated back into the original unit cell)
translations=[[i,j,k] for i in -max_translation:max_translation for j in -max_translation:max_translation for k in -max_translation:max_translation]
which_translation=argmin([norm(abs.(r[:,atom_indices[1]]-r[:,atom_indices[2]]+sim.cell.vectors*operation)) for operation in translations])
which_translation=argmin([norm(abs.(r[:,atom_indices[2]]-r[:,atom_indices[1]]+sim.cell.vectors*operation)) for operation in translations])
# Translate one atom for minimal distance.
if translations[which_translation]!=[0,0,0]
r[:,atom_indices[2]].=r[:,atom_indices[2]]+sim.cell.vectors*translations[which_translation]
Expand Down

0 comments on commit a040b84

Please sign in to comment.