chemiscope icon indicating copy to clipboard operation
chemiscope copied to clipboard

"cutoff" needed by chemiscope-input ?

Open gabor1 opened this issue 2 years ago • 7 comments

Hi!

I'm trying to use chemiscope to visualise a PCA map created by ASAP, using per-atom environments. I created the attached file with ASAP, it's an XYZ because the direct chemiscope output generation is broken. When I use the following command to generate a json, I get an error about a cutoff. There is no argument to chemiscope-input where I could specify a cutoff (I am not sure why a cutoff is required, since I already have the PCA coordinates in the input file, all I am trying to do is get chemiscope to put the environments on a map... ). I tried specifying a cutoff in the info line of the xyz, but that didn't work either.

Gabors-MacBook-Pro-2:Downloads gabor$ chemiscope-input ASAP-lowD-map.xyz --only-atoms -o tmp.json
Traceback (most recent call last):
  File "/Users/gabor/Library/Python/3.8/bin/chemiscope-input", line 8, in <module>
    sys.exit(main())
  File "/Users/gabor/Library/Python/3.8/lib/python/site-packages/chemiscope/main.py", line 73, in main
    if args.only_atoms and args.cutoff is None:
AttributeError: 'Namespace' object has no attribute 'cutoff'
Gabors-MacBook-Pro-2:Downloads gabor$ 

ASAP-lowD-map.xyz.gz

thanks!

Gabor

gabor1 avatar Oct 06 '22 12:10 gabor1

Heya! There is a pull request #248 that targets the underlying issue - converting the ASE data to properties is ambiguous, and the heuristics break down too often.

For the moment you can do this with a short python script

import chemiscope 
import numpy as np
import ase.io as aseio

frames = aseio.read("ASAP-lowD-map.xyz.gz", ":")

chemiscope.write_input("test.chemiscope.json",frames, properties=dict(
               GMC_direction={'values': np.concatenate([f.arrays['GMC_direction'] for f in frames]), 'target':'atom'},
               liq_solid_soap={'values': np.concatenate([f.arrays['liq_solid_soap'] for f in frames]), 'target':'atom'}, 
               pca={'values': np.concatenate([f.arrays['pca-d-10'] for f in frames]), 'target':'atom'},
                ), environments=chemiscope.all_atomic_environments(frames,6))

BTW, the cutoff is only used in the visualization, to decide how far out to highlight the neighborhood.

ceriottm avatar Oct 06 '22 13:10 ceriottm

Thanks. So are there two issues here? one is the cutoff the other is the ambiguous property read? Note that ASAP didn't put the cutoffs in the info line, I had to do that by hand. should cutoff be a command line argument of chemiscope-input?

gabor1 avatar Oct 06 '22 13:10 gabor1

I think the issue is much simpler: nobody uses the chemiscope-input script anymore on our side, and it got broken (there is no cutoff argument in argparse, but the code expects one later).

If there are users of this script, we can try to fix it ASAP, and in the mean time you can use @ceriottm sample Python code to replace chemiscope-input.

Luthaf avatar Oct 06 '22 14:10 Luthaf

Could you put back the cutoff argument then? The problem is that asap chromoscope export is just broken for per-atom descriptors

gabor1 avatar Oct 06 '22 14:10 gabor1

@ceriottm scripy doesn't deal with the cutoff as far as I can tell

gabor1 avatar Oct 06 '22 14:10 gabor1

chemiscope.all_atomic_environments(frames,cutoff=6) generates a list of environments with a cutoff of six angstrom.

the heuristics by which write_input decided if it should show environments or structures was one of the most buggy aspects, which is why we made this environments argument compulsory. probably you can make asap export work just by adding the all_atomic_environments code.

we are still at 0. releases so API is not crystallized - if you want to avoid these issues in the future it might be a good idea to pin the version that is used by ASAP. the .json format is quite stable so the generated output will be read just fine by the online viewer.

ceriottm avatar Oct 06 '22 14:10 ceriottm

Asap just stops with a syntax error. The problem is not on the chemiscope side

gabor1 avatar Oct 06 '22 15:10 gabor1

I am closing this since we merged #248 that streamlines the definition of the properties. Perhaps one could create an issue on the ASAP side so that the interface is brought up to the current syntax, and then the version pinned so that future changes on the chemiscope side won't break anything there.

ceriottm avatar Nov 11 '22 12:11 ceriottm