nlesc-nano / CAT

A collection of tools designed for the automatic construction, and subsequent analysis, of chemical compounds.
Other
16 stars 2 forks source link

Failed to employ polyatomic core anchors #261

Open juliette1996 opened 1 year ago

juliette1996 commented 1 year ago

Hello there, I'm trying to use the new option core.optional.allignment = "anchor" but it's apparently failing with this error message:

Traceback (most recent call last):
  File "C:\Users\jzito\Miniconda3\envs\escience\Scripts\init_cat-script.py", line 33, in <module>
    sys.exit(load_entry_point('nlesc-CAT', 'console_scripts', 'init_cat')())
  File "c:\users\jzito\escience\cat\CAT\data_handling\entry_points.py", line 62, in main
    base.prep(extract_args(args), return_mol=False)
  File "c:\users\jzito\escience\cat\CAT\base.py", line 121, in prep
    core_df = prep_core(core_df)
  File "c:\users\jzito\escience\cat\CAT\base.py", line 220, in prep_core
    idx_tuples = [set_core_anchors(i, anchor_tup, allignment_tup, subset) for i in core_df[MOL]]
  File "c:\users\jzito\escience\cat\CAT\base.py", line 220, in <listcomp>
    idx_tuples = [set_core_anchors(i, anchor_tup, allignment_tup, subset) for i in core_df[MOL]]
  File "c:\users\jzito\escience\cat\CAT\attachment\core_anchoring.py", line 51, in set_core_anchors
    anchor_idx = anchor_idx_group[:, anchor_tup.group_idx[0]].copy()
IndexError: too many indices for array

Here are the core and input files.

path: .

input_cores:
        - geo_opt.xyz

input_ligands:
        - CCC(=O)O

optional:
    database:
            mol_format: ['xyz']

    core:
        dirname: core
        allignment: "anchor"  # Define the core vectors based on the dummy acetate's vectors
        anchor:
            group: "[O-]C(C([H])([H])[H])=O"  # Acetate anion (with explicit hydrogens!)
            group_idx: [0, 6]  # Represent the anchor by the mean position of both oxyanions
            kind: "mean"
            remove: [0, 1, 2, 3, 4, 5, 6]  # Remove the entirety of the dummy acetate

    ligand:
        dirname: ligand
        split: True

    qd:
        dirname: qd
        construct_qd: True
        optimize: False

Can you help me with this?

juliette1996 commented 1 year ago

@RobertaPascazio do you have a .pdb file of this structure?

BvB93 commented 1 year ago

The problem here was the lack of bonds in the passed core, which caused CAT to fail in identifying the anchoring sites within the passed molecules. The error message here is problematic though and should be way more explicit (fixed as of https://github.com/nlesc-nano/CAT/commit/b8349e6ad04a12774faa0e321b8d802e07ff273b).

RobertaPascazio commented 1 year ago

There you have it!

geo_opt.zip

juliette1996 commented 1 year ago

Same error as before when using the pdb file