-
Notifications
You must be signed in to change notification settings - Fork 3
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 #95 from pyiron/abstract_test
Add test for abstract workflow class
- Loading branch information
Showing
2 changed files
with
84 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import unittest | ||
|
||
from atomistics.workflows.shared.workflow import Workflow | ||
|
||
|
||
class WorkflowClass(Workflow): | ||
pass | ||
|
||
|
||
class TestWorkflowClass(unittest.TestCase): | ||
def test_generate_structures(self): | ||
with self.assertRaises(NotImplementedError): | ||
temp = WorkflowClass() | ||
temp.generate_structures() | ||
|
||
def test_analyse_structures(self): | ||
with self.assertRaises(NotImplementedError): | ||
temp = WorkflowClass() | ||
temp.analyse_structures(output_dict={}) |
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,65 @@ | ||
import numpy as np | ||
|
||
import unittest | ||
|
||
from atomistics.workflows.evcurve.fit import fit_equation_of_state | ||
|
||
|
||
class TestEvCurve(unittest.TestCase): | ||
def setUp(self): | ||
self.volumes = [ | ||
63.10883669478296, | ||
63.77314023893856, | ||
64.43744378309412, | ||
65.10174732724975, | ||
65.7660508714054, | ||
66.43035441556098, | ||
67.09465795971657, | ||
67.7589615038722, | ||
68.42326504802779, | ||
69.08756859218344, | ||
69.75187213633905 | ||
] | ||
self.energies = [ | ||
-13.39817505470619, | ||
-13.4133940159381, | ||
-13.425115937672247, | ||
-13.433413658516752, | ||
-13.438358754759532, | ||
-13.439999952735112, | ||
-13.438382355644501, | ||
-13.433605756604651, | ||
-13.42577121684493, | ||
-13.41495739484744, | ||
-13.401227593921211 | ||
] | ||
|
||
def test_birch(self): | ||
fit_dict = fit_equation_of_state(volume_lst=self.volumes, energy_lst=self.energies, fittype='birch') | ||
self.assertTrue(np.isclose(fit_dict['volume_eq'], 66.43019853103964)) | ||
self.assertTrue(np.isclose(fit_dict['bulkmodul_eq'], 77.7433780646763)) | ||
self.assertTrue(np.isclose(fit_dict['b_prime_eq'], 1.2836228593874182)) | ||
|
||
def test_birchmurnaghan(self): | ||
fit_dict = fit_equation_of_state(volume_lst=self.volumes, energy_lst=self.energies, fittype='birchmurnaghan') | ||
self.assertTrue(np.isclose(fit_dict['volume_eq'], 66.43019853103964)) | ||
self.assertTrue(np.isclose(fit_dict['bulkmodul_eq'], 77.74337806467966)) | ||
self.assertTrue(np.isclose(fit_dict['b_prime_eq'], 1.2836228593684815)) | ||
|
||
def test_murnaghan(self): | ||
fit_dict = fit_equation_of_state(volume_lst=self.volumes, energy_lst=self.energies, fittype='murnaghan') | ||
self.assertTrue(np.isclose(fit_dict['volume_eq'], 66.43019853103964)) | ||
self.assertTrue(np.isclose(fit_dict['bulkmodul_eq'], 77.60443933015738)) | ||
self.assertTrue(np.isclose(fit_dict['b_prime_eq'], 1.2716548170090776)) | ||
|
||
def test_pouriertarantola(self): | ||
fit_dict = fit_equation_of_state(volume_lst=self.volumes, energy_lst=self.energies, fittype='pouriertarantola') | ||
self.assertTrue(np.isclose(fit_dict['volume_eq'], 66.43019853103964)) | ||
self.assertTrue(np.isclose(fit_dict['bulkmodul_eq'], 77.61743376692809)) | ||
self.assertTrue(np.isclose(fit_dict['b_prime_eq'], 1.272111993713677)) | ||
|
||
def test_vinet(self): | ||
fit_dict = fit_equation_of_state(volume_lst=self.volumes, energy_lst=self.energies, fittype='vinet') | ||
self.assertTrue(np.isclose(fit_dict['volume_eq'], 66.43019853103964)) | ||
self.assertTrue(np.isclose(fit_dict['bulkmodul_eq'], 77.61265363975706)) | ||
self.assertTrue(np.isclose(fit_dict['b_prime_eq'], 1.2734991618131122)) |