-
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.
Implement structure optimization protocol
- Loading branch information
1 parent
17edb8d
commit fb59a8b
Showing
22 changed files
with
237 additions
and
48 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
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
Empty file.
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,6 @@ | ||
def optimize_positions_and_volume(structure): | ||
return {"optimize_positions_and_volume": structure} | ||
|
||
|
||
def optimize_positions(structure): | ||
return {"optimize_positions": structure} |
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
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
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
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,31 @@ | ||
import numpy as np | ||
from ase.build import bulk | ||
from ase.calculators.emt import EMT | ||
from ase.optimize import BFGS | ||
import unittest | ||
|
||
from atomistics.calculators.ase import evaluate_with_ase | ||
from atomistics.workflows.structure_optimization.workflow import optimize_positions | ||
|
||
|
||
class TestOptimizePositions(unittest.TestCase): | ||
def test_optimize_positions(self): | ||
structure = bulk("Al", a=4.0, cubic=True) | ||
positions_before_displacement = structure.positions.copy() | ||
structure.positions[0] += [0.01, 0.01, 0.01] | ||
task_dict = optimize_positions(structure=structure) | ||
result_dict = evaluate_with_ase( | ||
task_dict=task_dict, | ||
ase_calculator=EMT(), | ||
ase_optimizer=BFGS, | ||
ase_optimizer_kwargs={"fmax": 0.00005} | ||
) | ||
structure_optimized = result_dict["structure_with_optimized_positions"] | ||
self.assertTrue( | ||
all(np.isclose( | ||
positions_before_displacement, | ||
structure_optimized.positions-structure_optimized.positions[0], | ||
atol=1e-5 | ||
).flatten()) | ||
) | ||
|
Oops, something went wrong.