<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://sobereva.com/wfnbbs/extern.php?action=feed&amp;tid=488&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Multiwfn forum / IRI values are inverted compared to IRI paper?]]></title>
		<link>http://sobereva.com/wfnbbs/viewtopic.php?id=488</link>
		<description><![CDATA[The most recent posts in IRI values are inverted compared to IRI paper?.]]></description>
		<lastBuildDate>Wed, 05 May 2021 02:22:53 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: IRI values are inverted compared to IRI paper?]]></title>
			<link>http://sobereva.com/wfnbbs/viewtopic.php?pid=1754#p1754</link>
			<description><![CDATA[<p>Thank you for your attention to IRI.</p><p>Please note that definition of IRI has been changed in Multiwfn 3.8(dev) compared to Multiwfn 3.7.<br />IRI paper has been published very recently on Chemistry-Methods journal, see <a href="https://doi.org/10.1002/cmtd.202100007" rel="nofollow">https://doi.org/10.1002/cmtd.202100007</a>. The definition of the IRI in this paper is fully in line with latest Multiwfn version on Multiwfn website.</p><p>The code for evaluating IRI is &quot;function IRIfunc&quot; in function.f90 in Multiwfn source code package.</p>]]></description>
			<author><![CDATA[dummy@example.com (sobereva)]]></author>
			<pubDate>Wed, 05 May 2021 02:22:53 +0000</pubDate>
			<guid>http://sobereva.com/wfnbbs/viewtopic.php?pid=1754#p1754</guid>
		</item>
		<item>
			<title><![CDATA[IRI values are inverted compared to IRI paper?]]></title>
			<link>http://sobereva.com/wfnbbs/viewtopic.php?pid=1745#p1745</link>
			<description><![CDATA[<p>When I look at the sections plots (figure 4c in <a href="https://chemrxiv.org/articles/preprint/Interaction_Region_Indicator_IRI_A_Very_Simple_Real_Space_Function_Clearly_Revealing_Both_Chemical_Bonds_and_Weak_Interactions/13591142)" rel="nofollow">https://chemrxiv.org/articles/preprint/ … /13591142)</a><br />the IRI value is above 2 when going far away from the molecule and in the atom cores, but when I use multiwfn tool to calculate IRI and visualize the IRI with VESTA, it looks like the IRI value goes to 0 far away from the molecule and in the atom cores.<br />How is the IRI calculated in multiwfn? Do you use the default value of a=1.1?</p><p>I have tried to also calculate IRI using numerical differentation from a file calculated with Gaussian cubegen and here it follows the convention in the paper (large values in cores and outside molecule and small values for the bonds).</p><p>Below is the Python script I use to compute IRI numerically after converting using cubegen:<br />cubegen 10&#160; Density=SCF&#160; qm9_000214_PBE1PBE_pcS-3.fchk qm9_000214_PBE1PBE_pcS-3_scf.cube -10</p><p>For some reason, the result I get from Cubegen-&gt;cube_to_iri.py does not look the same as when I use multiwfn directly.<br />Here are the two examples illustrated with VESTA. In both cases the scale is 0-&gt;2 where 0 is blue and red is 2.<br /><span class="postimg"><img src="https://i.imgur.com/8LPgF8U.png" alt="8LPgF8U.png" /></span></p><p>Any idea what the problem here is?</p><div class="codebox"><pre class="vscroll"><code>import sys
import os
import io

import numpy as np
import ase
import ase.io
import ase.io.cube
from ase.calculators.vasp import VaspChargeDensity

def main():
    if len(sys.argv) &gt; 1:
        cubefilepath = sys.argv[1]
    else:
        print(&quot;Usage: python cube_to_iri.py cube_file_path&quot;)
        sys.exit(1)

    if cubefilepath.endswith(&quot;.cube&quot;):
        density, atoms, origin = read_cube(cubefilepath)
    else:
        density, atoms, origin = read_vasp(cubefilepath)

    cell = atoms.get_cell()

    if not cell.orthorhombic:
        print(&quot;Only works with orthorombic cell&quot;)
        sys.exit(1)

    step_sizes = cell.lengths()/density.shape[0:3]
    print(step_sizes)

    grad = np.gradient(density, *step_sizes)

    ##
    ## IRI(r) = ||grad(p(r))||/(p(r)**a)
    ##
    norm_grad = np.linalg.norm(grad, axis=0)
    a = 1.1 # Default value for a in IRI
    iri = norm_grad / (np.abs(density) ** 1.1)

    with open(&quot;iri.cube&quot;, &quot;w&quot;) as f:
        ase.io.cube.write_cube(f, atoms, iri, origin, &quot;IRI computed by finite difference&quot;)

def read_vasp(filepath):
    vasp_charge = VaspChargeDensity(filename=filepath)
    density = vasp_charge.chg[-1]  # separate density
    atoms = vasp_charge.atoms[-1]  # separate atom positions

    return density, atoms, np.zeros(3)  # TODO: Can we always assume origin at 0,0,0?


def read_cube(filepath):
    with open(filepath, &quot;r&quot;) as f:
        cube = ase.io.cube.read_cube(f)
    # sometimes there is an entry at index 3
    # denoting the number of values for each grid position
    origin = cube[&quot;origin&quot;][0:3]
    # by convention the cube electron density is given in electrons/Bohr^3,
    # and ase read_cube does not convert to electrons/Å^3, so we do the conversion here
    cube[&quot;data&quot;] *= 1.0 / ase.units.Bohr ** 3
    return cube[&quot;data&quot;], cube[&quot;atoms&quot;], origin

if __name__ == &quot;__main__&quot;:
    main()</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (pbjo)]]></author>
			<pubDate>Wed, 28 Apr 2021 12:41:17 +0000</pubDate>
			<guid>http://sobereva.com/wfnbbs/viewtopic.php?pid=1745#p1745</guid>
		</item>
	</channel>
</rss>
