Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed an issue where creating an object array would unpack a Molecule into Atoms #94

Merged
merged 2 commits into from
Mar 19, 2020
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
18 changes: 9 additions & 9 deletions CAT/multi_ligand.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def init_multi_ligand(qd_df):
if workflow.mol_format is not None:
path = workflow.path
mol_format = workflow.mol_format
mol_to_file(qd_df[columns].values.ravel(), path, mol_format=mol_format)
mol_ar_flat = qd_df[columns].values.ravel()
mol_to_file(mol_ar_flat, path, mol_format=mol_format)


@overload
Expand Down Expand Up @@ -79,14 +80,13 @@ def multi_lig(qd_series, ligands, dummy=None, f=None, **kwargs):
raise TypeError("'f' and 'dummy' cannot be both 'None'")


def _multi_lig_dummy(qd_series, ligands, path, dummy, allignment) -> List[List[Molecule]]:
def _multi_lig_dummy(qd_series, ligands, path, dummy, allignment) -> np.ndarray:
"""Gogogo."""
ret_list = []
for qd in qd_series:
ret = []
ret_list.append(ret)
ret = np.empty((len(ligands), len(qd_series)), dtype=object)
for i, qd in enumerate(qd_series):
qd = qd.copy()

for ligand, atnum in zip(ligands, dummy):
for j, (ligand, atnum) in enumerate(zip(ligands, dummy)):
try:
atoms = [at for at in qd if at.atnum == atnum]
assert atoms
Expand All @@ -102,8 +102,8 @@ def _multi_lig_dummy(qd_series, ligands, path, dummy, allignment) -> List[List[M
qd = ligand_to_qd(qd, ligand, path=path,
allignment=allignment,
idx_subset=qd.properties.indices)
ret.append(qd)
return np.array(ret_list, dtype=object).T
ret[j, i] = qd
return ret


def _multi_lig_f(qd_series, ligands, path, f, **kwargs):
Expand Down