This repository has been archived by the owner on Nov 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #360 from pyiron/import_atomistics
Import atomistics
- Loading branch information
Showing
4 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 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,27 @@ | ||
# 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. | ||
|
||
|
||
from atomistics.referencedata.wikipedia import get_elastic_properties | ||
|
||
|
||
def get_elastic_constants(chemical_symbol): | ||
""" | ||
Get the elastic tensor of a material from the wikipedia database. | ||
Args: | ||
chemical_symbol (str): Chemical symbol of the element. | ||
Returns: | ||
dict: Dictionary with the elastic tensor of the material (isotropic). | ||
""" | ||
d = get_elastic_properties(chemical_symbol) | ||
G = d["shear_modulus"] | ||
v = d["poissons_ratio"] | ||
E = d["youngs_modulus"] | ||
C_11 = E * (1 - v) / (1 + v) / (1 - 2 * v) | ||
C_12 = E * v / (1 + v) / (1 - 2 * v) | ||
C_44 = G | ||
d.update({"C_11": C_11, "C_12": C_12, "C_44": C_44}) | ||
return d |
This file contains 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,20 @@ | ||
# 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 pyiron_continuum.reference.elastic_constants import get_elastic_constants | ||
import numpy as np | ||
|
||
|
||
class TestDecorators(unittest.TestCase): | ||
def test_elastic_constants(self): | ||
d = get_elastic_constants("Fe") | ||
self.assertTrue(all(key in d for key in ["C_11", "C_12", "C_44"])) | ||
for value in d.values(): | ||
self.assertTrue(np.isscalar(value)) | ||
self.assertGreater(value, 0) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |