Skip to content

Commit

Permalink
Merge pull request #58 from pyiron/rename_calculator_to_workflow
Browse files Browse the repository at this point in the history
Rename calculators to workflows
  • Loading branch information
jan-janssen authored Nov 15, 2023
2 parents bbf0a57 + df0aaf2 commit d908ed6
Show file tree
Hide file tree
Showing 15 changed files with 57 additions and 59 deletions.
20 changes: 10 additions & 10 deletions docs/source/materialproperties.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ from gpaw import GPAW, PW
import numpy as np
calculator = EnergyVolumeCurveWorkflow(
workflow = EnergyVolumeCurveWorkflow(
structure=bulk("Al", a=4.05, cubic=True),
num_points=11,
fit_type='polynomial',
Expand All @@ -26,7 +26,7 @@ calculator = EnergyVolumeCurveWorkflow(
axes=['x', 'y', 'z'],
strains=None,
)
task_dict = calculator.generate_structures()
task_dict = workflow.generate_structures()
result_dict = evaluate_with_ase(
task_dict=task_dict,
ase_calculator=GPAW(
Expand All @@ -35,7 +35,7 @@ result_dict = evaluate_with_ase(
kpts=(3, 3, 3)
)
)
fit_dict = calculator.analyse_structures(output_dict=result_dict)
fit_dict = workflow.analyse_structures(output_dict=result_dict)
print(fit_dict)
```

Expand All @@ -51,14 +51,14 @@ from gpaw import GPAW, PW
import numpy as np
calculator = ElasticMatrixWorkflow(
workflow = ElasticMatrixWorkflow(
structure=bulk("Al", a=4.0, cubic=True),
num_of_point=5,
eps_range=0.05,
sqrt_eta=True,
fit_order=2
)
task_dict = calculator.generate_structures()
task_dict = workflow.generate_structures()
result_dict = evaluate_with_ase(
task_dict=task_dict,
ase_calculator=GPAW(
Expand All @@ -67,7 +67,7 @@ result_dict = evaluate_with_ase(
kpts=(3, 3, 3)
)
)
elastic_dict = calculator.analyse_structures(output_dict=result_dict)
elastic_dict = workflow.analyse_structures(output_dict=result_dict)
print(elastic_dict)
```

Expand Down Expand Up @@ -135,7 +135,7 @@ pes.plot_contourf(show_min_erg_path=True)
```
### Quasi-Harmonic Approximation
```
calculator = QuasiHarmonicWorkflow(
workflow = QuasiHarmonicWorkflow(
structure=structure,
num_points=11,
vol_range=0.05,
Expand All @@ -146,13 +146,13 @@ calculator = QuasiHarmonicWorkflow(
primitive_matrix=None,
number_of_snapshots=None,
)
structure_dict = calculator.generate_structures()
structure_dict = workflow.generate_structures()
result_dict = evaluate_with_lammps(
task_dict=structure_dict,
potential_dataframe=potential_dataframe,
)
eng_internal_dict, mesh_collect_dict, dos_collect_dict = calculator.analyse_structures(output_dict=result_dict)
tp_collect_dict = calculator.get_thermal_properties(t_min=1, t_max=1500, t_step=50, temperatures=None)
eng_internal_dict, mesh_collect_dict, dos_collect_dict = workflow.analyse_structures(output_dict=result_dict)
tp_collect_dict = workflow.get_thermal_properties(t_min=1, t_max=1500, t_step=50, temperatures=None)
temperatures = tp_collect_dict[1.0]['temperatures']
temperature_max = max(temperatures)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_elastic_emt.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@

class TestElastic(unittest.TestCase):
def test_calc_elastic(self):
calculator = ElasticMatrixWorkflow(
workflow = ElasticMatrixWorkflow(
structure=bulk("Al", a=4.0, cubic=True),
num_of_point=5,
eps_range=0.005,
sqrt_eta=True,
fit_order=2
)
task_dict = calculator.generate_structures()
task_dict = workflow.generate_structures()
result_dict = evaluate_with_ase(task_dict=task_dict, ase_calculator=EMT())
elastic_dict = calculator.analyse_structures(output_dict=result_dict)
elastic_dict = workflow.analyse_structures(output_dict=result_dict)
self.assertTrue(np.isclose(elastic_dict["C"][0, 0], 52.62435421))
self.assertTrue(np.isclose(elastic_dict["C"][0, 1], 32.6743838))
self.assertTrue(np.isclose(elastic_dict["C"][3, 3], 35.58677436))
7 changes: 3 additions & 4 deletions tests/test_elastic_gpaw.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
)
class TestElastic(unittest.TestCase):
def test_calc_elastic(self):
calculator = ElasticMatrixWorkflow(
workflow = ElasticMatrixWorkflow(
structure=bulk("Al", a=4.0, cubic=True),
num_of_point=5,
eps_range=0.05,
sqrt_eta=True,
fit_order=2
)
task_dict = calculator.generate_structures()
task_dict = workflow.generate_structures()
result_dict = evaluate_with_ase(
task_dict=task_dict,
ase_calculator=GPAW(
Expand All @@ -34,8 +34,7 @@ def test_calc_elastic(self):
kpts=(3, 3, 3)
)
)
elastic_dict = calculator.analyse_structures(output_dict=result_dict)
print(elastic_dict)
elastic_dict = workflow.analyse_structures(output_dict=result_dict)
self.assertTrue(np.isclose(elastic_dict["C"][0, 0], 125.66807354, atol=1e-04))
self.assertTrue(np.isclose(elastic_dict["C"][0, 1], 68.41418321, atol=1e-04))
self.assertTrue(np.isclose(elastic_dict["C"][3, 3], 99.29916329, atol=1e-04))
6 changes: 3 additions & 3 deletions tests/test_elastic_lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ def test_calc_elastic(self):
task_dict=task_dict,
potential_dataframe=df_pot_selected,
)
calculator = ElasticMatrixWorkflow(
workflow = ElasticMatrixWorkflow(
structure=result_dict["structure_with_optimized_positions_and_volume"],
num_of_point=5,
eps_range=0.005,
sqrt_eta=True,
fit_order=2
)
task_dict = calculator.generate_structures()
task_dict = workflow.generate_structures()
result_dict = evaluate_with_lammps(
task_dict=task_dict,
potential_dataframe=df_pot_selected,
)
elastic_dict = calculator.analyse_structures(output_dict=result_dict)
elastic_dict = workflow.analyse_structures(output_dict=result_dict)
self.assertTrue(np.isclose(elastic_dict["C"][0, 0], 114.10393023))
self.assertTrue(np.isclose(elastic_dict["C"][0, 1], 60.51098897))
self.assertTrue(np.isclose(elastic_dict["C"][3, 3], 51.23853765))
6 changes: 3 additions & 3 deletions tests/test_evcurve_abinit.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def validate_fitdict(fit_dict):
)
class TestEvCurve(unittest.TestCase):
def test_calc_evcurve(self):
calculator = EnergyVolumeCurveWorkflow(
workflow = EnergyVolumeCurveWorkflow(
structure=bulk("Al", a=4.05, cubic=True),
num_points=11,
fit_type='polynomial',
Expand All @@ -43,7 +43,7 @@ def test_calc_evcurve(self):
axes=['x', 'y', 'z'],
strains=None,
)
task_dict = calculator.generate_structures()
task_dict = workflow.generate_structures()
result_dict = evaluate_with_ase(
task_dict=task_dict,
ase_calculator=Abinit(
Expand All @@ -55,5 +55,5 @@ def test_calc_evcurve(self):
v8_legacy_format=False,
)
)
fit_dict = calculator.analyse_structures(output_dict=result_dict)
fit_dict = workflow.analyse_structures(output_dict=result_dict)
self.assertTrue(all(validate_fitdict(fit_dict=fit_dict)))
6 changes: 3 additions & 3 deletions tests/test_evcurve_emt.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class TestEvCurve(unittest.TestCase):
def test_calc_evcurve(self):
calculator = EnergyVolumeCurveWorkflow(
workflow = EnergyVolumeCurveWorkflow(
structure=bulk("Al", a=4.0, cubic=True),
num_points=11,
fit_type='polynomial',
Expand All @@ -18,9 +18,9 @@ def test_calc_evcurve(self):
axes=['x', 'y', 'z'],
strains=None,
)
task_dict = calculator.generate_structures()
task_dict = workflow.generate_structures()
result_dict = evaluate_with_ase(task_dict=task_dict, ase_calculator=EMT())
fit_dict = calculator.analyse_structures(output_dict=result_dict)
fit_dict = workflow.analyse_structures(output_dict=result_dict)
self.assertTrue(np.isclose(fit_dict['volume_eq'], 63.72615218844302))
self.assertTrue(np.isclose(fit_dict['bulkmodul_eq'], 39.544084907317895))
self.assertTrue(np.isclose(fit_dict['b_prime_eq'], 2.2509394023322566))
7 changes: 3 additions & 4 deletions tests/test_evcurve_gpaw.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
)
class TestEvCurve(unittest.TestCase):
def test_calc_evcurve(self):
calculator = EnergyVolumeCurveWorkflow(
workflow = EnergyVolumeCurveWorkflow(
structure=bulk("Al", a=4.05, cubic=True),
num_points=11,
fit_type='polynomial',
Expand All @@ -28,7 +28,7 @@ def test_calc_evcurve(self):
axes=['x', 'y', 'z'],
strains=None,
)
task_dict = calculator.generate_structures()
task_dict = workflow.generate_structures()
result_dict = evaluate_with_ase(
task_dict=task_dict,
ase_calculator=GPAW(
Expand All @@ -37,8 +37,7 @@ def test_calc_evcurve(self):
kpts=(3, 3, 3)
)
)
fit_dict = calculator.analyse_structures(output_dict=result_dict)
print(fit_dict)
fit_dict = workflow.analyse_structures(output_dict=result_dict)
self.assertTrue(np.isclose(fit_dict['volume_eq'], 66.44252286131331, atol=1e-04))
self.assertTrue(np.isclose(fit_dict['bulkmodul_eq'], 72.38919826652857, atol=1e-04))
self.assertTrue(np.isclose(fit_dict['b_prime_eq'], 4.453836551712821, atol=1e-04))
6 changes: 3 additions & 3 deletions tests/test_evcurve_lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_calc_evcurve(self):
task_dict=task_dict,
potential_dataframe=df_pot_selected,
)
calculator = EnergyVolumeCurveWorkflow(
workflow = EnergyVolumeCurveWorkflow(
structure=result_dict["structure_with_optimized_positions_and_volume"],
num_points=11,
fit_type='polynomial',
Expand All @@ -44,12 +44,12 @@ def test_calc_evcurve(self):
axes=['x', 'y', 'z'],
strains=None,
)
task_dict = calculator.generate_structures()
task_dict = workflow.generate_structures()
result_dict = evaluate_with_lammps(
task_dict=task_dict,
potential_dataframe=df_pot_selected,
)
fit_dict = calculator.analyse_structures(output_dict=result_dict)
fit_dict = workflow.analyse_structures(output_dict=result_dict)
self.assertTrue(np.isclose(fit_dict['volume_eq'], 66.43019853103964))
self.assertTrue(np.isclose(fit_dict['bulkmodul_eq'], 77.7250135953191))
self.assertTrue(np.isclose(fit_dict['b_prime_eq'], 1.2795467367276832))
6 changes: 3 additions & 3 deletions tests/test_evcurve_qe.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def validate_fitdict(fit_dict):
class TestEvCurve(unittest.TestCase):
def test_calc_evcurve(self):
pseudopotentials = {"Al": "Al.pbe-n-kjpaw_psl.1.0.0.UPF"}
calculator = EnergyVolumeCurveWorkflow(
workflow = EnergyVolumeCurveWorkflow(
structure=bulk("Al", a=4.15, cubic=True),
num_points=11,
fit_type='polynomial',
Expand All @@ -46,7 +46,7 @@ def test_calc_evcurve(self):
axes=['x', 'y', 'z'],
strains=None,
)
task_dict = calculator.generate_structures()
task_dict = workflow.generate_structures()
result_dict = evaluate_with_ase(
task_dict=task_dict,
ase_calculator=Espresso(
Expand All @@ -56,5 +56,5 @@ def test_calc_evcurve(self):
kpts=(3, 3, 3),
)
)
fit_dict = calculator.analyse_structures(output_dict=result_dict)
fit_dict = workflow.analyse_structures(output_dict=result_dict)
self.assertTrue(all(validate_fitdict(fit_dict=fit_dict)))
6 changes: 3 additions & 3 deletions tests/test_evcurve_siesta.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def validate_fitdict(fit_dict):
)
class TestEvCurve(unittest.TestCase):
def test_calc_evcurve(self):
calculator = EnergyVolumeCurveWorkflow(
workflow = EnergyVolumeCurveWorkflow(
structure=bulk("Al", a=4.15, cubic=True),
num_points=11,
fit_type='polynomial',
Expand All @@ -47,7 +47,7 @@ def test_calc_evcurve(self):
axes=['x', 'y', 'z'],
strains=None,
)
task_dict = calculator.generate_structures()
task_dict = workflow.generate_structures()
result_dict = evaluate_with_ase(
task_dict=task_dict,
ase_calculator=Siesta(
Expand All @@ -62,5 +62,5 @@ def test_calc_evcurve(self):
pseudo_qualifier="",
)
)
fit_dict = calculator.analyse_structures(output_dict=result_dict)
fit_dict = workflow.analyse_structures(output_dict=result_dict)
self.assertTrue(all(validate_fitdict(fit_dict=fit_dict)))
8 changes: 4 additions & 4 deletions tests/test_phonons_emt.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class TestPhonons(unittest.TestCase):
def test_calc_phonons(self):
calculator = PhonopyWorkflow(
workflow = PhonopyWorkflow(
structure=bulk("Al", a=4.0, cubic=True),
interaction_range=10,
factor=VaspToTHz,
Expand All @@ -18,10 +18,10 @@ def test_calc_phonons(self):
primitive_matrix=None,
number_of_snapshots=None,
)
task_dict = calculator.generate_structures()
task_dict = workflow.generate_structures()
result_dict = evaluate_with_ase(task_dict=task_dict, ase_calculator=EMT())
mesh_dict, dos_dict = calculator.analyse_structures(output_dict=result_dict)
self.assertEqual((324, 324), calculator.get_hesse_matrix().shape)
mesh_dict, dos_dict = workflow.analyse_structures(output_dict=result_dict)
self.assertEqual((324, 324), workflow.get_hesse_matrix().shape)
self.assertTrue('qpoints' in mesh_dict.keys())
self.assertTrue('weights' in mesh_dict.keys())
self.assertTrue('frequencies' in mesh_dict.keys())
Expand Down
8 changes: 4 additions & 4 deletions tests/test_phonons_gpaw.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)
class TestPhonons(unittest.TestCase):
def test_calc_phonons(self):
calculator = PhonopyWorkflow(
workflow = PhonopyWorkflow(
structure=bulk("Al", a=4.05, cubic=True),
interaction_range=10,
factor=VaspToTHz,
Expand All @@ -27,7 +27,7 @@ def test_calc_phonons(self):
primitive_matrix=None,
number_of_snapshots=None,
)
task_dict = calculator.generate_structures()
task_dict = workflow.generate_structures()
result_dict = evaluate_with_ase(
task_dict=task_dict,
ase_calculator=GPAW(
Expand All @@ -36,8 +36,8 @@ def test_calc_phonons(self):
kpts=(3, 3, 3)
)
)
mesh_dict, dos_dict = calculator.analyse_structures(output_dict=result_dict)
self.assertEqual((324, 324), calculator.get_hesse_matrix().shape)
mesh_dict, dos_dict = workflow.analyse_structures(output_dict=result_dict)
self.assertEqual((324, 324), workflow.get_hesse_matrix().shape)
self.assertTrue('qpoints' in mesh_dict.keys())
self.assertTrue('weights' in mesh_dict.keys())
self.assertTrue('frequencies' in mesh_dict.keys())
Expand Down
8 changes: 4 additions & 4 deletions tests/test_phonons_lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_calc_phonons(self):
task_dict=task_dict,
potential_dataframe=df_pot_selected,
)
calculator = PhonopyWorkflow(
workflow = PhonopyWorkflow(
structure=result_dict["structure_with_optimized_positions_and_volume"],
interaction_range=10,
factor=VaspToTHz,
Expand All @@ -43,13 +43,13 @@ def test_calc_phonons(self):
primitive_matrix=None,
number_of_snapshots=None,
)
task_dict = calculator.generate_structures()
task_dict = workflow.generate_structures()
result_dict = evaluate_with_lammps(
task_dict=task_dict,
potential_dataframe=df_pot_selected,
)
mesh_dict, dos_dict = calculator.analyse_structures(output_dict=result_dict)
self.assertEqual((324, 324), calculator.get_hesse_matrix().shape)
mesh_dict, dos_dict = workflow.analyse_structures(output_dict=result_dict)
self.assertEqual((324, 324), workflow.get_hesse_matrix().shape)
self.assertTrue('qpoints' in mesh_dict.keys())
self.assertTrue('weights' in mesh_dict.keys())
self.assertTrue('frequencies' in mesh_dict.keys())
Expand Down
8 changes: 4 additions & 4 deletions tests/test_quasiharmonic_emt.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class TestPhonons(unittest.TestCase):
def test_calc_phonons(self):
calculator = QuasiHarmonicWorkflow(
workflow = QuasiHarmonicWorkflow(
structure=bulk("Al", a=4.0, cubic=True),
num_points=11,
vol_range=0.05,
Expand All @@ -20,12 +20,12 @@ def test_calc_phonons(self):
primitive_matrix=None,
number_of_snapshots=None,
)
task_dict = calculator.generate_structures()
task_dict = workflow.generate_structures()
result_dict = evaluate_with_ase(
task_dict=task_dict,
ase_calculator=EMT()
)
eng_internal_dict, mesh_collect_dict, dos_collect_dict = calculator.analyse_structures(output_dict=result_dict)
tp_collect_dict = calculator.get_thermal_properties(t_min=1, t_max=1500, t_step=50, temperatures=None)
eng_internal_dict, mesh_collect_dict, dos_collect_dict = workflow.analyse_structures(output_dict=result_dict)
tp_collect_dict = workflow.get_thermal_properties(t_min=1, t_max=1500, t_step=50, temperatures=None)
self.assertEqual(len(eng_internal_dict.keys()), 11)
self.assertEqual(len(tp_collect_dict.keys()), 11)
Loading

0 comments on commit d908ed6

Please sign in to comment.