Skip to content

Commit

Permalink
fix fragment charges bug
Browse files Browse the repository at this point in the history
  • Loading branch information
selimsami committed Dec 9, 2023
1 parent 1de59bb commit bbcd2fe
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion qforce/molecule/non_bonded.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def subset(cls, non_bonded, frag_charges, mapping):
rev_map = {v: k for k, v in mapping.items()}
h_cap = non_bonded.h_cap

if frag_charges != []:
if list(frag_charges) != []:
q = frag_charges
else:
q = np.array([non_bonded.q[rev_map[i]] for i in range(n_atoms)])
Expand Down
33 changes: 16 additions & 17 deletions qforce/qm/orca.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,26 +461,25 @@ def _read_orca_bond_order(out_file, n_atoms):
item_match = re.compile('^\(\s*(\d+)-\w{1,2}\s*,\s*(\d+)-\w{1,2}\s*\)\s*:\s*(-?\w.+)$')
b_orders = [[0, ] * n_atoms for _ in range(n_atoms)]

file = open(out_file, 'r')
line = file.readline()
# Skip to the step after geometry optimisation
while 'Mayer bond orders larger than' not in line:
with open(out_file, 'r') as file:
line = file.readline()

line = file.readline()
while "-------" not in line:
items = line.split('B')
for item in items:
if item.strip():
_m = re.match(item_match, item)
i = int(_m.group(1))
j = int(_m.group(2))
bond_order = float(_m.group(3))
b_orders[i][j] = bond_order
b_orders[j][i] = bond_order
# Skip to the step after geometry optimisation
while 'Mayer bond orders larger than' not in line:
line = file.readline()

line = file.readline()
while "-------" not in line:
items = line.split('B')
for item in items:
if item.strip():
_m = re.match(item_match, item)
i = int(_m.group(1))
j = int(_m.group(2))
bond_order = float(_m.group(3))
b_orders[i][j] = bond_order
b_orders[j][i] = bond_order
line = file.readline()

file.close()
return b_orders

@staticmethod
Expand Down
1 change: 1 addition & 0 deletions qforce/qm/qchem.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def scan(self, config, file_name):
if not found_n_atoms and " NAtoms, " in line:
line = file.readline()
n_atoms = int(line.split()[0])
found_n_atoms = True

elif "OPTIMIZATION CONVERGED" in line:
coord = []
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = qforce
version = 0.6.12
version = 0.6.13
description = Q-Force: Quantum mechanically augmented molecular force fields
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down

0 comments on commit bbcd2fe

Please sign in to comment.