本文整理汇总了Python中pymatgen.io.vasp.inputs.Kpoints.write_file方法的典型用法代码示例。如果您正苦于以下问题:Python Kpoints.write_file方法的具体用法?Python Kpoints.write_file怎么用?Python Kpoints.write_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.io.vasp.inputs.Kpoints
的用法示例。
在下文中一共展示了Kpoints.write_file方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_task
# 需要导入模块: from pymatgen.io.vasp.inputs import Kpoints [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Kpoints import write_file [as 别名]
def run_task(self, fw_spec):
prev_dir = fw_spec.get('PREV_DIR', None)
self.custom_params = self.get('custom_params', None)
if isinstance(self["structure"], Structure):
s = self["structure"]
elif isinstance(self["structure"], dict):
s = Structure.from_dict(self["structure"])
else:
s = Structure.from_file(os.path.join(prev_dir, self["structure"]))
vis = load_class("pymatgen.io.vasp.sets", self["vasp_input_set"])(
**self.get("input_set_params", {}))
vis.write_input(s, ".")
# Write Custom KPOINTS settings if necessary
ksettings = self.custom_params.get('user_kpts_settings', None) if isinstance(
self.custom_params, dict) else None
if ksettings:
style = ksettings.get('kpts_style', 'Gamma')
kpoints = ksettings.get('kpts', [16,16,16])
shift = ksettings.get('kpts_shift', [0,0,0])
k = Kpoints(kpts=[kpoints], kpts_shift=shift)
k.style = style
k.write_file("KPOINTS")
示例2: write_input_task
# 需要导入模块: from pymatgen.io.vasp.inputs import Kpoints [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Kpoints import write_file [as 别名]
def write_input_task(self, dir='.'):
self.custom_params = self.get('custom_params', None)
if isinstance(self["structure"], Structure):
s = self["structure"]
elif isinstance(self["structure"], dict):
s = Structure.from_dict(self["structure"])
else:
s = Structure.from_file(self["structure"])
if os.environ.get('VASP_PSP_DIR') == None:
print "VASP_PSP_DIR not set. Checking User's HOME directory for VASP potentials."
if os.path.exists(os.path.join(os.environ.get('HOME'), 'Potentials')):
os.environ['VASP_PSP_DIR'] = os.path.join(os.environ.get('HOME'), 'Potentials')
else:
print "VASP Potentials not found!"
print "Please copy the Potentials Folder"
print "from VASP into your HOME directory"
sys.exit()
vis = load_class("pymatgen.io.vasp.sets", self["vasp_input_set"])(
**self.get("input_set_params", {}))
vis.write_input(s, dir)
# Write Custom KPOINTS settings if necessary
ksettings = self.custom_params.get('user_kpts_settings', None) if isinstance(
self.custom_params, dict) else None
if ksettings:
style = ksettings.get('kpts_style', 'Gamma')
kpoints = ksettings.get('kpts', [16,16,16])
shift = ksettings.get('kpts_shift', [0,0,0])
k = Kpoints(kpts=[kpoints], kpts_shift=shift)
k.style = style
filename = os.path.join(dir, 'KPOINTS')
k.write_file(filename)
print "Wrote VASP input files to '{}'".format(dir)