Skip to content

Instantly share code, notes, and snippets.

View Tack-Tau's full-sized avatar

Shuo Tao Tack-Tau

View GitHub Profile
@henriquemiranda
henriquemiranda / pymatgen_symmetrize_poscar.py
Created August 4, 2022 13:50
Read a POSCAR file and write both primitive and conventional symmetrized POSCAR
#read structure from file
from pymatgen.core import Structure
struct = Structure.from_file("POSCAR")
#get symmetrized primitive and conventional cell
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
sga = SpacegroupAnalyzer(struct,symprec=1e-5)
struct_symm_conv = sga.get_refined_structure()
struct_symm_prim = sga.find_primitive()
@Asif-Iqbal-Bhatti
Asif-Iqbal-Bhatti / extract_energy_VASP.sh
Last active April 18, 2022 17:48
Script to extract energy from each directory for VASP calculation
#!/bin/bash
#
# USAGE: script to extract energy from each folder. This script output energy-vs-volume
# and energy-vs-strain output files. The units are converted from eV to Ha
# and A3 to Bohr3.
#
echo -e "************************************************************************* \e[92m"
echo "*************************************************************************"
echo -e "*************************************************************************\e[0m"
@specter119
specter119 / periodic_table.py
Last active October 30, 2024 14:53
Plot periodic table with Pymatgen and Matplotlib
import re
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.collections import PatchCollection
from pymatgen.core.periodic_table import Element
class PeriodicTablePlotter(object):
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

The PATH is an important concept when working on the command line. It's a list of directories that tell your operating system where to look for programs, so that you can just write script instead of /home/me/bin/script or C:\Users\Me\bin\script. But different operating systems have different ways to add a new directory to it:

Windows

  1. The first step depends which version of Windows you're using:
  • If you're using Windows 8 or 10, press the Windows key, then search for and
@satya-jugran
satya-jugran / roulette.py
Created November 6, 2017 15:24
Python code for Roulette wheel selection
#!/usr/bin/env python
import sys, time, numpy, random
# Individual has a genome and fitness and knows how to print itself
class Individual:
def __init__(self, genome):
if genome is None:
self.genome = numpy.array(numpy.random.random_integers(0, 1, LEN), dtype='bool')
else:
@dalegaspi
dalegaspi / brew_symlink_error_sierra.md
Last active January 4, 2024 22:32
Homebrew Symlink errors in Mac OSX High Sierra
@u0d7i
u0d7i / disable_vim_auto_visual_on_mouse.txt
Last active February 10, 2025 00:29
Disable vim automatic visual mode on mouse select
Disable vim automatic visual mode on mouse select
issue: :set mouse-=a
add to ~/.vimrc: set mouse-=a
my ~/.vimrc for preserving global defaults and only changing one option:
source $VIMRUNTIME/defaults.vim
set mouse-=a
@computron
computron / pd_example.py
Created May 8, 2014 18:33
Create, plot, and analyze Phase Diagrams using the pymatgen codebase and Materials Project database
"""
This is a basic example of how to create, plot, and analyze Phase Diagrams using the pymatgen
codebase and Materials Project database. To run this example, you should:
* have pymatgen (www.pymatgen.org) installed along with matplotlib
* obtain a Materials Project API key (https://www.materialsproject.org/open)
* paste that API key in the MAPI_KEY variable below, e.g. MAPI_KEY = "foobar1234"
For citation, see https://www.materialsproject.org/citing
For the accompanying comic book, see http://www.hackingmaterials.com/pdcomic
@stuart11n
stuart11n / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote