ASAP icon indicating copy to clipboard operation
ASAP copied to clipboard

broken "-ua" option

Open gabor1 opened this issue 2 years ago • 5 comments

Hi!

I'm trying to compute soap vectors for environments and then PCA the atomic soap vectors. the PCA map appears, but the output file doesn't get written, I get a python error. Am I doing something wrong?

asap gen_desc --fxyz tmp.xyz soap -c 3.5 -n 4 -l 2 -g 0.5 -pa 
asap map -f ASAP-desc.xyz  -o chemiscope -dm [SOAP-n4-l2-c3.5-g0.5] -ua  pca -d 2

if I remove the "-ua" option, so work with global descriptors, it's fine. I enclose my input xyz file.

tmp.xyz.gz

gabor1 avatar Oct 05 '22 19:10 gabor1

this is my python error:

Gabors-MacBook-Pro-2:Downloads gabor$ asap map -f ASAP-desc.xyz  -o chemiscope -dm [SOAP-n4-l2-c3.5-g0.5] -ua  pca -d 2
load xyz file:  ASAP-desc.xyz , a total of  4 frames , a total of  512 atoms , with elements:  [8] .
Find the following atomic descriptor names that match the specifications:  ['SOAP-n4-l2-c3.5-g0.5']
Use atomic descriptor matrix with shape:  (512, 30)
0
Remove raw desciptors..
removing the global descriptors from output xyz with the names:  ['SOAP-n4-l2-c3.5-g0.5']
removing the atomic descriptors from output xyz with the names:  ['SOAP-n4-l2-c3.5-g0.5']
Perform standard scaling of the design matrix. To turn it off use `--no-scale`
Using PCA ...
Start PCA for a design matrix with shape  (512, 30)
StandardScaler()
computing covariance matrix with shape: (30, 30)
  And now we build a projection 
Done, super quick. 
Using scatter plot ...
Using annotation plot ...
Use discrete colormap ......
Traceback (most recent call last):
  File "/Users/gabor/Library/Python/3.8/bin/asap", line 8, in <module>
    sys.exit(asap())
  File "/Users/gabor/Library/Python/3.8/lib/python/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/gabor/Library/Python/3.8/lib/python/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/gabor/Library/Python/3.8/lib/python/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/gabor/Library/Python/3.8/lib/python/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/gabor/Library/Python/3.8/lib/python/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/gabor/Library/Python/3.8/lib/python/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/gabor/Library/Python/3.8/lib/python/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/gabor/Library/Python/3.8/lib/python/site-packages/asaplib/cli/cmd_asap.py", line 577, in pca
    map_process(ctx.obj, reduce_dict, axes, map_name)
  File "/Users/gabor/Library/Python/3.8/lib/python/site-packages/asaplib/cli/func_asap.py", line 158, in map_process
    map_save(outfilename, outmode, obj['asapxyz'], None, proj, map_name, species_name)
  File "/Users/gabor/Library/Python/3.8/lib/python/site-packages/asaplib/cli/func_asap.py", line 195, in map_save
    cutoff = 3.5 if proj_atomic else None
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

gabor1 avatar Oct 05 '22 19:10 gabor1

I tried and can replicate the output.

The problem is with the chemiscope output. When I do asap map -f ASAP-desc.xyz -o xyz -dm '[*]' -ua pca -d 2

there's no problem and it outputs per-atom descriptors.

Back then I recall chemiscope cannot handle both global & atomic descriptors at the same time. Maybe now things have changed. But the I/O to get chemiscope files in ASAP do not seem to handle both.

BingqingCheng avatar Oct 06 '22 10:10 BingqingCheng

Thanks for looking into this. In this case I only want per atom output. would the chemiscope output work if I turned off the global output (and if so how do I do that?)

gabor1 avatar Oct 06 '22 10:10 gabor1

It has been a while since I looked into the updates of chemiscope, but back then I recall that it can only handle the per-atom output for a single frame. Maybe things have changed now.

Chemiscope now have a python interface and can be loaded in a Jupyter notebook, maybe for. this case it's easier that way than loading from the html.

Otherwise I recall the projection_view can handle the per-atom and global output without problem. It takes the xyz file.

On Thu, Oct 6, 2022 at 12:58 PM gabor1 @.***> wrote:

Thanks for looking into this. In this case I only want per atom output. would the chemiscope output work if I turned off the global output (and if so how do I do that?)

— Reply to this email directly, view it on GitHub https://github.com/BingqingCheng/ASAP/issues/60#issuecomment-1269810509, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABX4HLCATAKEFTRQC7O4ZMLWB2WEXANCNFSM6AAAAAAQ53VE2A . You are receiving this because you commented.Message ID: @.***>

BingqingCheng avatar Oct 06 '22 11:10 BingqingCheng

In this case I only want per atom output. would the chemiscope output work if I turned off the global output (and if so how do I do that?)

— Gábor

Gabor Csanyi Professor of Molecular Modelling Engineering Laboratory University of Cambridge

------- Original Message ------- On Thursday, October 6th, 2022 at 06:52, Bingqing Cheng @.***> wrote:

I tried and can replicate the output.

The problem is with the chemiscope output. When I do asap map -f ASAP-desc.xyz -o xyz -dm '[*]' -ua pca -d 2

there's no problem and it outputs per-atom descriptors.

Back then I recall chemiscope cannot handle both global & atomic descriptors at the same time. Maybe now things have changed. But the I/O to get chemiscope files in ASAP do not seem to handle both.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

gabor1 avatar Oct 11 '22 08:10 gabor1