<div dir="ltr"><div>Dear Aniruddha,</div><div><br></div><div>Since you haven't provided a minimal example, nor the error message you're getting</div><div>from ASE or CP2K, I haven't looked into debugging the (bulky) example you sent.</div><br><div>But I don't think you can do the geometry optimization in this way. ASE uses the cp2k_shell binary,</div><div>which seems to only perform single-point calculations but not e.g. geometry optimizations.</div><div><br></div><div>The idea behind cp2k_shell is that the 'driver' (in this case ASE) is the one moving the atoms</div><div>around, and what CP2K does is e.g. calculating the energy and the gradients for a given geometry.<br></div><div><br></div><div>Here is a minimal example of a geometry optimization, and you can work your way up</div><div>from there:</div><div><br></div><div><div style="background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; overflow-wrap: break-word;" class="prettyprint"><code class="prettyprint"><div class="subprettyprint"><div><span style="color: #008;" class="styled-by-prettify">from</span><span style="color: #000;" class="styled-by-prettify"> ase</span><span style="color: #660;" class="styled-by-prettify">.</span><span style="color: #000;" class="styled-by-prettify">build </span><span style="color: #008;" class="styled-by-prettify">import</span><span style="color: #000;" class="styled-by-prettify"> molecule<br></span><span style="color: #008;" class="styled-by-prettify">from</span><span style="color: #000;" class="styled-by-prettify"> ase</span><span style="color: #660;" class="styled-by-prettify">.</span><span style="color: #000;" class="styled-by-prettify">calculators</span><span style="color: #660;" class="styled-by-prettify">.</span><span style="color: #000;" class="styled-by-prettify">cp2k </span><span style="color: #008;" class="styled-by-prettify">import</span><span style="color: #000;" class="styled-by-prettify"> CP2K<br></span><span style="color: #008;" class="styled-by-prettify">from</span><span style="color: #000;" class="styled-by-prettify"> ase</span><span style="color: #660;" class="styled-by-prettify">.</span><span style="color: #000;" class="styled-by-prettify">optimize </span><span style="color: #008;" class="styled-by-prettify">import</span><span style="color: #000;" class="styled-by-prettify"> BFGS<br><br>atoms </span><span style="color: #660;" class="styled-by-prettify">=</span><span style="color: #000;" class="styled-by-prettify"> molecule</span><span style="color: #660;" class="styled-by-prettify">(</span><span style="color: #080;" class="styled-by-prettify">'H2O'</span><span style="color: #660;" class="styled-by-prettify">)</span><span style="color: #000;" class="styled-by-prettify"><br>atoms</span><span style="color: #660;" class="styled-by-prettify">.</span><span style="color: #000;" class="styled-by-prettify">center</span><span style="color: #660;" class="styled-by-prettify">(</span><span style="color: #000;" class="styled-by-prettify">vacuum</span><span style="color: #660;" class="styled-by-prettify">=</span><span style="color: #066;" class="styled-by-prettify">2.0</span><span style="color: #660;" class="styled-by-prettify">)</span><span style="color: #000;" class="styled-by-prettify"><br><br>calc </span><span style="color: #660;" class="styled-by-prettify">=</span><span style="color: #000;" class="styled-by-prettify"> CP2K</span><span style="color: #660;" class="styled-by-prettify">(</span><span style="color: #000;" class="styled-by-prettify">command</span><span style="color: #660;" class="styled-by-prettify">=</span><span style="color: #080;" class="styled-by-prettify">'cp2k_shell.sopt'</span><span style="color: #660;" class="styled-by-prettify">)</span><span style="color: #000;" class="styled-by-prettify"><br>atoms</span><span style="color: #660;" class="styled-by-prettify">.</span><span style="color: #000;" class="styled-by-prettify">set_calculator</span><span style="color: #660;" class="styled-by-prettify">(</span><span style="color: #000;" class="styled-by-prettify">calc</span><span style="color: #660;" class="styled-by-prettify">)</span><span style="color: #000;" class="styled-by-prettify"><br><br>dyn </span><span style="color: #660;" class="styled-by-prettify">=</span><span style="color: #000;" class="styled-by-prettify"> BFGS</span><span style="color: #660;" class="styled-by-prettify">(</span><span style="color: #000;" class="styled-by-prettify">atoms</span><span style="color: #660;" class="styled-by-prettify">)</span><span style="color: #000;" class="styled-by-prettify"><br>dyn</span><span style="color: #660;" class="styled-by-prettify">.</span><span style="color: #000;" class="styled-by-prettify">run</span><span style="color: #660;" class="styled-by-prettify">(</span><span style="color: #000;" class="styled-by-prettify">fmax</span><span style="color: #660;" class="styled-by-prettify">=</span><span style="color: #066;" class="styled-by-prettify">0.05</span><span style="color: #660;" class="styled-by-prettify">)</span><span style="color: #000;" class="styled-by-prettify"><br></span></div></div></code></div><br></div><div>Best regards,</div><div>Maxime<br></div></div>