## phonopy-users

 [Phonopy-users] freq vs q-distance as a table From: Iyad AL-QASIR - 2012-10-03 19:40:53 Attachments: Message as HTML ```Dear Phonopy Users, Moving from Phonpy-1.3 to Phonopy-1.5 some changes ( toward better) have been made. I am using mainly phonopy as a python module. In my *.py file to get the phonon dispersions ( Freq vs q-distance), I had this part of code do that (Thanks to A. Togo he helped in that), phonon.set_band_structure(bands,is_eigenvectors=True) dispersion=phonon.get_band_structure() phonon.write_yaml_band_structure() distances=dispersion[0] eigenvalues=dispersion[2] for eigs_at_index in eigenvalues.T: freq=[-np.sqrt(-x) if x<0 else np.sqrt(x) for x in eigs_at_index] for d,f in zip(distances, freq): print d,f*VasptoTHz print print However, in Phonopy-1.5 this will not work since some changes made in order of distances, eigen values, ... It would be grate if the above piece of code is corrected so it will give me the dispersions in a table as a function of q-distance. Thanks, ___________________________ IYAD I. AL-QASIR, PhD Postdoc Research Associate X-Ray and Neutron Scattering and Spectroscopy Group Materials Science and Technology Division Oak Ridge National Lab Oak Ridge, TN ```
 Re: [Phonopy-users] freq vs q-distance as a table From: Atsushi Togo - 2012-10-04 03:48:07 Attachments: Al2O3.py ```Hi, I'm sorry for that I didn't mention in detail about it. Currently, get_band_structure is defined as follows: def get_band_structure(self): band = self._band_structure return (band.get_qpoints(), band.get_distances(), band.get_frequencies(), band.get_eigenvectors()) So, you would obtain a list (tuple) of qpoints, distances, frequencies, eigenvectors. Now each element of this list is a set of quantities of band segments. The unit conversion factor is multiplied in the phonopy module. VasptoTHz is the default value of it, so you don't need to multiply by yourself if your unit conversion factor is this. An example of code script is shown below. bands = phonon.get_band_structure() distances = bands[1] frequencies = bands[2] qpoints = bands[0] for (qs_at_segments, dists_at_segments, freqs_at_segments) in zip(qpoints, distances, frequencies): for q, d, f in zip(qs_at_segments, dists_at_segments, freqs_at_segments): print "# %f %f %f" % tuple(q) print d, ("%f " * len(f)) % tuple(f) I attach an example for workable with example/Al2O3, too. Togo On Thu, Oct 4, 2012 at 4:40 AM, Iyad AL-QASIR wrote: > Dear Phonopy Users, > > Moving from Phonpy-1.3 to Phonopy-1.5 some changes ( toward better) have > been made. > > I am using mainly phonopy as a python module. In my *.py file to get the > phonon dispersions ( Freq vs q-distance), I had this part of code do that > (Thanks to A. Togo he helped in that), > > phonon.set_band_structure(bands,is_eigenvectors=True) > dispersion=phonon.get_band_structure() > phonon.write_yaml_band_structure() > distances=dispersion[0] > eigenvalues=dispersion[2] > for eigs_at_index in eigenvalues.T: > freq=[-np.sqrt(-x) if x<0 else np.sqrt(x) for x in eigs_at_index] > for d,f in zip(distances, freq): > print d,f*VasptoTHz > print > print > > > However, in Phonopy-1.5 this will not work since some changes made in order > of distances, eigen values, ... > > It would be grate if the above piece of code is corrected so it will give me > the dispersions in a table as a function of q-distance. > > Thanks, > ___________________________ > IYAD I. AL-QASIR, PhD > Postdoc Research Associate > > X-Ray and Neutron Scattering and Spectroscopy Group > Materials Science and Technology Division > Oak Ridge National Lab > Oak Ridge, TN > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > Phonopy-users mailing list > Phonopy-users@... > https://lists.sourceforge.net/lists/listinfo/phonopy-users > -- Atsushi Togo http://atztogo.users.sourceforge.net/ atz.togo@... ```
 Re: [Phonopy-users] freq vs q-distance as a table From: Iyad AL-QASIR - 2012-10-12 00:22:54 Attachments: Message as HTML ```Dear Dr. Togo, Using Phonopy-1.5 gives points, distances, frequencies, and polarization vectors as a tuple. How can I get the frequencies and polarization vectors as array, so I can define each frequency by two indices, one for q number ( let us say i) and the other for branch number ( let us say j), such that freq[i][j], That is, in similar way to older versions. I need that so I can make direct comparison with measured data or calculating differences. Indeed, I highly apprecatie and aknowldge the new modiications and updates in the latest version of phonopy. Thanks a lot, IYAD On Wed, Oct 3, 2012 at 11:47 PM, Atsushi Togo wrote: > Hi, > > I'm sorry for that I didn't mention in detail about it. Currently, > get_band_structure is defined as follows: > > def get_band_structure(self): > band = self._band_structure > return (band.get_qpoints(), > band.get_distances(), > band.get_frequencies(), > band.get_eigenvectors()) > > So, you would obtain a list (tuple) of qpoints, distances, > frequencies, eigenvectors. > Now each element of this list is a set of quantities of band segments. > The unit conversion factor is multiplied in the phonopy module. > VasptoTHz is the default value of it, so you don't need to multiply by > yourself if your unit conversion factor is this. > > An example of code script is shown below. > > bands = phonon.get_band_structure() > distances = bands[1] > frequencies = bands[2] > qpoints = bands[0] > for (qs_at_segments, > dists_at_segments, > freqs_at_segments) in zip(qpoints, distances, frequencies): > > for q, d, f in zip(qs_at_segments, > dists_at_segments, > freqs_at_segments): > print "# %f %f %f" % tuple(q) > print d, ("%f " * len(f)) % tuple(f) > > I attach an example for workable with example/Al2O3, too. > > Togo > > > On Thu, Oct 4, 2012 at 4:40 AM, Iyad AL-QASIR wrote: > > Dear Phonopy Users, > > > > Moving from Phonpy-1.3 to Phonopy-1.5 some changes ( toward better) have > > been made. > > > > I am using mainly phonopy as a python module. In my *.py file to get the > > phonon dispersions ( Freq vs q-distance), I had this part of code do that > > (Thanks to A. Togo he helped in that), > > > > phonon.set_band_structure(bands,is_eigenvectors=True) > > dispersion=phonon.get_band_structure() > > phonon.write_yaml_band_structure() > > distances=dispersion[0] > > eigenvalues=dispersion[2] > > for eigs_at_index in eigenvalues.T: > > freq=[-np.sqrt(-x) if x<0 else np.sqrt(x) for x in eigs_at_index] > > for d,f in zip(distances, freq): > > print d,f*VasptoTHz > > print > > print > > > > > > However, in Phonopy-1.5 this will not work since some changes made in > order > > of distances, eigen values, ... > > > > It would be grate if the above piece of code is corrected so it will > give me > > the dispersions in a table as a function of q-distance. > > > > Thanks, > > ___________________________ > > IYAD I. AL-QASIR, PhD > > Postdoc Research Associate > > > > X-Ray and Neutron Scattering and Spectroscopy Group > > Materials Science and Technology Division > > Oak Ridge National Lab > > Oak Ridge, TN > > > > > > > ------------------------------------------------------------------------------ > > Don't let slow site performance ruin your business. Deploy New Relic APM > > Deploy New Relic app performance management and know exactly > > what is happening inside your Ruby, Python, PHP, Java, and .NET app > > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > > http://p.sf.net/sfu/newrelic-dev2dev > > _______________________________________________ > > Phonopy-users mailing list > > Phonopy-users@... > > https://lists.sourceforge.net/lists/listinfo/phonopy-users > > > > > > -- > Atsushi Togo > http://atztogo.users.sourceforge.net/ > atz.togo@... > -- ___________________________ IYAD I. AL-QASIR, PhD Postdoc Research Associate X-Ray and Neutron Scattering and Spectroscopy Group Materials Science and Technology Division Oak Ridge National Lab Oak Ridge, TN ```
 Re: [Phonopy-users] freq vs q-distance as a table From: Atsushi Togo - 2012-10-12 02:03:13 Attachments: Al2O3.py ```Hi, I don't understand what you want exactly, but if you mean you want to combine all segments, you can use numpy.concatenate, numpy.vstack and numpy.hstack. I attach an example for Al2O3 that can run on the directory of example/Al2O3. phonon.set_band_structure(bands, is_eigenvectors=True) bands = phonon.get_band_structure() distances = bands[1] frequencies = bands[2] eigvecs = bands[3] qpoints = bands[0] all_freqs = np.vstack(frequencies) all_qs = np.vstack(qpoints) all_dists = np.hstack(distances) all_eigvecs = np.concatenate(eigvecs) Togo On Fri, Oct 12, 2012 at 9:22 AM, Iyad AL-QASIR wrote: > Dear Dr. Togo, > > Using Phonopy-1.5 gives points, distances, frequencies, and polarization > vectors as a tuple. > > How can I get the frequencies and polarization vectors as array, so I can > define each frequency by two indices, one for q number ( let us say i) and > the other for branch number ( let us say j), such that freq[i][j], That is, > in similar way to older versions. I need that so I can make direct > comparison with measured data or calculating differences. > > Indeed, I highly apprecatie and aknowldge the new modiications and updates > in the latest version of phonopy. > > > Thanks a lot, > IYAD > > > > > > On Wed, Oct 3, 2012 at 11:47 PM, Atsushi Togo wrote: >> >> Hi, >> >> I'm sorry for that I didn't mention in detail about it. Currently, >> get_band_structure is defined as follows: >> >> def get_band_structure(self): >> band = self._band_structure >> return (band.get_qpoints(), >> band.get_distances(), >> band.get_frequencies(), >> band.get_eigenvectors()) >> >> So, you would obtain a list (tuple) of qpoints, distances, >> frequencies, eigenvectors. >> Now each element of this list is a set of quantities of band segments. >> The unit conversion factor is multiplied in the phonopy module. >> VasptoTHz is the default value of it, so you don't need to multiply by >> yourself if your unit conversion factor is this. >> >> An example of code script is shown below. >> >> bands = phonon.get_band_structure() >> distances = bands[1] >> frequencies = bands[2] >> qpoints = bands[0] >> for (qs_at_segments, >> dists_at_segments, >> freqs_at_segments) in zip(qpoints, distances, frequencies): >> >> for q, d, f in zip(qs_at_segments, >> dists_at_segments, >> freqs_at_segments): >> print "# %f %f %f" % tuple(q) >> print d, ("%f " * len(f)) % tuple(f) >> >> I attach an example for workable with example/Al2O3, too. >> >> Togo >> >> >> On Thu, Oct 4, 2012 at 4:40 AM, Iyad AL-QASIR wrote: >> > Dear Phonopy Users, >> > >> > Moving from Phonpy-1.3 to Phonopy-1.5 some changes ( toward better) have >> > been made. >> > >> > I am using mainly phonopy as a python module. In my *.py file to get the >> > phonon dispersions ( Freq vs q-distance), I had this part of code do >> > that >> > (Thanks to A. Togo he helped in that), >> > >> > phonon.set_band_structure(bands,is_eigenvectors=True) >> > dispersion=phonon.get_band_structure() >> > phonon.write_yaml_band_structure() >> > distances=dispersion[0] >> > eigenvalues=dispersion[2] >> > for eigs_at_index in eigenvalues.T: >> > freq=[-np.sqrt(-x) if x<0 else np.sqrt(x) for x in eigs_at_index] >> > for d,f in zip(distances, freq): >> > print d,f*VasptoTHz >> > print >> > print >> > >> > >> > However, in Phonopy-1.5 this will not work since some changes made in >> > order >> > of distances, eigen values, ... >> > >> > It would be grate if the above piece of code is corrected so it will >> > give me >> > the dispersions in a table as a function of q-distance. >> > >> > Thanks, >> > ___________________________ >> > IYAD I. AL-QASIR, PhD >> > Postdoc Research Associate >> > >> > X-Ray and Neutron Scattering and Spectroscopy Group >> > Materials Science and Technology Division >> > Oak Ridge National Lab >> > Oak Ridge, TN >> > >> > >> > >> > ------------------------------------------------------------------------------ >> > Don't let slow site performance ruin your business. Deploy New Relic APM >> > Deploy New Relic app performance management and know exactly >> > what is happening inside your Ruby, Python, PHP, Java, and .NET app >> > Try New Relic at no cost today and get our sweet Data Nerd shirt too! >> > http://p.sf.net/sfu/newrelic-dev2dev >> > _______________________________________________ >> > Phonopy-users mailing list >> > Phonopy-users@... >> > https://lists.sourceforge.net/lists/listinfo/phonopy-users >> > >> >> >> >> -- >> Atsushi Togo >> http://atztogo.users.sourceforge.net/ >> atz.togo@... > > > > > -- > ___________________________ > IYAD I. AL-QASIR, PhD > Postdoc Research Associate > > X-Ray and Neutron Scattering and Spectroscopy Group > Materials Science and Technology Division > Oak Ridge National Lab > Oak Ridge, TN > -- Atsushi Togo http://atztogo.users.sourceforge.net/ atz.togo@... ```