def visualize_qpoint_nu(self, qpoint, nu, spin=0, appname="vesta"): iq, qpoint = self._find_iqpt_qpoint(qpoint) # Fortran array nctkarr_t("v1_qnu", "dp", "two, nfft, nspden, natom3, nqlist")]) v1_qnu = self.reader.read_variable("v1_qnu")[iq, nu, spin] v1_qnu = v1_qnu[:, 0] + 1j * v1_qnu[:, 1] #wqnu = self.reader.read_variable["phfreqs"][nu] #v1_qnu /= np.sqrt(2 * wqnu) datar = np.reshape(np.abs(v1_qnu), self.ngfft) visu = Visualizer.from_name(appname) ext = "xsf" if ext not in visu.supported_extensions(): raise ValueError("Visualizer %s does not support XSF files" % visu) from abipy.core.globals import abinb_mkstemp _, filename = abinb_mkstemp(suffix="." + ext, text=True) with open(filename, mode="wt") as fh: if ext == "xsf": xsf.xsf_write_structure(fh, self.structure) xsf.xsf_write_data(fh, self.structure, datar, add_replicas=True) else: raise NotImplementedError("extension %s is not supported." % ext) return visu(filename)
def vesta_open(self, temp=300): # pragma: no cover """ Visualize termal displacement ellipsoids at temperature `temp` (Kelvin) with Vesta_ application. """ filepath = self.write_cif_file(filepath=None, temp=temp) cprint("Writing structure + Debye-Waller tensor in CIF format for T = %s (K) to file: %s" % (temp, filepath), "green") cprint("In the Vesta GUI, select: Properties -> Atoms -> Show as displament ellipsoids.", "green") from abipy.iotools import Visualizer visu = Visualizer.from_name("vesta") return visu(filepath)()
def visualize_ur2(self, spin, kpoint, band, visu_name): """ Visualize :math:`|u(r)|^2` with visualizer. See :class:`Visualizer` for the list of applications and formats supported. """ visu = Visualizer.from_name(visu_name) for ext in visu.supported_extensions(): ext = "." + ext try: return self.export_ur2(ext, spin, kpoint, band, visu=visu) except visu.Error: pass else: raise visu.Error("Don't know how to export data for visualizer %s" % visu_name)
def visualize_ur2(self, spin, kpoint, band, visu_name): """ Visualize :math:`|u(r)|^2` with visualizer. See :class:`Visualizer` for the list of applications and formats supported. """ visu = Visualizer.from_name(visu_name) for ext in visu.supported_extensions(): ext = "." + ext try: return self.export_ur2(ext, spin, kpoint, band, visu=visu) except visu.Error: pass else: raise visu.Error( "Don't know how to export data for visualizer %s" % visu_name)
def visualize(self, appname="ovito"): # pragma: no cover """ Visualize the crystalline structure with visualizer. See :class:`Visualizer` for the list of applications and formats supported. """ if appname == "mayavi": return self.mayaview() # Get the Visualizer subclass from the string. from abipy.iotools import Visualizer visu = Visualizer.from_name(appname) if visu.name != "ovito": raise NotImplementedError("visualizer: %s" % visu.name) filepath = self.write_xdatcar(filepath=None, groupby_type=True) return visu(filepath)()
def visualize(self, appname): """ Visualize data with visualizer. See :class:`Visualizer` for the list of applications and formats supported. """ visu = Visualizer.from_name(appname) # Try to export data to one of the formats supported by the visualizer # Use a temporary file (note "." + ext) for ext in visu.supported_extensions(): ext = "." + ext try: return self.export(ext, visu=visu)() except visu.Error: pass else: raise visu.Error("Don't know how to export data for visualizer %s" % appname)
def visualize(self, visu_name): """ Visualize the crystalline structure with visualizer. See :class:`Visualizer` for the list of applications and formats supported. """ # Get the Visualizer subclass from the string. visu = Visualizer.from_name(visu_name) # Try to export data to one of the formats supported by the visualizer # Use a temporary file (note "." + ext) for ext in visu.supported_extensions(): ext = "." + ext try: return self.export(ext, visu=visu)() except visu.Error: pass else: raise visu.Error("Don't know how to export data for %s" % visu_name)
def visualize(self, visu_name): """ Visualize data with visualizer. See :class:`Visualizer` for the list of applications and formats supported. """ visu = Visualizer.from_name(visu_name) # Try to export data to one of the formats supported by the visualizer # Use a temporary file (note "." + ext) for ext in visu.supported_extensions(): ext = "." + ext try: return self.export(ext, visu=visu) except visu.Error: pass else: raise visu.Error("Don't know how to export data for visualizer %s" % visu_name)
def visualize_ur2(self, structure, visu_name): """ Visualize u(r)**2 visualizer. See :class:`Visualizer` for the list of applications and formats supported. """ # Get the Visualizer subclass from the string. visu = Visualizer.from_name(visu_name) # Try to export data to one of the formats supported by the visualizer # Use a temporary file (note "." + ext) for ext in visu.supported_extensions(): ext = "." + ext try: return self.export_ur2(ext, structure, visu=visu) except visu.Error: pass else: raise visu.Error("Don't know how to export data for %s" % visu_name)
def visualize_ur2(self, appname="vesta"): """ Visualize :math:`|u(r)|^2|`. See :class:`Visualizer` for the list of applications and formats supported. """ # Get the Visualizer subclass from the string. visu = Visualizer.from_name(appname) # Try to export data to one of the formats supported by the visualizer # Use a temporary file (note "." + ext) for ext in visu.supported_extensions(): ext = "." + ext try: return self.export_ur2(ext, visu=visu) except visu.Error: pass else: raise visu.Error("Don't know how to export data for %s" % str(appname))