Skip to content

Problem in co-crystal system #10

Description

@qzhu2017

@shinnosukehattori

If we are dealing with a co-crystal, we used the following codes to store the molecular topology information
https://github.com/MaterSim/OST/blob/332976973ea0ccf818245c1a1f0e7975e391f204/ost/parameters.py#L1917-L1924

Here you used the reduce function, this is fine for the case of gaff. However, for the case of openff, there maybe an issue.
E.g.,
In the following example, I have two molecules,

  • the atoms in molecule 1 is labelled as C1, C2, ...
  • the atoms in molecule 2 is also labelled as C1, C2, ....
    However, C1 in mol1 is different from C1 in mol 2.

If we use the reduce function, it seems that only 1 C1 will be left. Do you know if there is a solution to avoid such merge?

In the following example, I expect to see 17+11 = 24 atom types. But it shows 24 after merge.

>>> from pyxtal.db import database
>>> from ost.parameters import ForceFieldParameters
>>> db = database("../HT-OCSP/benchmarks/test.db")
>>> style = 'openff'
>>> xtal = db.get_pyxtal("XATJOT")
>>> smiles = [mol.smile for mol in xtal.molecules]
>>> params = ForceFieldParameters(smiles, style=style)
>>> len(params.ff.molecules[0].parameterset.atom_types)
17
>>> len(params.ff.molecules[1].parameterset.atom_types)
11
>>> for at in params.ff.molecules[0].parameterset.atom_types: print(at)
... 
N1
C2
C3
C4
C5
C6
C7
C8
N9
C10
H11
H12
H13
H14
H15
H16
H17
>>> for at in params.ff.molecules[1].parameterset.atom_types: print(at)
... 
O1
C2
O3
C4
C5
C6
O7
O8
H9
H10
H11
>>> from functools import reduce
>>> from operator import add
>>> mols = reduce(add, params.ff.molecules)
>>> for at in mols.parameterset.atom_types: print(at)
... 
N1
C2
C3
C4
C5
C6
C7
C8
N9
C10
H11
H12
H13
H14
H15
H16
H17
O1
O3
O7
O8
H9
H10
H11D
>>> len(mols.parameterset.atom_types)
24

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions