       <span class="c1"># First calculate the &quot;raw&quot; pairwise similarity of atomic environments</span>
        <span class="n">n_x</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
        <span class="n">n_y</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">y</span><span class="p">)</span>

        <span class="n">C_ij_dict</span> <span class="o">=</span> <span class="