Skip to content

Instantly share code, notes, and snippets.

View HojeChun's full-sized avatar

HojeChun HojeChun

View GitHub Profile
@HojeChun
HojeChun / get_slab.py
Last active July 24, 2023 05:39
Get Slab
from typing import Tuple
from pymatgen.io.vasp.inputs import Poscar
from pymatgen.core.surface import SlabGenerator
from pymatgen.core.structure import Structure
from typing import Optional, Tuple
def make_slab(poscar_file: str, miller_index: Tuple[int], output_filename:Optional[str]=None, slab_thickness=10, vacuum_thickness=10, center_slab=True):
struc = Structure.from_file(poscar_file)
slab_gen = SlabGenerator(struc, miller_index = miller_index, min_slab_size=slab_thickness, min_vacuum_size=vacuum_thickness, center_slab=center_slab)
@HojeChun
HojeChun / get_diameter.py
Last active July 19, 2023 09:11
get diameter
from ase.io import read
import numpy as np
import argparse
import sys
from scipy.spatial import ConvexHull
parser = argparse.ArgumentParser(description="Nanoparticles diameter")
parser.add_argument('-f',"--filename", default="POSCAR" ,type=str, help='Atoms file')
@HojeChun
HojeChun / get_structure.py
Last active July 19, 2023 06:47
Pymatgen_structure_query
from pymatgen.io.vasp.inputs import Poscar
from mp_api.client import MPRester
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
import argparse
import sys
parser = argparse.ArgumentParser(description="Getstructure from MP")
parser.add_argument("--api_key", default="12CP338fUaJRkNDgGE2TMELiRUkQMX9z", type=str, help='API key')
parser.add_argument("--mpi_id", type=str, help='mp id')
parser.add_argument("--filename", type=str, default='POSCAR', help='name of file')
@HojeChun
HojeChun / make slab model.md
Last active July 2, 2023 13:44
Make slab with pymatgen
from pymatgen.core.structure import Structure
from pymatgen.core.surface import SlabGenerator
from pymatgen.io.vasp.inputs import Poscar

struc = Structure.from_file("CONTCAR")
slab_gen = SlabGenerator(struc, [0,0,1], 12, 10, primitive=True) ### If you want the slab to be center set center_slab=True
slab = slab_gen.get_slab()
slab = slab.get_orthogonal_c_slab().get_sorted_structure()
Poscar(slab).write_file("Poscar.vasp")
@HojeChun
HojeChun / Initial settings.md
Last active March 29, 2023 08:49
Al Folio initial settings
  1. Download bunlde and jekyll from ruby (rbenv)
  2. Create new repo by Use this template from "https://github.com/alshedivat/al-folio"
    • name the repo with [name].github.io
  3. Clone the repo ex: git clone git@github.com:/HojeChun/hojechun.github.io
  4. Change _config.yml
url: https://hojechun.github.io # the base hostname & protocol for your site
baseurl:  # the subpath of your site, e.g. /blog/
repository: HojeChun/hojechun.github.io
@HojeChun
HojeChun / sigopt run
Last active January 18, 2023 04:57
sigopt
CUDA_VISIBLE_DEVICES=3 sigopt optimize -e sigopt_params.yaml --project persite_perovskite python main_sigopt.py --cache data_cache/data_sac_multifidelity_1227 --details results/details_multifidelity.json --savedir results/01-sac/00-multifidelity
@HojeChun
HojeChun / terminal_settings.md
Last active October 20, 2022 03:22
mac terminal settings

Install the compilers

Shell Configuration

install omyzsh (from github, use curl) Plugins: zsh-autosuggestions, zsh-syntax-highlighting (follow INSTALL.md on github)

Compilers & languages

  • rust compiler: rustup (one-line command from official website)
@HojeChun
HojeChun / postgresql_setup.md
Last active October 5, 2022 05:57
docker postgresql

docker run --name postgres-container -d --restart unless-stopped -p 5432:5432 -e POSTGRES_PASSWORD=hansgroup2022! -v ~/.local/postgresql/db postgres:13.3

docker run --name htvs- -d --restart unless-stopped -p 5432:5432 -e POSTGRES_PASSWORD=hansgroup2022! -v ~/.local/postgresql/db postgres:13.3

docker exec -it postgres-container psql -U postgres

CREATE database: create database {db_name}; \q : quit

select *from PG_SHADOW: user query

@HojeChun
HojeChun / job_managner.md
Last active August 31, 2023 08:38
Job Manager

./manage.py requestjobs sac pbe_u_paw_spinpol_opt_surf_vasp -p remove_atom --details='{"pseudo_dir": "/home/lungerja/pseudopotentials", "mounted_pseudo_dir": "/home/hojechun/jackie_potentials", "compute_platform": "engaging", "ldau_settings": "sac", "kpoints":[5,6,1], "npar": 1, "tasks_per_node": 64}' --settings=djangochem.settings.orgel -r hojechun --parentpks 458444304 458444320 458444321 458444322 458444323 458444324 458444325 458444326 458444327 452430898 452430909 460149368 460149400 452431004 262072995 262072996 262072999 262073000 452431015 262073002 262073003 262073004 262073005 262073006 262073007 262073008 262073009 262073010 262073011 453114033 262073014 262073015 262073016 262073017 262073018 262073019 262073020 262073022 262073023 262073024 262073025 262073034 262073035 262073036 262073037 262073038 262073039 262073040 452431052 262073042 262073043 262073044 262073047 262073048 262073057 262073069 262073071 262073076 452431093 415378692 415378693 415378694 415378695 415378696 415378697 262073098

@HojeChun
HojeChun / draw.py
Last active July 20, 2022 20:12
Save rdkit.mol to pdf image
import os
from pathlib import Path
from typing import Union
from rdkit.Chem.rdchem import Mol
from reportlab.graphics import renderPDF
from svglib.svglib import svg2rlg
def draw_mol2pdf(mol: Mol, filename: str= "draw.pdf", path: Union[str, os.PathLike]= "./"):