<!-- BaNnErBlUrFlE-BoDy-start -->
<!-- Preheader Text : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">
I needed to add a call to TaoSetFromOptions to get the runtime options to work. I also set grtol from the default value of 1. 0e-7 to 1. 0e-15. The calculation goes for a few iterations, but it looks like it keeps pushing into territory where
</div>
<!-- Preheader Text : END -->
<!-- Email Banner : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">ZjQcmQRYFpfptBannerStart</div>
<!--[if ((ie)|(mso))]>
<table border="0" cellspacing="0" cellpadding="0" width="100%" style="padding: 16px 0px 16px 0px; direction: ltr" ><tr><td>
<table border="0" cellspacing="0" cellpadding="0" style="padding: 0px 10px 5px 6px; width: 100%; border-radius:4px; border-top:4px solid #90a4ae;background-color:#D0D8DC;"><tr><td valign="top">
<table align="left" border="0" cellspacing="0" cellpadding="0" style="padding: 4px 8px 4px 8px">
<tr><td style="color:#000000; font-family: 'Arial', sans-serif; font-weight:bold; font-size:14px; direction: ltr">
This Message Is From an External Sender
</td></tr>
<tr><td style="color:#000000; font-weight:normal; font-family: 'Arial', sans-serif; font-size:12px; direction: ltr">
This message came from outside your organization.
</td></tr>
</table>
</td></tr></table>
</td></tr></table>
<![endif]-->
<![if !((ie)|(mso))]>
<div dir="ltr" id="pfptBanner5gh8t0j" style="all: revert !important; display:block !important; text-align: left !important; margin:16px 0px 16px 0px !important; padding:8px 16px 8px 16px !important; border-radius: 4px !important; min-width: 200px !important; background-color: #D0D8DC !important; background-color: #D0D8DC; border-top: 4px solid #90a4ae !important; border-top: 4px solid #90a4ae;">
<div id="pfptBanner5gh8t0j" style="all: unset !important; float:left !important; display:block !important; margin: 0px 0px 1px 0px !important; max-width: 600px !important;">
<div id="pfptBanner5gh8t0j" style="all: unset !important; display:block !important; visibility: visible !important; background-color: #D0D8DC !important; color:#000000 !important; color:#000000; font-family: 'Arial', sans-serif !important; font-family: 'Arial', sans-serif; font-weight:bold !important; font-weight:bold; font-size:14px !important; line-height:18px !important; line-height:18px">
This Message Is From an External Sender
</div>
<div id="pfptBanner5gh8t0j" style="all: unset !important; display:block !important; visibility: visible !important; background-color: #D0D8DC !important; color:#000000 !important; color:#000000; font-weight:normal; font-family: 'Arial', sans-serif !important; font-family: 'Arial', sans-serif; font-size:12px !important; line-height:18px !important; line-height:18px; margin-top:2px !important;">
This message came from outside your organization.
</div>
</div>
<div style="clear: both !important; display: block !important; visibility: hidden !important; line-height: 0 !important; font-size: 0.01px !important; height: 0px"> </div>
</div>
<![endif]>
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">ZjQcmQRYFpfptBannerEnd</div>
<!-- Email Banner : END -->
<!-- BaNnErBlUrFlE-BoDy-end -->
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head><!-- BaNnErBlUrFlE-HeAdEr-start -->
<style>
#pfptBanner5gh8t0j { all: revert !important; display: block !important;
visibility: visible !important; opacity: 1 !important;
background-color: #D0D8DC !important;
max-width: none !important; max-height: none !important }
.pfptPrimaryButton5gh8t0j:hover, .pfptPrimaryButton5gh8t0j:focus {
background-color: #b4c1c7 !important; }
.pfptPrimaryButton5gh8t0j:active {
background-color: #90a4ae !important; }
</style>
<!-- BaNnErBlUrFlE-HeAdEr-end -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Aptos;
panose-1:2 11 0 4 2 2 2 2 2 4;}
@font-face
{font-family:Menlo;
panose-1:2 11 6 9 3 8 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:12.0pt;
font-family:"Aptos",sans-serif;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Aptos",sans-serif;
color:windowtext;}
p.p1, li.p1, div.p1
{mso-style-name:p1;
margin:0in;
font-size:8.5pt;
font-family:Menlo;
color:black;}
span.s1
{mso-style-name:s1;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="#467886" vlink="#96607D" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">I needed to add a call to TaoSetFromOptions to get the runtime options to work. I also set grtol from the default value of 1.0e-7 to 1.0e-15. The calculation goes for a few iterations, but it looks like it
keeps pushing into territory where the objective function blows up. It eventually quits with a line search error. The complete output from both the runtime options and the TaoView command looks like<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">4 TAO,</span><span class="apple-converted-space">
</span><span class="s1">Function value: 9.24265e+85,</span><span class="apple-converted-space">
</span><span class="s1">Residual: 3.11789e+76</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">TAO</span><span class="apple-converted-space">
</span><span class="s1">solve did not converge due to DIVERGED_LS_FAILURE iteration 4</span><o:p></o:p></p>
<p class="p1"><span class="s1">Tao Object: 1 MPI process</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">type: cg</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">CG Type: prp</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">Gradient steps: 0</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">Reset steps: 4</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">TaoLineSearch Object: 1 MPI process</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">type: more-thuente</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">maximum function evaluations=30</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">tolerances: ftol=0.0001, rtol=1e-10, gtol=0.9</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">total number of function evaluations=0</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">total number of gradient evaluations=0</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">total number of function/gradient evaluations=0</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">Termination reason: -3</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">convergence tolerances: gatol=1e-08,
</span><span class="apple-converted-space"> </span><span class="s1">steptol=0., </span>
<span class="apple-converted-space"> </span><span class="s1">gttol=0.</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">Residual in Function/Gradient:=3.11789e+76</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">Objective value=9.24265e+85</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">total number of iterations=4,</span><span class="apple-converted-space">
</span><span class="s1">(max: 100)</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">total number of function/gradient evaluations=20,</span><span class="apple-converted-space">
</span><span class="s1">(max: 4000)</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span><span class="s1">Solver terminated: -6
</span><span class="apple-converted-space"> </span><span class="s1">Line Search Failure</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I’ll have to bite the bullet and convert everything into ps, nm, and au to get values down to a range where they are all of order 1 to get this to work.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Bruce<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="color:black">From:
</span></b><span style="color:black">Jed Brown <jed@jedbrown.org><br>
<b>Date: </b>Wednesday, June 26, 2024 at 3:02</span><span style="font-family:"Arial",sans-serif;color:black"> </span><span style="color:black">PM<br>
<b>To: </b>Palmer, Bruce J <Bruce.Palmer@pnnl.gov>, Barry Smith <bsmith@petsc.dev><br>
<b>Cc: </b>petsc-users@mcs.anl.gov <petsc-users@mcs.anl.gov><br>
<b>Subject: </b>Re: [petsc-users] Unconstrained optimization question<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">You can use the PETSC_OPTIONS environment variable to specify options if you don't pass the command line arguments through.<br>
<br>
You can set -tao_grtol smaller to handle this difference in scales between the objective and the gradient, though applying some nondimensionalization/choice of appropriate units is still recommended.<br>
<br>
"Palmer, Bruce J via petsc-users" <petsc-users@mcs.anl.gov> writes:<br>
<br>
> This is a fortran code that doesn’t make use of argc,argv (I tried running with the runtime options anyway, in case you implemented some magic I’m not familiar with, but didn’t see anything new in the output). I have a call to TaoView(tao, PETSC_VIEWER_STDOUT_SELF,ierr)
in the code and it reports back<br>
><br>
><br>
><br>
> Tao Object: 1 MPI process<br>
><br>
> type: cg<br>
><br>
> CG Type: prp<br>
><br>
> Gradient steps: 0<br>
><br>
> Reset steps: 0<br>
><br>
> TaoLineSearch Object: 1 MPI process<br>
><br>
> type: more-thuente<br>
><br>
> maximum function evaluations=30<br>
><br>
> tolerances: ftol=0.0001, rtol=1e-10, gtol=0.9<br>
><br>
> total number of function evaluations=0<br>
><br>
> total number of gradient evaluations=0<br>
><br>
> total number of function/gradient evaluations=0<br>
><br>
> Termination reason: 0<br>
><br>
> convergence tolerances: gatol=1e-08, steptol=0., gttol=0.<br>
><br>
> Residual in Function/Gradient:=7.54237e+75<br>
><br>
> Objective value=2.96082e+86<br>
><br>
> total number of iterations=0, (max: 100)<br>
><br>
> total number of function/gradient evaluations=1, (max: 4000)<br>
><br>
> Solution converged: ||g(X)||/|f(X)| <= grtol<br>
><br>
><br>
><br>
> Bruce<br>
><br>
> From: Barry Smith <bsmith@petsc.dev><br>
> Date: Wednesday, June 26, 2024 at 2:02</span><span style="font-size:11.0pt;font-family:"Arial",sans-serif"> </span><span style="font-size:11.0pt">PM<br>
> To: Palmer, Bruce J <Bruce.Palmer@pnnl.gov><br>
> Cc: petsc-users@mcs.anl.gov <petsc-users@mcs.anl.gov><br>
> Subject: Re: [petsc-users] Unconstrained optimization question<br>
> Check twice before you click! This email originated from outside PNNL.<br>
><br>
><br>
> Please run with -tao_monitor -tao_converged_reason and see why it has stopped.<br>
><br>
> Barry<br>
><br>
><br>
><br>
> On Jun 26, 2024, at 4:34</span><span style="font-size:11.0pt;font-family:"Arial",sans-serif"> </span><span style="font-size:11.0pt">PM, Palmer, Bruce J via petsc-users <petsc-users@mcs.anl.gov> wrote:<br>
><br>
> This Message Is From an External Sender<br>
> This message came from outside your organization.<br>
> Hi,<br>
><br>
> I’m trying to do an unconstrained optimization on a molecular scale problem. Previously, I was looking at an artificial molecular problem where all parameters were of order 1 and so the objective function and variables were also in the range of 1 or at least
within a few orders of magnitude of 1.<br>
><br>
> More recently, I’ve been trying to apply this optimization to a real molecular system. Between Avogadro’s number (6.022e23) and Boltzmann’s constant (1.38e-16) combined with very small distances (1.0e-8 cm), etc. the objective function values and the values
of the optimization variables have very large values (~1e86 and ~1e9, respectively). I’ve verified that the analytic gradients of the objective function that I’m calculating are correct by comparing them with numerical derivatives.<br>
><br>
> I’ve tried using the LMVM and Conjugate Gradient optimizations, both of which worked previously, but I find that the optimization completes one objective function evaluation and then declares that the problem is converged and stops. I could find a set of
units where everything is approximately 1 but I was hoping that there are some parameters I can set in the optimization that will get it moving again. Any suggestions?<br>
><br>
> Bruce Palmer<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</body>
</html>