Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions ash/interfaces/interface_xtb.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def __init__(self, xtbdir=None, xtbmethod='GFN1', runmode='inputfile', numcores=
self.theorytype="QM"
self.analytic_hessian=False

# Hardness of pointcharge. GAM factor. Big number means PC behaviour
# Hardness of pointcharge. GAM factor. Big number means PC behaviour.
# If hardness is set to 'elements', xtb's element-specific hardness is used (see https://xtb-docs.readthedocs.io/en/latest/pcem.html).
self.hardness=hardness_PC

# Accuracy (0.1 it quite tight)
Expand Down Expand Up @@ -448,7 +449,11 @@ def run(self, current_coords=None, current_MM_coords=None, MMcharges=None, qm_el
print("...")
# Create pcharge file if PC
if PC:
create_xtb_pcfile_general(current_MM_coords, MMcharges, hardness=self.hardness)
if self.hardness == 'elements':
hardness = mm_elems
else:
hardness = [self.hardness] * len(MMcharges)
create_xtb_pcfile_general(current_MM_coords, MMcharges, hardness=hardness)

# Run xTB (note: passing PC and Grad Booleans)
run_xtb_SP(self.xtbdir, self.xtbmethod, coordfile, charge, mult, printlevel=self.printlevel, PC=PC, solvent=self.solvent,
Expand Down Expand Up @@ -963,8 +968,8 @@ def create_xtb_pcfile_general(coords,pchargelist,hardness=1000):
#https://xtb-docs.readthedocs.io/en/latest/pcem.html
with open('pcharge', 'w') as pcfile:
pcfile.write(str(len(pchargelist))+'\n')
for p,c in zip(pchargelist,coords):
line = "{} {} {} {} {}".format(p, c[0], c[1], c[2], hardness)
for p,c,h in zip(pchargelist,coords,hardness):
line = "{} {} {} {} {}".format(p, c[0], c[1], c[2], h)
pcfile.write(line+'\n')


Expand Down
Loading