def process_structure(s: Structure): # kill off any lone carbons or those with only 1 bond from pyputil.structure.bonds import calculate_bond_list n_bonds = np.array([len(b) for b in calculate_bond_list(s)]) s.remove_sites(np.where(n_bonds <= 1)[0]) # add hydrogen atoms on the edges add_hydrogen(s, cutoff=1.05, dist=DEFAULT_CH_DIST / DEFAULT_CC_DIST) # scale coordinates to bond distance s.lattice = Lattice(matrix=s.lattice.matrix * bond_dist) return s
# # Maintainer: Wei Xie # Last updated: 2014-02-07 ############################################################## import sys, getopt, os import shutil import matplotlib.pyplot as plt import numpy as np import scipy as sp from pymatgen import Lattice, Structure from pymatgen.io.smartio import read_structure, write_structure stdX = read_structure("POSCAR_std") prmX = read_structure("POSCAR_prm") stdL = Structure.lattice(stdX) prmL = Structure.lattice(stdX) def finite_size_scale(standard, ssize, primordial, fsize, psize=[1,1,1]): """Function to perform finite size scaling for defect structure relaxation Inputs: standard = POSCAR file of structure containing defect ssize = Supercell size of structure with defect (list of size 3) primordial = POSCAR file of structure for basic unit of perfect cell psize = Supercell size of structure for padding. Default = [1,1,1] (list of size 3) fsize = Desired supercell size of final structure (list of size 3) Outputs: POSCAR file of structure containing defect and padding"""
# # Maintainer: Wei Xie # Last updated: 2014-02-07 ############################################################## import sys, getopt, os import shutil import matplotlib.pyplot as plt import numpy as np import scipy as sp from pymatgen import Lattice, Structure from pymatgen.io.smartio import read_structure, write_structure stdX = read_structure("POSCAR_std") prmX = read_structure("POSCAR_prm") stdL = Structure.lattice(stdX) prmL = Structure.lattice(stdX) def finite_size_scale(standard, ssize, primordial, fsize, psize=[1, 1, 1]): """Function to perform finite size scaling for defect structure relaxation Inputs: standard = POSCAR file of structure containing defect ssize = Supercell size of structure with defect (list of size 3) primordial = POSCAR file of structure for basic unit of perfect cell psize = Supercell size of structure for padding. Default = [1,1,1] (list of size 3) fsize = Desired supercell size of final structure (list of size 3) Outputs: POSCAR file of structure containing defect and padding""" # Check if the input sizes work out with the desired final size