Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions python/libcasm/composition/_formation_energy_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,17 @@ def formation_energy(
f"with shape ({self.independent_compositions},)"
)
else:
if energy.shape != (self.independent_compositions,):
raise ValueError(
"If energy is an array, "
f"it must have shape ({self.independent_compositions},)"
)
if composition.shape[0] != self.independent_compositions:
raise ValueError(
"If energy is an array,"
"If energy is an array, "
"composition must be a 2d array with shape "
f"({self.independent_compositions}, n)"
)
if energy.shape != (composition.shape[1],):
raise ValueError(
"If energy is an array, "
f"it must have shape (n,)"
)
return energy - self.reference_energy(composition)

def to_dict(self):
Expand Down
Loading