Skip to content

Commit

Permalink
updated charge method
Browse files Browse the repository at this point in the history
  • Loading branch information
MFSJMenger committed Jan 14, 2024
1 parent 90b4f97 commit 4dabe1b
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion qforce/qm/xtb.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os.path
import subprocess

import numpy as np
from ase.units import Hartree, mol, kJ, Bohr
Expand Down Expand Up @@ -171,6 +172,24 @@ def __init__(self, config):

super().__init__(config, ReadxTB(config), WritexTB(config))

@staticmethod
def run(calculation):
"""Perform a xtb calculation, raises CalculationFailed error in case of an error"""
with calculation.within():
name = calculation.filename
try:
subprocess.run(f"bash {name} > {name}.shellout", shell=True, check=True)
except subprocess.CalledProcessError as err:
raise CalculationFailed(f"subprocess registered error '{err.code}'") from None

try:
calculation.check()
except CalculationIncompleteError:
raise CalculationFailed("Not all necessary files could be generated for calculation"
f" '{calculation.inputfile}'"
) from None



class WritexTB(WriteABC):

Expand Down Expand Up @@ -389,7 +408,7 @@ def sp(self, config, sp_file):

def charges(self, config, pc_file):
_, point_charges = self._read_xtb_charge(pc_file)
return point_charges
return {'xtb': point_charges}

def hessian(self, config, hess_file, pc_file, coord_file, wbo_file):
""" Extract hessian information from all the relevant files.
Expand Down

0 comments on commit 4dabe1b

Please sign in to comment.