You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Often times, when reading orbital data (e.g. energies) we see that MOs can switch ordering. For example, the HOMO at the start of an IRC becomes the HOMO-1 towards the end. This will lead to incorrect data for these orbitals. We should implement an orbital tracking feature that can fix this issue.
The get_alike_orbital method of the pyfmo.Orbitals class allows us to retrieve orbitals that are similar to a given orbital. We can use this feature to fix the above problem statement.
For example:
frompyfmoimportOrbitalsfromtcutilityimportpathfuncimportosimportmatplotlib.pyplotasplt# the directory that stores the pyfrag calculationsdirs=pathfunc.get_subdirectories('../../../test/fixtures/pyfrag')
# get the files to the adf.rkf filesfiles= [os.path.join(d, 'adf.rkf') fordinsorted(dirs, key=lambdad: int(d.split('.')[-1]))]
# and load themorbs= [Orbitals(f) forfinfiles]
# plot energy levels of the MOs based on the ordering in the adf.rkf filesplt.plot([orb.mos['HOMO'].energyfororbinorbs], label='HOMO')
plt.plot([orb.mos['HOMO-1'].energyfororbinorbs], label='HOMO-1')
plt.xlabel('IRC Step')
plt.ylabel(r'$\epsilon$ (eV)')
plt.legend()
defMO_track(start_mo, orbs):
''' Function used to track a MO through a series of calculations. Args: start_mo: the MO object that should be tracked through the other calculations. orbs: the other orbitals objects that we use to compare to start_mo Returns: A list of MO objects that are tracked from start_mo '''mos= [start_mo]
fororbinorbs[1:]:
best=orb.get_alike_orbital(mos[-1])
mos.append(best)
returnmos# plot the tracked MO energiesplt.figure()
plt.plot([mo.energyformoinMO_track(orbs[1].mos['HOMO'], orbs[1:-1])], label='HOMO')
plt.plot([mo.energyformoinMO_track(orbs[1].mos['HOMO-1'], orbs[1:-1])], label='HOMO-1')
plt.xlabel('IRC Step')
plt.ylabel(r'$\epsilon$ (eV)')
plt.legend()
plt.show()
The text was updated successfully, but these errors were encountered:
Often times, when reading orbital data (e.g. energies) we see that MOs can switch ordering. For example, the HOMO at the start of an IRC becomes the HOMO-1 towards the end. This will lead to incorrect data for these orbitals. We should implement an orbital tracking feature that can fix this issue.
The get_alike_orbital method of the
pyfmo.Orbitals
class allows us to retrieve orbitals that are similar to a given orbital. We can use this feature to fix the above problem statement.For example:
The text was updated successfully, but these errors were encountered: