Skip to content

Commit 80401f7

Browse files
committed
update Arkane statmech to handle xtb adapter
xtb does not save geometries to its frequency logs, so this redirects Arkane's statmech.py to use the geometry file in place of the frequency file for anything that depends on geometry. It also grabs the frequencies from the frequency log and combines them with the conformer object built by the geometry log to get a complete conformer object with all the modes.
1 parent 079c366 commit 80401f7

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

arkane/modelchem.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,8 @@ def str_to_lot(s: str) -> Union[LevelOfTheory, CompositeLevelOfTheory]:
285285
'orca': ('orca',),
286286
'terachem': ('terachem',),
287287
'mopac': ('mopac',),
288-
'psi4': ('psi4',)
288+
'psi4': ('psi4',),
289+
'xtb': ('xtb',)
289290
}
290291
_software_ids = {_name: _id for _id, _names in _valid_software_names.items() for _name in _names}
291292

arkane/statmech.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
from arkane.common import ArkaneSpecies, symbol_by_number, get_principal_moments_of_inertia
5959
from arkane.encorr.corr import get_atom_correction, get_bac
60-
from arkane.ess import ESSAdapter, ess_factory, _registered_ess_adapters, GaussianLog, QChemLog
60+
from arkane.ess import ESSAdapter, ess_factory, _registered_ess_adapters, GaussianLog, QChemLog, XTBLog
6161
from arkane.encorr.isodesmic import ErrorCancelingSpecies, IsodesmicRingScheme
6262
from arkane.modelchem import LevelOfTheory, CompositeLevelOfTheory, standardize_name
6363
from arkane.output import prettify
@@ -506,10 +506,20 @@ def create_log(log_path, check_for_errors=True):
506506
self.species.label))
507507

508508
logging.debug(' Reading molecular degrees of freedom...')
509-
conformer, unscaled_frequencies = statmech_log.load_conformer(symmetry=external_symmetry,
509+
if isinstance(statmech_log, XTBLog):
510+
conformer, unscaled_frequencies = geom_log.load_conformer(symmetry=external_symmetry,
510511
spin_multiplicity=spin_multiplicity,
511512
optical_isomers=optical_isomers,
512513
label=self.species.label)
514+
unscaled_frequencies = statmech_log._load_frequencies()
515+
if unscaled_frequencies:
516+
conformer.modes.append(HarmonicOscillator(frequencies=(unscaled_frequencies, "cm^-1")))
517+
else:
518+
519+
conformer, unscaled_frequencies = statmech_log.load_conformer(symmetry=external_symmetry,
520+
spin_multiplicity=spin_multiplicity,
521+
optical_isomers=optical_isomers,
522+
label=self.species.label)
513523

514524
for mode in conformer.modes:
515525
if isinstance(mode, (Translation, IdealGasTranslation)):
@@ -695,7 +705,10 @@ def create_log(log_path, check_for_errors=True):
695705

696706
# save supporting information for calculation
697707
self.supporting_info = [self.species.label]
698-
optical_isomers_read, symmetry_read, point_group_read = statmech_log.get_symmetry_properties()
708+
if isinstance(statmech_log, XTBLog):
709+
optical_isomers_read, symmetry_read, point_group_read = geom_log.get_symmetry_properties()
710+
else:
711+
optical_isomers_read, symmetry_read, point_group_read = statmech_log.get_symmetry_properties()
699712
self.supporting_info.append(external_symmetry if external_symmetry else symmetry_read)
700713
self.supporting_info.append(optical_isomers if optical_isomers else optical_isomers_read)
701714
self.supporting_info.append(point_group_read)

0 commit comments

Comments
 (0)