Skip to content
Merged
Show file tree
Hide file tree
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
16 changes: 10 additions & 6 deletions burnman/optimize/nonlinear_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,12 +444,16 @@ def _lagrangian_walk_along_constraints(
x_j = sol.x + lmda * dx

# Check feasibility
x_j_min = sol.x + lmda_bounds_new[0] * dx
F_j_min = self.F(x_j_min)
dxbar_j_min = lu_solve(luJ, -F_j_min)
dxbar_j_min_norm = np.linalg.norm(dxbar_j_min, ord=2)

if dxbar_j_min_norm > dx_norm or np.linalg.norm(dx, ord=2) < self.eps:
try:
x_j_min = sol.x + lmda_bounds_new[0] * dx
F_j_min = self.F(x_j_min)
dxbar_j_min = lu_solve(luJ, -F_j_min)
dxbar_j_min_norm = np.linalg.norm(dxbar_j_min, ord=2)

if dxbar_j_min_norm > dx_norm or np.linalg.norm(dx, ord=2) < self.eps:
persistent_bound_violation = True
except Exception:
# For example, if self.F(x_j_min) fails
persistent_bound_violation = True

# Check newly violated inactive constraints
Expand Down
2 changes: 1 addition & 1 deletion examples/example_equilibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@

# Run the equilibration
pressure = 1.0e5
temperatures = np.linspace(300.0, 601.0, 41)
temperatures = np.linspace(300.0, 601.4, 301)
equality_constraints = [("P", pressure), ("T", temperatures)]

sols, prm = equilibrate(composition, assemblage, equality_constraints)
Expand Down
Loading