Skip to content

Commit

Permalink
Rename bondl and bondu to be more descriptive
Browse files Browse the repository at this point in the history
  • Loading branch information
timothy-nunn committed Feb 21, 2025
1 parent 34bfb72 commit 9d6cccc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
4 changes: 2 additions & 2 deletions process/optimiser.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def run(self):
# Trim maximum size arrays down to actually used size
n = numerics.nvar
x = numerics.xcm[:n]
bndl = numerics.bondl[:n]
bndu = numerics.bondu[:n]
bndl = numerics.itv_scaled_lower_bounds[:n]
bndu = numerics.itv_scaled_upper_bounds[:n]

# Define total number of constraints and equality constraints
m = numerics.neqns + numerics.nineqns
Expand Down
13 changes: 8 additions & 5 deletions process/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ def post_optimise(self, ifail: int):
name = f2py_compatible_to_string(numerics.lablxc[numerics.ixc[i] - 1])
solution_vector_table.append([name, numerics.xcs[i], numerics.xcm[i]])

xminn = 1.01 * numerics.bondl[i]
xmaxx = 0.99 * numerics.bondu[i]
xminn = 1.01 * numerics.itv_scaled_lower_bounds[i]
xmaxx = 0.99 * numerics.itv_scaled_upper_bounds[i]

if numerics.xcm[i] < xminn or numerics.xcm[i] > xmaxx:
if not written_warning:
Expand All @@ -359,7 +359,7 @@ def post_optimise(self, ifail: int):
process_output.write(
constants.nout,
f" {name:<30}= {xcval} is at or {location} its {bound} bound:"
f" {numerics.bondu[i] * numerics.scafc[i]}",
f" {numerics.itv_scaled_upper_bounds[i] * numerics.scafc[i]}",
)

process_output.ovarre(
Expand All @@ -374,8 +374,11 @@ def post_optimise(self, ifail: int):
else:
xnorm = min(
max(
(numerics.xcm[i] - numerics.bondl[i])
/ (numerics.bondu[i] - numerics.bondl[i]),
(numerics.xcm[i] - numerics.itv_scaled_lower_bounds[i])
/ (
numerics.itv_scaled_upper_bounds[i]
- numerics.itv_scaled_lower_bounds[i]
),
0.0,
),
1.0,
Expand Down
6 changes: 3 additions & 3 deletions source/fortran/iteration_variables.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4424,7 +4424,7 @@ subroutine boundxc
!! !
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

use numerics, only: nvar, bondl, bondu, scale, ixc, boundl, boundu
use numerics, only: nvar, itv_scaled_lower_bounds, itv_scaled_upper_bounds, scale, ixc, boundl, boundu

implicit none

Expand All @@ -4435,8 +4435,8 @@ subroutine boundxc
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

do i = 1,nvar
bondl(i) = boundl(ixc(i))*scale(i)
bondu(i) = boundu(ixc(i))*scale(i)
itv_scaled_lower_bounds(i) = boundl(ixc(i))*scale(i)
itv_scaled_upper_bounds(i) = boundu(ixc(i))*scale(i)
end do

end subroutine boundxc
Expand Down
12 changes: 6 additions & 6 deletions source/fortran/numerics.f90
Original file line number Diff line number Diff line change
Expand Up @@ -406,12 +406,12 @@ module numerics
real(dp), dimension(ipnvars) :: boundu
! !! boundu(ipnvars) /../ : upper bounds used on ixc variables

real(dp), dimension(ipnvars) :: bondl
!! Upper bound of the ixc variables scaled to (divided by)
real(dp), dimension(ipnvars) :: itv_scaled_lower_bounds
!! Lower bound of the ixc variables scaled to (divided by)
!! the initial value of the corresponding ixc

real(dp), dimension(ipnvars) :: bondu
!! Lower bound of the ixc variables scaled to (divided by)
real(dp), dimension(ipnvars) :: itv_scaled_upper_bounds
!! Upper bound of the ixc variables scaled to (divided by)
!! the initial value of the corresponding ixc

real(dp), dimension(ipnvars) :: rcm
Expand Down Expand Up @@ -585,8 +585,8 @@ subroutine init_numerics()
! Issue #287 These bounds now defined in initial.f90
boundu = 9.d99

bondl = 0.0D0
bondu = 0.0D0
itv_scaled_lower_bounds = 0.0D0
itv_scaled_upper_bounds = 0.0D0
rcm = 0.0D0
resdl = 0.0D0
scafc = 0.0D0
Expand Down

0 comments on commit 9d6cccc

Please sign in to comment.