<div>Hello Zack,</div><div>the code that computes the IR cross sections is in subroutine RamanIR at line 150 of file LR_Modules/dynmatsub.f90. If you ignore the Raman parts, it is literally 10 lines:</div><br><div><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">do</span></font><font style="font-family:monospace"> nu </font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">=</span></font><font style="font-family:monospace"> </font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">1</span></font><font style="font-family:monospace">,</font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">3</span></font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">*</span></font><font style="font-family:monospace">nat</font></div><div><font style="font-family:monospace">   </font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">do</span></font><font style="font-family:monospace"> ipol</font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">=</span></font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">1</span></font><font style="font-family:monospace">,</font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">3</span></font></div><div><font style="font-family:monospace">      polar(ipol)</font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">=</span></font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">0.0d0</span></font></div><div><font style="font-family:monospace">   </font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">end do</span></font></div><div><font style="font-family:monospace">   </font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">do</span></font><font style="font-family:monospace"> na</font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">=</span></font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">1</span></font><font style="font-family:monospace">,nat</font></div><div><font style="font-family:monospace">      </font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">do</span></font><font style="font-family:monospace"> ipol</font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">=</span></font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">1</span></font><font style="font-family:monospace">,</font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">3</span></font></div><div><font style="font-family:monospace">         </font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">do</span></font><font style="font-family:monospace"> jpol</font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">=</span></font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">1</span></font><font style="font-family:monospace">,</font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">3</span></font></div><div><font style="font-family:monospace">            polar(ipol) </font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">=</span></font><font style="font-family:monospace"> polar(ipol) </font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">+</span></font><font style="font-family:monospace">  </font><font style="font-family:monospace"><span style="color:rgb(178, 24, 178)">&</span></font></div><div><font style="font-family:monospace">                 zstar(ipol,jpol,na)</font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">*</span></font><font style="font-family:monospace">z((na</font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">-</span></font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">1</span></font><font style="font-family:monospace">)</font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">*</span></font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">3</span></font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">+</span></font><font style="font-family:monospace">jpol,nu)</font></div><div><font style="font-family:monospace">         </font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">end do</span></font></div><div><font style="font-family:monospace">      </font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">end do</span></font></div><div><font style="font-family:monospace">   </font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">end do</span></font></div><br><div><font style="font-family:monospace">   infrared(nu) </font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">=</span></font><font style="font-family:monospace"> </font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">2.d0</span></font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">*</span></font><font style="font-family:monospace">(polar(</font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">1</span></font><font style="font-family:monospace">)</font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">**</span></font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">2</span></font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">+</span></font><font style="font-family:monospace">polar(</font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">2</span></font><font style="font-family:monospace">)</font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">**</span></font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">2</span></font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">+</span></font><font style="font-family:monospace">polar(</font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">3</span></font><font style="font-family:monospace">)</font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">**</span></font><font style="font-family:monospace"><span style="color:rgb(178, 24, 24)">2</span></font><font style="font-family:monospace">)</font><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">*</span></font><font style="font-family:monospace">irfac</font></div><br><div><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">... some raman stuff ...</span></font></div><div><font style="font-family:monospace"><span style="color:rgb(175, 95, 0)">endo do</span></font></div><br><div>It should be straightforward to adapt it to whatever you need. Keeping in mind that "zstar" is the effective charge matrix of atom "na" and z(3nat, 3nat) is the matrix of phonon polarizations.</div><br><div>Otherwise, you can have z printed by dynmat by setting the variable</div><div><font style="font-family:monospace"><span style="color:rgb(24, 24, 178)">fileig = 'file_name.txt'</span></font></div><div>and then do the calculation in some other way.</div><br><div>hth</div><br><div><signature id="initial">Dr. Lorenzo Paulatto<br>IdR @ IMPMC - CNRS UMR 7590 & Sorbonne Université<br>phone: +33 (0)1 442 79822 / skype: paulatz<br><a href="http://www.impmc.upmc.fr/~paulatto/">http://www.impmc.upmc.fr/~paulatto/</a> - <a href="https://anharmonic.github.io/">https://anharmonic.github.io/</a><br>23-24/423 B115, 4 place Jussieu 75252 Paris CX 05</signature></div><div class="gmail_quote_attribution">On Mar 18 2022, at 6:23 am, Zack Gainsforth <zackg@berkeley.edu> wrote:</div><blockquote><div><div>Hi All,</div><br><div>I have set up a calculation using pw.x -> ph.x -> dynmat.x successfully and plotted myself an IR spectrum. The match to the experimental spectrum is good. However, this is an IR spectrum assuming a powder where the photons are exciting all the modes. I’d now like to calculate the spectrum for a single crystal and specify the electric vector of the photon relative to the crystal. It should preferentially excite certain modes.</div><br><div>Is there a straightforward way to do this using ph.x + dynmat.x? Or perhaps a way to read/print the dipole vectors for each mode so I can dot it with my photon’s e-field? Or another way of thinking about this which is more efficient? (Maybe I missed something in the documentation!)</div><br><div>Thanks,</div><br><div>Zack</div><br><div>_______________________________________________</div><div>The Quantum ESPRESSO community stands by the Ukrainian</div><div>people and expresses its concerns about the devastating</div><div>effects that the Russian military offensive has on their</div><div>country and on the free and peaceful scientific, cultural,</div><div>and economic cooperation amongst peoples</div><div>_______________________________________________</div><div>Quantum ESPRESSO is supported by MaX (www.max-centre.eu)</div><div>users mailing list users@lists.quantum-espresso.org</div><div>https://lists.quantum-espresso.org/mailman/listinfo/users</div></div></blockquote><img class="mailspring-open" alt="Sent from Mailspring" width="0" height="0" style="border:0; width:0; height:0;" src="https://link.getmailspring.com/open/33126745-AFA1-4118-A46A-0448EA0D69FA@getmailspring.com?me=ca1a67e4&recipient=dXNlcnNAbGlzdHMucXVhbnR1bS1lc3ByZXNzby5vcmc%3D">