Skip to content

Commit

Permalink
fix co-crystal #10
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhu2017 committed Apr 8, 2024
1 parent 37223e8 commit f33b97f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions ost/forcefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def __init__(self, smiles=None, style="gaff", chargemethod="am1bcc"):
molecule.set_charges(self.partial_charges[i])
else:
molecule.set_charges(self.partial_charges[i].m)
if style == 'openff':
for at in molecule.atoms:
at.atom_type.number = i
self.molecules.append(molecule)

def set_partial_charges(self):
Expand Down
7 changes: 4 additions & 3 deletions ost/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1984,18 +1984,19 @@ def clean_ref_dics(self, ref_dics, criteria={"O-O": 2.0}):
# db = database('../HT-OCSP/benchmarks/Si.db')
db = database("../HT-OCSP/benchmarks/test.db")
style = 'gaff' #'openff'
style = 'openff'
#xtal = db.get_pyxtal("ACSALA")
xtal = db.get_pyxtal("XAFQON")#"XATJOT")
xtal = db.get_pyxtal("XATJOT") #"XAFQON")#
#xtal = db.get_pyxtal("KONTIQ09")
smiles = [mol.smile for mol in xtal.molecules]
assert smiles[0] is not None
smiles[0] = '[Cl-]'
params = ForceFieldParameters(smiles, style=style, ncpu=2)
#smiles[0] = '[Cl-]'
print(params)
params0 = params.params_init.copy()
ase_with_ff = params.get_ase_charmm(params0)
ase_with_ff.write_charmmfiles(base='pyxtal')#, style=style)
#ff_dic = params.evaluate_ff_single(xtal.to_ase(resort=False), xtal.numMols); print(ff_dic)
ff_dic = params.evaluate_ff_single(xtal.to_ase(resort=False), xtal.numMols); print(ff_dic)
#ref_dic = params.evaluate_ref_single(xtal.to_ase(resort=False), xtal.numMols); print(ref_dic)
#if os.path.exists('reference.xml'):
# ref_dics = params.load_references('reference.xml')
Expand Down

0 comments on commit f33b97f

Please sign in to comment.