-
Notifications
You must be signed in to change notification settings - Fork 1
Add function to calculate soap descriptors #74
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9caa400
Add function to calculate soap descriptors
jan-janssen 871fc36
black formatting
jan-janssen b201c89
use np.isclose() for comparison
jan-janssen 7a868f0
run dscribe tests only on unix
jan-janssen 5c7ae9e
Merge branch 'soap' into merge_soap
jan-janssen e5714e3
Merge pull request #143 from pyiron/merge_soap
jan-janssen e279981
Update pyproject.toml
jan-janssen 2925e30
Delete .ci_support/condamerge.py
jan-janssen baac508
Update environment.yml
jan-janssen 89fbe9c
Delete .ci_support/environment-dscribe.yml
jan-janssen 99ad7cd
rename function
jan-janssen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| def soap_descriptor_per_atom( | ||
| structure, | ||
| r_cut=None, | ||
| n_max=None, | ||
| l_max=None, | ||
| sigma=1.0, | ||
| rbf="gto", | ||
| weighting=None, | ||
| average="off", | ||
| compression={"mode": "off", "species_weighting": None}, | ||
| species=None, | ||
| periodic=True, | ||
| sparse=False, | ||
| dtype="float64", | ||
| centers=None, | ||
| n_jobs=1, | ||
| only_physical_cores=False, | ||
| verbose=False, | ||
| ): | ||
| from dscribe.descriptors import SOAP | ||
|
|
||
| if species is None: | ||
| species = list(set(structure.get_chemical_symbols())) | ||
| periodic_soap = SOAP( | ||
| r_cut=r_cut, | ||
| n_max=n_max, | ||
| l_max=l_max, | ||
| sigma=sigma, | ||
| rbf=rbf, | ||
| weighting=weighting, | ||
| average=average, | ||
| compression=compression, | ||
| species=species, | ||
| periodic=periodic, | ||
| sparse=sparse, | ||
| dtype=dtype, | ||
| ) | ||
| return periodic_soap.create( | ||
| system=structure, | ||
| centers=centers, | ||
| n_jobs=n_jobs, | ||
| only_physical_cores=only_physical_cores, | ||
| verbose=verbose, | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # coding: utf-8 | ||
| # Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department | ||
| # Distributed under the terms of "New BSD License", see the LICENSE file. | ||
|
|
||
| import unittest | ||
| from ase.build import bulk | ||
| import numpy as np | ||
| import structuretoolkit as stk | ||
|
|
||
| try: | ||
| import dscribe | ||
|
|
||
| skip_dscribe_test = False | ||
| except ImportError: | ||
| skip_dscribe_test = True | ||
|
|
||
|
|
||
| @unittest.skipIf( | ||
| skip_dscribe_test, "dscribe is not installed, so the dscribe tests are skipped." | ||
| ) | ||
| class Testdscribe(unittest.TestCase): | ||
| def test_soap_descriptor_per_atom(self): | ||
| structure = bulk('Cu', 'fcc', a=3.6, cubic=True) | ||
| soap = stk.analyse.soap_descriptor_per_atom(structure=structure, r_cut=6.0, n_max=8, l_max=6) | ||
| self.assertEqual(soap.shape, (4, 252)) | ||
| self.assertTrue(np.isclose(soap.sum(), 39450.03009, atol=1.e-5)) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer
More explicit and clearer to someone who is trying to figure out what the function does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would actually integrate better with the workflow stuff too. There, we scrape the output channel label from whatever's after the return value -- giving it a nice variable like that keeps things extra tidy.