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


Python Vasp.set方法代码示例

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


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

示例1: Atoms

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import set [as 别名]
from ase import Atoms, Atom
from vasp import Vasp
import matplotlib.pyplot as plt
import numpy as np
a = 3.9  # approximate lattice constant
b = a / 2.
bulk = Atoms([Atom('Pd', (0.0, 0.0, 0.0))],
             cell=[(0, b, b),
                   (b, 0, b),
                   (b, b, 0)])
RWIGS = [1.0, 1.1, 1.25, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0 ]
ED, WD, N = [], [], []
for rwigs in RWIGS:
    calc = Vasp('bulk/pd-ados')
    calc.clone('bulk/pd-ados-rwigs-{0}'.format(rwigs))
    calc.set(rwigs={'Pd': rwigs})
    if calc.potential_energy is None:
        continue
        # now get results
        ados = VaspDos(efermi=calc.get_fermi_level())
        energies = ados.energy
        dos = ados.site_dos(0, 'd')
        #we will select energies in the range of -10, 5
        ind = (energies < 5) & (energies > -10)
        energies = energies[ind]
        dos = dos[ind]
        Nstates = np.trapz(dos, energies)
        occupied = energies <= 0.0
        N_occupied_states = np.trapz(dos[occupied], energies[occupied])
        ed = np.trapz(energies * dos, energies) / np.trapz(dos, energies)
        wd2 = np.trapz(energies**2 * dos, energies) / np.trapz(dos, energies)
开发者ID:beeruyue,项目名称:dft-book,代码行数:33,代码来源:script-153.py

示例2: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import set [as 别名]
from vasp import Vasp
calc = Vasp('bulk/tio2/step1-0.90')
calc.clone('bulk/tio2/step2-0.90')
#calc.set(isif=4)
print calc.set(isif=4)
print calc.calculation_required()
开发者ID:beeruyue,项目名称:dft-book,代码行数:8,代码来源:script-112.py

示例3: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import set [as 别名]
calc = Vasp('bulk/Ni-PBE',
            ismear=-5,
            kpts=[5, 5, 5],
            xc='PBE',
            ispin=2,
            lorbit=11,
            lwave=True, lcharg=True,  # store for reuse
            atoms=atoms)
e = atoms.get_potential_energy()
print('PBE energy:   ',e)
calc.stop_if(e is None)
dos = DOS(calc, width=0.2)
e_pbe = dos.get_energies()
d_pbe = dos.get_dos()
calc.clone('bulk/Ni-PBE0')
calc.set(xc='pbe0')
atoms = calc.get_atoms()
pbe0_e = atoms.get_potential_energy()
if atoms.get_potential_energy() is not None:
    dos = DOS(calc, width=0.2)
    e_pbe0 = dos.get_energies()
    d_pbe0 = dos.get_dos()
## HSE06
calc = Vasp('bulk/Ni-PBE')
calc.clone('bulk/Ni-HSE06')
calc.set(xc='hse06')
atoms = calc.get_atoms()
hse06_e = atoms.get_potential_energy()
if hse06_e is not None:
    dos = DOS(calc, width=0.2)
    e_hse06 = dos.get_energies()
开发者ID:beeruyue,项目名称:dft-book,代码行数:33,代码来源:script-219.py

示例4: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import set [as 别名]
from vasp import Vasp
calc = Vasp('bulk/tio2/step3')
atoms = calc.get_atoms()
print 'default ismear: ', atoms.get_potential_energy()
calc.clone('bulk/tio2/step4')
calc.set(ismear=-5,
         nsw=0)
atoms = calc.get_atoms()
print 'ismear=-5:      ', atoms.get_potential_energy()
开发者ID:beeruyue,项目名称:dft-book,代码行数:11,代码来源:script-115.py

示例5: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import set [as 别名]
from vasp import Vasp
for U in [2.0, 4.0, 6.0]:
    ## Cu2O ########################################
    calc = Vasp('bulk/Cu2O')
    calc.clone('bulk/Cu2O-U={0}'.format(U))
    calc.set(ldau=True,   # turn DFT+U on
             ldautype=2,  # select simplified rotationally invariant option
             ldau_luj={'Cu':{'L':2,  'U':U, 'J':0.0},
                       'O':{'L':-1, 'U':0.0, 'J':0.0}},
             ldauprint=1,
             ibrion=-1,  # do not rerelax
             nsw=0)
    atoms1 = calc.get_atoms()
    cu2o_energy = atoms1.get_potential_energy() / (len(atoms1) / 3)
    ## CuO ########################################
    calc = Vasp('bulk/CuO')
    calc.clone('bulk/CuO-U={0}'.format(U))
    calc.set(ldau=True,   # turn DFT+U on
             ldautype=2,  # select simplified rotationally invariant option
             ldau_luj={'Cu':{'L':2,  'U':U, 'J':0.0},
                       'O':{'L':-1, 'U':0.0, 'J':0.0}},
             ldauprint=1,
             ibrion=-1,  # do not rerelax
             nsw=0)
    atoms2 = calc.get_atoms()
    cuo_energy = atoms2.get_potential_energy() / (len(atoms2) / 2)
    ## O2 ########################################
    # make sure to use the same cutoff energy for the O2 molecule!
    calc = Vasp('molecules/O2-sp-triplet-400')
    atoms = calc.get_atoms()
    o2_energy = atoms.get_potential_energy()
开发者ID:beeruyue,项目名称:dft-book,代码行数:33,代码来源:script-218.py

示例6: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import set [as 别名]
from vasp import Vasp
wd = 'bulk/Si-bandstructure'
calc = Vasp('bulk/Si-selfconsistent')
calc.clone(wd)
kpts = [[0.5, 0.5, 0.0],   # L
        [0, 0, 0],         # Gamma
        [0, 0, 0],
        [0.5, 0.5, 0.5]]  # X
calc.set(kpts=kpts,
         reciprocal=True,
         kpts_nintersections=10,
         icharg=11)
print calc.run()
开发者ID:beeruyue,项目名称:dft-book,代码行数:15,代码来源:script-155.py

示例7: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import set [as 别名]
from vasp import Vasp
from enthought.mayavi import mlab
from ase.data import vdw_radii
from ase.data.colors import cpk_colors
calc = Vasp('molecules/simple-co')
calc.clone('molecules/co-chg')
calc.set(lcharg=True)
calc.stop_if(calc.potential_energy is None)
atoms = calc.get_atoms()
x, y, z, cd = calc.get_charge_density()
# make a white figure
mlab.figure(1, bgcolor=(1, 1, 1))
# plot the atoms as spheres
for atom in atoms:
    mlab.points3d(atom.x,
                  atom.y,
                  atom.z,
                  #this determines the size of the atom
                  scale_factor=vdw_radii[atom.number] / 5.,
                  resolution=20,
                  # a tuple is required for the color
                  color=tuple(cpk_colors[atom.number]),
                  scale_mode='none')
# draw the unit cell - there are 8 corners, and 12 connections
a1, a2, a3 = atoms.get_cell()
origin = [0, 0, 0]
cell_matrix = [[origin,  a1],
               [origin,  a2],
               [origin,  a3],
               [a1,      a1 + a2],
               [a1,      a1 + a3],
开发者ID:beeruyue,项目名称:dft-book,代码行数:33,代码来源:script-28.py

示例8: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import set [as 别名]
# perform a climbing image NEB calculation
from vasp import Vasp
calc = Vasp('surfaces/Pt-O-fcc-hcp-neb')
calc.clone('surfaces/Pt-O-fcc-hcp-cineb')
calc.set(ichain=0, lclimb=True)
images, energies = calc.get_neb()
calc.plot_neb(show=False)
import matplotlib.pyplot as plt
plt.savefig('images/pt-o-cineb.svg')
plt.show()
开发者ID:beeruyue,项目名称:dft-book,代码行数:12,代码来源:script-205.py

示例9: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import set [as 别名]
from ase import Atoms, Atom
from vasp import Vasp
calc = Vasp('molecules/simple-co')
print('energy = {0} eV'.format(calc.get_atoms().get_potential_energy()))
# This creates the directory and makes it current working directory
calc.clone('molecules/clone-1')
calc.set(encut=325)  # this will trigger a new calculation
print('energy = {0} eV'.format(calc.get_atoms().get_potential_energy()))
开发者ID:beeruyue,项目名称:dft-book,代码行数:10,代码来源:script-27.py

示例10: molecule

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import set [as 别名]
#!/usr/bin/env python
from ase import *
from ase.structure import molecule
from vasp import Vasp
### Setup calculators
benzene = molecule('C6H6')
benzene.set_cell([10, 10, 10])
benzene.center()
calc1 = Vasp('molecules/benzene',
            xc='PBE',
            nbands=18,
            encut=350,
            atoms=benzene)
calc1.set(lcharg=True)
chlorobenzene =  molecule('C6H6')
chlorobenzene.set_cell([10, 10, 10])
chlorobenzene.center()
chlorobenzene[11].symbol ='Cl'
calc2 = Vasp('molecules/chlorobenzene',
            xc='PBE',
            nbands=22,
            encut=350,
            atoms=chlorobenzene)
calc2.set(lcharg=True)
calc2.stop_if(None in (calc1.potential_energy, calc2.potential_energy))
x1, y1, z1, cd1 = calc1.get_charge_density()
x2, y2, z2, cd2 = calc2.get_charge_density()
cdiff = cd2 - cd1
print(cdiff.min(), cdiff.max())
##########################################
##### set up visualization of charge difference
开发者ID:beeruyue,项目名称:dft-book,代码行数:33,代码来源:script-30.py

示例11: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import set [as 别名]
from vasp import Vasp
from ase.dft import DOS
calc = Vasp('bulk/pd-dos')
calc.clone('bulk/pd-dos-ismear-5')
bulk = calc.get_atoms()
calc.set(ismear=-5)
bulk.get_potential_energy()
dos = DOS(calc, width=0.2)
d = dos.get_dos()
e = dos.get_energies()
import pylab as plt
plt.plot(e, d)
plt.xlabel('energy [eV]')
plt.ylabel('DOS')
plt.savefig('images/pd-dos-ismear-5.png')
开发者ID:beeruyue,项目名称:dft-book,代码行数:17,代码来源:script-149.py

示例12: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import set [as 别名]
slab.center()
calc = Vasp('surfaces/Al-Na-dip',
            xc='PBE',
            encut=340,
            kpts=[2, 2, 1],
            lcharg=True,
            idipol=3,   # only along z-axis
            lvtot=True,  # write out local potential
            lvhar=True,  # write out only electrostatic potential, not xc pot
            atoms=slab)
calc.stop_if(calc.potential_energy is None)
x, y, z, cd = calc.get_charge_density()
n0, n1, n2 = cd.shape
nelements = n0 * n1 * n2
voxel_volume = slab.get_volume() / nelements
total_electron_charge = cd.sum() * voxel_volume
electron_density_center = np.array([(cd * x).sum(),
                                    (cd * y).sum(),
                                    (cd * z).sum()])
electron_density_center *= voxel_volume
electron_density_center /= total_electron_charge
print 'electron-density center = {0}'.format(electron_density_center)
uc = slab.get_cell()
# get scaled electron charge density center
sedc = np.dot(np.linalg.inv(uc.T), electron_density_center.T).T
# we only write 4 decimal places out to the INCAR file, so we round here.
sedc = np.round(sedc, 4)
calc.clone('surfaces/Al-Na-dip-step2')
# now run step 2 with dipole set at scaled electron charge density center
calc.set(ldipol=True, dipol=sedc)
print(calc.potential_energy)
开发者ID:beeruyue,项目名称:dft-book,代码行数:33,代码来源:script-190.py

示例13: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import set [as 别名]
from vasp import Vasp
calc = Vasp('bulk/Fe-bulk')
calc.clone('bulk/Fe-elastic')
calc.set(ibrion=6,    #
         isif=3,      # gets elastic constants
         potim=0.05,  # displacements
         nsw=1,
         nfree=2)
print(calc.potential_energy)
开发者ID:beeruyue,项目名称:dft-book,代码行数:11,代码来源:script-126.py

示例14: Atoms

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import set [as 别名]
from vasp import Vasp
from enthought.mayavi import mlab
from ase.data import vdw_radii
from ase.data.colors import cpk_colors
from ase import Atom, Atoms
atoms = Atoms([Atom('C', [2.422, 0.0, 0.0]),
               Atom('O', [3.578, 0.0, 0.0])],
               cell=(10,10,10))
atoms.center()
calc = Vasp('molecules/co-centered',
            encut=350,
            xc='PBE',
            atoms=atoms)
calc.set(lcharg=True,)
calc.stop_if(calc.potential_energy is None)
atoms = calc.get_atoms()
x, y, z, cd = calc.get_charge_density()
mlab.figure(bgcolor=(1, 1, 1))
# plot the atoms as spheres
for atom in atoms:
    mlab.points3d(atom.x,
                  atom.y,
                  atom.z,
                  scale_factor=vdw_radii[atom.number]/5,
                  resolution=20,
                  # a tuple is required for the color
                  color=tuple(cpk_colors[atom.number]),
                  scale_mode='none')
# draw the unit cell - there are 8 corners, and 12 connections
a1, a2, a3 = atoms.get_cell()
origin = [0, 0, 0]
开发者ID:beeruyue,项目名称:dft-book,代码行数:33,代码来源:script-29.py

示例15: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import set [as 别名]
from vasp import Vasp
factors = [0.9, 0.95, 1.0, 1.05, 1.1]  # to change volume by
energies1, volumes1 = [], []  # from step 1
energies, volumes = [], []  # for step 2
ready = True
for f in factors:
    calc = Vasp('bulk/tio2/step1-{0:1.2f}'.format(f))
    atoms = calc.get_atoms()
    energies1.append(atoms.get_potential_energy())
    volumes1.append(atoms.get_volume())
    calc.clone('bulk/tio2/step2-{0:1.2f}'.format(f))
    calc.set(isif=4)
    # You have to get the atoms again.
    atoms = calc.get_atoms()
    energies.append(atoms.get_potential_energy())
    volumes.append(atoms.get_volume())
print(energies, volumes)
calc.stop_if(None in energies)
import matplotlib.pyplot as plt
plt.plot(volumes1, energies1, volumes, energies)
plt.xlabel('Vol. ($\AA^3)$')
plt.ylabel('Total energy (eV)')
plt.legend(['step 1', 'step 2'], loc='best')
plt.savefig('images/tio2-step2.png')
开发者ID:beeruyue,项目名称:dft-book,代码行数:26,代码来源:script-113.py


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