-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArithmeticNodes.py
More file actions
21 lines (19 loc) · 805 Bytes
/
ArithmeticNodes.py
File metadata and controls
21 lines (19 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import pyiron_workflow as pwf
from DataClassNode import DataInputs, WorkflowState
from typing import Union, Optional, Any
@pwf.as_function_node
def compute_gamma(I_Periodic:Union[DataInputs.dataclass,WorkflowState.dataclass],
I_Surfaces:Union[DataInputs.dataclass,WorkflowState.dataclass],
verbose=False):
import numpy as np
E0 = I_Periodic.Energy #_Minimization
E1 = I_Surfaces.Energy #_Minimization
a,b,c = I_Surfaces.Cell #_Minimization
area_per_surface = np.linalg.norm(np.cross(a,b))
area = 2*area_per_surface
gamma = (E1 - E0)/(area)
if verbose:
print("###################################")
print(f'gamma = {round(gamma,5)} eV/A^2')
print("###################################")
return gamma, area