Get the bandgap from the DOSCAR file
3610
def _get_bandgap_doscar(filename):
        """"""
        with open(filename) as fp:
            for i in range(6):
                l = fp.readline()
            efermi = float(l.split()[3])
            step1 = fp.readline().split()[0]
            step2 = fp.readline().split()[0]
            step_size = float(step2)-float(step1)
            not_found = True
            while not_found:
                l = fp.readline().split()
                e = float(l.pop(0))
                dens = 0.0
                for i in range(int(len(l)/2)):
                    dens += float(l[i])
                if e < efermi and dens > 1e-3:
                    bot = e
                elif e > efermi and dens > 1e-3:
                    top = e
                    not_found = False
            if top - bot < step_size*2:
                bandgap = 0.0
            else:
                bandgap = float(top - bot)

        return bandgap
10840
function getThemeFromPath(dir, program, cb) {
        var configPath = path.resolve(dir, "theme.json");
        program.log(2, constants.LOG_SEV_INFO, "Attempting to read " + configPath);
        fs.readFile(configPath, { encoding: 'utf-8' }, function (err, data) {
            if (err) {
                program.log(1, constants.LOG_SEV_ERROR, "Error reading " + configPath);
                return cb(err);
            }
            var config;
            try {
                config = eval('(' + data + ')');
            } catch (e) {
                program.log(1, constants.LOG_SEV_ERROR, "Error parsing " + configPath + ".");
                program.log(2, constants.LOG_SEV_ERROR, "\n\n" + data);
                return cb(e);
            }
            var themeConf = config.about;
            if (!themeConf) {
                var errorStr = "No about section found in " + configPath;
                program.log(1, constants.LOG_SEV_ERROR, errorStr);
                return cb(new Error(errorStr));
            }
            themeConf.baseDir = dir;
            themeConf.program = program;
            cb(null, new Theme(themeConf));
        });
    }
654140
def get_direct_band_gap_dict(self):
        
        if self.is_metal():
            raise ValueError("get_direct_band_gap_dict should"
                             "only be used with non-metals")
        direct_gap_dict = {}
        for spin, v in self.bands.items():
            above = v[np.all(v > self.efermi, axis=1)]
            min_above = np.min(above, axis=0)
            below = v[np.all(v < self.efermi, axis=1)]
            max_below = np.max(below, axis=0)
            diff = min_above - max_below
            kpoint_index = np.argmin(diff)
            band_indices = [np.argmax(below[:, kpoint_index]),
                            np.argmin(above[:, kpoint_index]) + len(below)]
            direct_gap_dict[spin] = {"value": diff[kpoint_index],
                                     "kpoint_index": kpoint_index,
                                     "band_indices": band_indices}
        return direct_gap_dict
36390
def get_osarch():
    '''
    
    '''
    if salt.utils.path.which('rpm'):
        ret = subprocess.Popen(
            'rpm --eval "%{_host_cpu}"',
            shell=True,
            close_fds=True,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE).communicate()[0]
    else:
        ret = ''.join([x for x in platform.uname()[-2:] if x][-1:])

    return salt.utils.stringutils.to_str(ret).strip() or 'unknown'
685802
private static String getFromEnvFile(String varname)
	{
		if (osIsUnix())
		{
			//	Check if file exists at home
			String	home = System.getenv("HOME");
			String	varval = getFromEnvFile(varname, home+"/.tangorc");
			if (varval!=null)
				return varval;

			//	Check default tangorc
			String	tangorc = System.getProperty("TANGO_RC");
			if (tangorc==null)
				tangorc = "/etc/tangorc";
			return getFromEnvFile(varname, tangorc);
		}
		else	//	WIN 32
		{
			
			//	Check default tangorc
			String	tangorc = System.getProperty("TANGO_RC");
			if (tangorc==null)
			{
				String	tango_root = System.getenv("TANGO_ROOT");
				if (tango_root==null)
					return null;
				tangorc = tango_root+"/tangorc";
			}
			return getFromEnvFile(varname, tangorc);
		}
	}
392060
def get_filebase(path, pattern):
    """"""
    # A pattern can include directories
    tail_len = len(pattern.split(os.path.sep))
    return os.path.join(*str(path).split(os.path.sep)[-tail_len:])
1120698
def bandWave(self):
        
        if self.binset.startswith('('):
            return self._computeBandwave(self.binset)
        else:
            return self._getBandwaveFomFile(self.binset)
352816
def get_direct_band_gap(self):
        
        if self.is_metal():
            return 0.0
        dg = self.get_direct_band_gap_dict()
        return min(v['value'] for v in dg.values())
648750
def _get_bandfilenames(self):
        """"""
        path = self.path

        for band in MODIS_BAND_NAMES:
            bnum = int(band)
            LOG.debug("Band = %s", str(band))
            if self.platform_name == 'EOS-Terra':
                filename = os.path.join(path,
                                        "rsr.{0:d}.inb.final".format(bnum))
            else:
                if bnum in [5, 6, 7] + range(20, 37):
                    filename = os.path.join(
                        path, "{0:>02d}.tv.1pct.det".format(bnum))
                else:
                    filename = os.path.join(
                        path, "{0:>02d}.amb.1pct.det".format(bnum))

            self.filenames[band] = filename
645641
def _load(self, scale=1.0):
        

        LOG.debug("File: %s", str(self.requested_band_filename))

        data = np.genfromtxt(self.requested_band_filename,
                             unpack=True,
                             names=['wavelength',
                                    'wavenumber',
                                    'response'],
                             skip_header=2)

        wvl = data['wavelength'] * scale
        resp = data['response']

        self.rsr = {'wavelength': wvl, 'response': resp}
482616
def get():
        """"""
        return {
            attr: getattr(Conf, attr)
            for attr in dir(Conf()) if not callable(getattr(Conf, attr)) and not attr.startswith("__")
        }
1123165
def _get_solar_flux(self, band):
        """"""
        solar_flux = self.cal['solar_flux'].isel(bands=band).values
        d_index = self.cal['detector_index'].fillna(0).astype(int)

        return da.map_blocks(self._get_items, d_index.data, solar_flux=solar_flux, dtype=solar_flux.dtype)
85051
def get(cls):
    """"""
    return {
      SourceRootConfig,
      Reporting,
      Reproducer,
      RunTracker,
      Changed,
      BinaryUtil.Factory,
      Subprocess.Factory
    }
666667
def get_band_structure(self):
        """"""

        kpath = HighSymmKpath(self.data.structure)
        kpt_line = [Kpoint(k, self.data.structure.lattice) for k
                    in
                    kpath.get_kpoints(coords_are_cartesian=False)[
                        0]]
        kpoints = np.array(
            [kp.frac_coords for kp in kpt_line])

        labels_dict = {l: k for k, l in zip(
            *kpath.get_kpoints(coords_are_cartesian=False)) if l}

        lattvec = self.data.get_lattvec()
        egrid, vgrid = fite.getBands(kpoints, self.equivalences, lattvec, self.coeffs)

        bands_dict = {Spin.up: (egrid / units.eV)}

        sbs = BandStructureSymmLine(kpoints, bands_dict,
                                    self.data.structure.lattice.reciprocal_lattice,
                                    self.efermi / units.eV,
                                    labels_dict=labels_dict)
        return sbs
317597
function gulpGettextConv({
  determineLocale = defDetermineLocale,
  gettextFormat = 'po',
  ...options
} = {}) {
  // creating a stream through which each file will pass
  return through.obj(function (file, enc, cb) {
    if (file.isNull()) {
      this.push(file);
      return cb();
    }

    let converter;
    let ext;

    try {
      [converter, ext] = getConverter(file, gettextFormat);
    } catch (err) {
      return cb(err);
    }

    return vinylToString(file, enc)
      .then((contents) => {
        try {
          const domain = determineLocale(file.relative, contents);
          return converter(domain, contents, options);
        } catch (e) {
          throw new PluginError(PLUGIN_NAME, 'determineLocale failed', { showStack: true });
        }
      })
      .then((data) => {
        const dirname = path.dirname(file.path);
        const basename = path.basename(file.path, path.extname(file.path));

        Object.assign(file, {
          path: path.join(dirname, `${basename}${ext}`),
          contents: getContents(file, data),
        });

        // make sure the file goes through the next gulp plugin
        this.push(file);
        cb();
      })
      .catch((err) => {
        cb(new PluginError(PLUGIN_NAME, err.message));
      });
  });
}
134224
def _log_band_gap_information(bs):
    
    bg_data = bs.get_band_gap()
    if not bg_data['direct']:
        logging.info('Indirect band gap: {:.3f} eV'.format(bg_data['energy']))

    direct_data = bs.get_direct_band_gap_dict()
    if bs.is_spin_polarized:
        direct_bg = min((spin_data['value']
                         for spin_data in direct_data.values()))
        logging.info('Direct band gap: {:.3f} eV'.format(direct_bg))

        for spin, spin_data in direct_data.items():
            direct_kindex = spin_data['kpoint_index']
            direct_kpoint = bs.kpoints[direct_kindex].frac_coords
            direct_kpoint = kpt_str.format(k=direct_kpoint)
            eq_kpoints = bs.get_equivalent_kpoints(direct_kindex)
            k_indices = ', '.join(map(str, eq_kpoints))

            # add 1 to band indices to be consistent with VASP band numbers.
            b_indices = ', '.join([str(i+1) for i in spin_data['band_indices']])

            logging.info('  {}:'.format(spin.name.capitalize()))
            logging.info('    k-point: {}'.format(direct_kpoint))
            logging.info('    k-point indices: {}'.format(k_indices))
            logging.info('    Band indices: {}'.format(b_indices))

    else:
        direct_bg = direct_data[Spin.up]['value']
        logging.info('Direct band gap: {:.3f} eV'.format(direct_bg))

        direct_kindex = direct_data[Spin.up]['kpoint_index']
        direct_kpoint = kpt_str.format(k=bs.kpoints[direct_kindex].frac_coords)
        k_indices = ', '.join(map(str,
                                  bs.get_equivalent_kpoints(direct_kindex)))
        b_indices = ', '.join([str(i+1) for i in
                               direct_data[Spin.up]['band_indices']])

        logging.info('  k-point: {}'.format(direct_kpoint))
        logging.info('  k-point indices: {}'.format(k_indices))
        logging.info('  Band indices: {}'.format(b_indices))
787529
def get_dotstr(self):
        """"""
        dotobj = self.gosubdagplot.get_pydot_graph() # pydot.Dot
        dotstr = dotobj.create_dot()
        return dotstr