Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
__pycache__/
*.pyc
.vs/
.ipynb_checkpoints/
.idea/

*.db
*.traj
*.txt
*.json
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
repos:
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
language_version: python3.9
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: flake8
- id: trailing-whitespace
- id: check-added-large-files
- id: end-of-file-fixer
10 changes: 5 additions & 5 deletions 00_make_molecule.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import numpy as np
import numpy as np
from ase.build import molecule
from ase.visualize import view
from ase.visualize import view
import ase.io as io

atoms = molecule('H2O')
atoms.set_cell(8*np.identity(3))
atoms = molecule("H2O")
atoms.set_cell(8 * np.identity(3))
atoms.center()
view(atoms)
io.write('start.traj', atoms)
io.write("start.traj", atoms)
50 changes: 25 additions & 25 deletions 01_submit_job.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

#SBATCH -p high
#SBATCH --job-name=opt_try
#SBATCH --output=job.out
#SBATCH --error=job.err
#SBATCH --time=8:00:00
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=16
#SiBATCH --exclusive
# SBATCH -p high
# SBATCH --job-name=opt_try
# SBATCH --output=job.out
# SBATCH --error=job.err
# SBATCH --time=8:00:00
# SBATCH --nodes=1
# SBATCH --ntasks-per-node=16
# SiBATCH --exclusive

"""
Created on Thu Mar 26 17:10:56 2020

@author: ark245
"""
import os, sys
sys.path.insert(0,'/home/ark245/lib/onboarding_DFT/')
import os, sys

sys.path.insert(0, "/home/ark245/lib/onboarding_DFT/")
from ase import io
from kul_tools import KulTools as KT

kt = KT(gamma_only=False,structure_type='zeo')
kt.set_calculation_type('opt')
atoms = io.read('start.traj')
atoms.pbc=True
kt = KT(gamma_only=False, structure_type="zeo")
kt.set_calculation_type("opt")
atoms = io.read("start.traj")
atoms.pbc = True
kt.set_structure(atoms)
kt.set_overall_vasp_params({'gga':'RP'})
kt.set_overall_vasp_params({"gga": "RP"})
kt.run()


#print(kt.calc_default.int_params['ismear'])
#print(kt.calc_default.special_params['lreal'])
#print(kt.calculation_type)

# print(kt.calc_default.int_params['ismear'])
# print(kt.calc_default.special_params['lreal'])
# print(kt.calculation_type)

# Calculation type
# opt --> needs atoms
# opt_fine --> needs constraints
# vib --> needs constraints
# dimer --> needs path annd atoms
# neb --> needs traj

# Calculation type
# opt --> needs atoms
# opt_fine --> needs constraints
# vib --> needs constraints
# dimer --> needs path annd atoms
# neb --> needs traj
25 changes: 13 additions & 12 deletions 05_dimer_demo.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

#SBATCH -p high
#SBATCH --job-name=opt_try
#SBATCH --output=job.out
#SBATCH --error=job.err
#SBATCH --time=8:00:00
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=64 -c 2
#SiBATCH --exclusive
# SBATCH -p high
# SBATCH --job-name=opt_try
# SBATCH --output=job.out
# SBATCH --error=job.err
# SBATCH --time=8:00:00
# SBATCH --nodes=1
# SBATCH --ntasks-per-node=64 -c 2
# SiBATCH --exclusive

"""
Created on Thu Mar 26 17:10:56 2020
@author: ark245
"""
import os, sys
sys.path.insert(0,'/home/ark245/lib/onboarding_DFT/')

sys.path.insert(0, "/home/ark245/lib/onboarding_DFT/")
from ase import io
from kul_tools import KulTools as KT

kt = KT(gamma_only=False,structure_type='zeo',calculation_type='dimer')
atoms = io.read('dimer_start.traj')
kt = KT(gamma_only=False, structure_type="zeo", calculation_type="dimer")
atoms = io.read("dimer_start.traj")
kt.set_structure(atoms)
kt.set_overall_vasp_params({'gga':'RP'})
kt.set_overall_vasp_params({"gga": "RP"})
kt.run()
Binary file removed CHA.traj
Binary file not shown.
142 changes: 142 additions & 0 deletions KulTools/KT_object.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
"""class structure(custom_params,ase_atoms)
assert param has been Changed
ISMEAR SIGMA etc
structure.get_calc_object (VASP,QE)
structure.set_defaults

class calculation_type(custom_params):
self.params = {}
self.params["IBRION"] = self.custom
contains default params for each calc
if calculator_name - 'VASP':
kt_params = ""
else assert
assert param has been Changed
IBRION,NSW,EDIFFG,POTIM


from kt.calculation_type import calc_params...

.sh script package -> environments"""

from kt_structure import KT_structure
from ase.calculators.vasp import Vasp
from load_environ import identify_hpc_cluster, identify_vasp_environ


class KT_Object(KT_structure):
def __init__(
self,
gamma_only,
structure,
structure_type,
calculator_name,
calculation_type,
calc_params={},
):

super().__init__(structure, structure_type, calculator_name, calculation_type)

self.gamma = gamma_only
self.user_params = calc_params
self.kt_params = {}

self._set_environment_variables()

if self.calc_name.lower() == "vasp":
self._load_structure_type_params_vasp()
self._load_calc_type_params_vasp()

self._load_update_kt_params()

self._init_ase_calc()

def _set_environment_variables(self):
if self.calc_name.lower() == "vasp":
self.hpc = identify_hpc_cluster()
print("ENVIRONMENT VARIABLES ARE AT:")
print(identify_vasp_environ(self.hpc, self.gamma))

else:
pass

def _load_structure_type_params_vasp(self):

if self.structure_type.lower() == "metal":
self.default_calc_params.update({"sigma": 0.2, "ismear": 1})

elif self.structure_type.lower() == "gas-phase":
self.default_calc_params.update({"lreal": False})

else:
pass

def _load_calc_type_params_vasp(self):

if self.calculation_type.lower() == "spe":
self.default_calc_params.update({"nsw": 0})

elif self.calculation_type.lower() == "opt_fine":
self.default_calc_params.update(
{"ibrion": 1, "potim": 0.05, "nsw": 50, "ediffg": -0.03}
)

elif self.calculation_type.lower() == "vib":
self.default_calc_params.update({"ibrion": 5, "potim": 0.02, "nsw": 1})

elif self.calculation_type.lower() == "solv":
self.default_calc_params.update(
{
"potim": 0.0,
"nsw": 5,
"lwave": True,
"lsol": False,
"prec": "Accurate",
}
)

elif self.calculation_type.lower() == "solv-spe":
self.default_calc_params.update(
{
"potim": 0.0,
"nsw": 3,
"lwave": True,
"lsol": True,
"prec": "Accurate",
}
)

elif self.calculation_type.lower() == "solv-spe-rho":
self.default_calc_params.update(
{
"potim": 0.0,
"nsw": 5,
"lrho": True,
"lwave": True,
"lsol": True,
"prec": "Accurate",
"lrhob": True,
"lrhoion": True,
}
)

elif self.calculation_type.lower() == "md":
self.default_calc_params.update(
{"ibrion": 0, "nsw": 1000000, "tebeg": 298, "isif": 2, "smass": 0}
)

else:
pass

def _load_update_kt_params(self):
self.default_calc_params.update(self.user_params)
self.kt_params = self.default_calc_params

def _init_ase_calc(self):
if self.calc_name.lower() == "vasp":
self.ase_calculator = Vasp()
else:
pass

for key in self.kt_params:
self.ase_calculator.set(key=self.kt_params[key])
1 change: 1 addition & 0 deletions KulTools/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Script related to creating the kT object
Empty file added KulTools/__init__.py
Empty file.
43 changes: 43 additions & 0 deletions KulTools/calc_object.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from ase.calculators.vasp import Vasp


class default_calc:
def __init__(self):
pass

def load_default_vasp(self):
self.vasp_params = {
"kpts": (1, 1, 1),
"potim": 0.5,
"encut": 500,
"ispin": 2,
"nsw": 50,
"prec": "Normal",
"istart": 1,
"isif": 2,
"ismear": 0,
"sigma": 0.05,
"nelmin": 4,
"nelmdl": -4,
"nwrite": 1,
"icharg": 2,
"lasph": True,
"ediff": 1e-6,
"ediffg": -0.05,
"ibrion": 2,
"lcharg": False,
"lwave": False,
"laechg": False,
"voskown": 1,
"algo": "Fast",
"lplane": True,
"lreal": "Auto",
"isym": 0,
"xc": "PBE",
"lorbit": 11,
"nupdown": -1,
"npar": 4,
"nsim": 4,
"ivdw": 12,
}
return self.vasp_params
Loading