当前位置: 首页>>代码示例>>Python>>正文


Python Vasp.initialize方法代码示例

本文整理汇总了Python中ase.calculators.vasp.Vasp.initialize方法的典型用法代码示例。如果您正苦于以下问题:Python Vasp.initialize方法的具体用法?Python Vasp.initialize怎么用?Python Vasp.initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ase.calculators.vasp.Vasp的用法示例。


在下文中一共展示了Vasp.initialize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: write_input_files

# 需要导入模块: from ase.calculators.vasp import Vasp [as 别名]
# 或者: from ase.calculators.vasp.Vasp import initialize [as 别名]
 def write_input_files(self, at, label):
     global _chdir_lock
     # For LOTF Simulations active number of quantum 
     # atoms vary and must wait to this stage in order for
     # magnetic moments to be set properly. If magnetic moments
     # not set defaults to 0.
     self.vasp_args['magmom'] = at.get_initial_magnetic_moments()
     vasp = Vasp(**self.vasp_args)
     vasp.initialize(at)
     # chdir not thread safe, so acquire global lock before using it
     orig_dir = os.getcwd()
     try:
         _chdir_lock.acquire()
         os.chdir(self.subdir)
         if os.path.exists('OUTCAR'):
             n = 1
             while os.path.exists('OUTCAR.%d' % n):
                 n += 1
             shutil.copyfile('OUTCAR', 'OUTCAR.%d' % n)
             shutil.copyfile('POSCAR', 'POSCAR.%d' % n)
         write_vasp('POSCAR', vasp.atoms_sorted,
                    symbol_count=vasp.symbol_count,
                    vasp5='5' in self.exe)
         vasp.write_incar(at)
         vasp.write_potcar()
         vasp.write_kpoints()
     finally:
         os.chdir(orig_dir)
         _chdir_lock.release()
开发者ID:libAtoms,项目名称:matscipy,代码行数:31,代码来源:socketcalc.py

示例2: preprocess

# 需要导入模块: from ase.calculators.vasp import Vasp [as 别名]
# 或者: from ase.calculators.vasp.Vasp import initialize [as 别名]
    def preprocess(self, at, label, force_restart=False):
        self.logger.pr('vasp client %d preprocessing atoms label %d' % (self.client_id, label))

        # make a copy and then sort atoms in the same way that vasp
        # calculator will when it writes POSCAR. We use a new
        # calculator and store the sort order in the Atoms so it can
        # be reversed when results are ready.
        vasp = Vasp(**self.vasp_args)
        vasp.initialize(at)
        at = at.copy()
        order = np.array(range(len(at)))
        at.set_array('vasp_sort_order', order)
        at = at[vasp.resort]

        # finally, call the parent method
        return Client.preprocess(self, at, label, force_restart)
开发者ID:libAtoms,项目名称:matscipy,代码行数:18,代码来源:socketcalc.py

示例3: write_input_files

# 需要导入模块: from ase.calculators.vasp import Vasp [as 别名]
# 或者: from ase.calculators.vasp.Vasp import initialize [as 别名]
 def write_input_files(self, at, label):
     global _chdir_lock
     vasp = Vasp(**self.vasp_args)
     vasp.initialize(at) 
     # chdir not thread safe, so acquire global lock before using it
     orig_dir = os.getcwd()
     try:
         _chdir_lock.acquire()
         os.chdir(self.subdir)
         if os.path.exists('OUTCAR'):
             n = 1
             while os.path.exists('OUTCAR.%d' % n):
                 n += 1
             shutil.copyfile('OUTCAR', 'OUTCAR.%d' % n)
             shutil.copyfile('POSCAR', 'POSCAR.%d' % n)
         write_vasp('POSCAR', vasp.atoms_sorted,
                    symbol_count=vasp.symbol_count,
                    vasp5='5' in self.exe)
         vasp.write_incar(at)
         vasp.write_potcar()
         vasp.write_kpoints()
     finally:
         os.chdir(orig_dir)
         _chdir_lock.release()
开发者ID:maldegunde,项目名称:matscipy,代码行数:26,代码来源:socketcalc.py

示例4: Vasp

# 需要导入模块: from ase.calculators.vasp import Vasp [as 别名]
# 或者: from ase.calculators.vasp.Vasp import initialize [as 别名]
from ase.lattice import surface
from ase.constraints import FixAtoms
from ase.calculators.vasp import Vasp
from ase.visualize import view
from ase.io import write
from ase.io import read

#sigma=0.01 for gases and edif=13-8

calc = Vasp(xc='PBE', kpts=(3,3,1), lwave=False, lcharg=False,lvtot=False, nwrite=1
            , encut=400, algo='Fast', ismear=0, sigma=0.0031, voskown=1, istart=0, nelm=400, nelmdl=-10, ediff=1e-8, ispin=2
            ,nsw=1, isif=2, ibrion=5, nfree=2, potim=0.015, ediffg=-0.05, isym=0
            ,lvdw=True, vdw_version=3
            ,lreal='Auto')

slab = read('../CONTCAR')


slab.center(vacuum=20.0,axis=2)

view(slab) # View the slab, frozen atoms will be marked with a "X"


#slab.set_calculator(calc)

calc.initialize(slab)
calc.write_incar(slab)
calc.write_potcar()
calc.write_kpoints()
write('POSCAR', calc.atoms_sorted)  # this will write a "sorted" POSCAR
开发者ID:JLans,项目名称:ASE_Scripts,代码行数:32,代码来源:Gas_vibration.py

示例5: Vasp

# 需要导入模块: from ase.calculators.vasp import Vasp [as 别名]
# 或者: from ase.calculators.vasp.Vasp import initialize [as 别名]
from ase.optimize import LBFGS
from ase.calculators.vasp import Vasp
from ase.io.vasp import write_vasp
from ase.visualize import view
from ase.io import write

calc = Vasp(xc='PBE', kpts=(1,1,1), nwrite=1, lwave=False, lcharg=False,lvtot=False
            , encut=400, algo='Fast', ismear=0, sigma=0.003, voskown=1, istart=0, nelm=400, nelmdl=-10, ediff=1e-6, ispin=2
            ,nsw=1000, isif=2, ibrion=1, nfree=2, potim=0.2,lvdw=True, vdw_version=3
            ,isym=0
            ,lreal='Auto')

# Create a c(2x2) surface with 4 layers and 14 Angstrom of vacuum
d=0.9575
t = np.pi/180*104.51
molecule = Atoms('H2O',
              positions=[(d, 0, 0),(d * np.cos(t), d * np.sin(t), 0),(0, 0, 0)])

molecule.center(vacuum=20.0)
view(molecule) # View the slab, frozen atoms will be marked with a "X"


#slab.set_calculator(calc)

calc.initialize(molecule)
calc.write_incar(molecule)
calc.write_potcar()
calc.write_kpoints()
write('POSCAR', calc.atoms_sorted)  # this will write a "sorted" POSCAR

开发者ID:JLans,项目名称:ASE_Scripts,代码行数:31,代码来源:Gas.py

示例6: check_kpoints_line

# 需要导入模块: from ase.calculators.vasp import Vasp [as 别名]
# 或者: from ase.calculators.vasp.Vasp import initialize [as 别名]
check_kpoints_line(1, '0\n')
check_kpoints_line(2, 'Auto\n')
check_kpoints_line(3, '20 \n')
calc.clean()

# 1-element list ok, Gamma ok
calc = Vasp(kpts=[20], gamma=True)
calc.write_kpoints()
check_kpoints_line(1, '0\n')
check_kpoints_line(2, 'Auto\n')
check_kpoints_line(3, '20 \n')
calc.clean()

# KSPACING suppresses KPOINTS file
calc = Vasp(kspacing=0.23)
calc.initialize(Al)
calc.write_kpoints()
calc.write_incar(Al)
assert not os.path.isfile('KPOINTS')
with open('INCAR', 'r') as f:
    assert ' KSPACING = 0.230000\n' in f.readlines()
calc.clean()

# Negative KSPACING raises an error
calc = Vasp(kspacing=-0.5)

try:
    calc.write_kpoints()
except ValueError:
    pass
else:
开发者ID:rchiechi,项目名称:QuantumParse,代码行数:33,代码来源:vasp_kpoints.py


注:本文中的ase.calculators.vasp.Vasp.initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。