Skip to content
Open
Show file tree
Hide file tree
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
15 changes: 10 additions & 5 deletions fragit/fragmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
except ImportError:
raise OBNotFoundException("OpenBabel not found. Please install OpenBabel to use FragIt.")

from fragit.util import remove_duplicates, flatten, difference, uniqifyListOfLists, is_tuple_values_in_either_list, LABEL2Z
from fragit.util import remove_duplicates, flatten, difference, uniqifyListOfLists, is_tuple_values_in_either_list, LABEL2Z, Z2LABEL
from fragit.config import FragItConfig, FragItDataBase


Expand Down Expand Up @@ -97,7 +97,8 @@ def _remove_metal_atoms(self):
break
for i in range(1, self.mol.NumAtoms()+1):
atom = self.mol.GetAtom(i)
if atom.GetAtomicNum() in [1, 6, 7, 8, 9, 12, 15, 16]:
# PX: not make Cl to Cl-
if atom.GetAtomicNum() in [1, 6, 7, 8, 9, 12, 15, 16, 17]:
if atom not in self._atoms:
self._atoms.append(atom)
added += 1
Expand All @@ -108,8 +109,8 @@ def _remove_metal_atoms(self):
atomic_charge = 0 # default
if atom.GetAtomicNum() in [11, 19]: # Na+ and K+:
atomic_charge = 1
elif atom.GetAtomicNum() in [9, 17]: # F- and Cl-
atomic_charge = -1
#elif atom.GetAtomicNum() in [9, 17]: # F- and Cl-
# atomic_charge = -1

new_atom = openbabel.OBAtom()
new_atom.Duplicate(atom)
Expand Down Expand Up @@ -191,6 +192,10 @@ def do_fragment_merging(self):
fragments = self.get_fragments()
fragments_to_merge.reverse()
for fragment_id in fragments_to_merge:
#PX : for edge case,
# when the first fragment is glycine,do not merge.
if fragment_id == 0:
continue
previous_fragment = fragment_id-1
ifrag = fragments.pop(fragment_id)
jfrag = fragments[previous_fragment].extend(ifrag)
Expand Down Expand Up @@ -580,7 +585,7 @@ def name_fragment(self, atoms: List[int]) -> str:
if len(atoms) == 1:
atom = self.mol.GetAtom(atoms[0])
charge_lbl = charge_lbls[atom.GetFormalCharge()]
element = LABEL2Z[atom.GetAtomicNum()]
element = Z2LABEL[atom.GetAtomicNum()]
return "{0:s}{1:s}".format(element, charge_lbl)
else:
for residue in openbabel.OBResidueIter(self.mol):
Expand Down
1 change: 1 addition & 0 deletions fragit/gamessfmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
GAMESS_BASIS_GROUP['cc-pVTZ'] = "GBASIS=CCT"
GAMESS_BASIS_GROUP['aug-cc-pVDZ'] = "GBASIS=ACCD"
GAMESS_BASIS_GROUP['aug-cc-pVTZ'] = "GBASIS=ACCT"
GAMESS_BASIS_GROUP['DFTB-C'] = "GBASIS=DFTB"

# basis set data for atoms in $DATA group
GAMESS_DATA_BASIS: Dict[str, Dict[str, str]] = dict()
Expand Down
5 changes: 5 additions & 0 deletions share/hmo/DFTB-C
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DFTB-C 4 4
1 0 0.558756 0.000000 0.000000 0.829332
0 1 0.558757 0.781901 0.000000 -0.276445
0 1 0.558756 -0.390951 0.677146 -0.276445
0 1 0.558756 -0.390951 -0.677146 -0.276445