Skip to content

Commit

Permalink
#73 sort transition_states.xyz by energy
Browse files Browse the repository at this point in the history
  • Loading branch information
joshkamm committed Aug 14, 2024
1 parent 3aadebf commit 0e3f327
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/conformational_sampling/gsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ def aggregate_transition_states():
list(pb.readfile('xyz', str(ts_opt_path))) for ts_opt_path in ts_opt_paths
]
transition_states = [ts_opt[-1] for ts_opt in ts_opts]
# sort transition states by energy, which pybel reads from the 2nd line of the
# XYZ file and puts in its title variable
transition_states = sorted(
transition_states, key=lambda pybel_mol: float(pybel_mol.title)
)
with pb.Outputfile('xyz', 'transition_states.xyz', overwrite=True) as out_file:
for transition_state in transition_states:
out_file.write(transition_state)
Expand Down

0 comments on commit 0e3f327

Please sign in to comment.