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

broken "-ua" option #60

Open
gabor1 opened this issue Oct 5, 2022 · 5 comments
Open

broken "-ua" option #60

gabor1 opened this issue Oct 5, 2022 · 5 comments

Comments

@gabor1
Copy link
Collaborator

gabor1 commented Oct 5, 2022

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
Copy link
Collaborator Author

gabor1 commented Oct 5, 2022

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()

@BingqingCheng
Copy link
Owner

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.

@gabor1
Copy link
Collaborator Author

gabor1 commented Oct 6, 2022

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?)

@BingqingCheng
Copy link
Owner

BingqingCheng commented Oct 6, 2022 via email

@gabor1
Copy link
Collaborator Author

gabor1 commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants