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


Python Vasp.get_atoms方法代码示例

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


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

示例1: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import get_atoms [as 别名]
from vasp import Vasp
calc = Vasp('molecules/CO-vacuum')
calc.clone('molecules/CO-solvated')
calc.set(istart=1,  #
         lsol=True)
print(calc.get_atoms().get_potential_energy())
print(calc.get_atoms().get_forces())
print('Calculation time: {} seconds'.format(calc.get_elapsed_time()))
开发者ID:beeruyue,项目名称:dft-book,代码行数:10,代码来源:script-239.py

示例2: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import get_atoms [as 别名]
from vasp import Vasp
# read in relaxed geometry
calc = Vasp('molecules/h2o_relax')
atoms = calc.get_atoms()
# now define a new calculator
calc = Vasp('molecules/h2o_vib_dfpt',
            xc='PBE',
            encut=400,
            ismear=0,  # Gaussian smearing
            ibrion=7,  # switches on the DFPT vibrational analysis (with
            # no symmetry constraints)
            nfree=2,
            potim=0.015,
            lepsilon=True,  # enables to calculate and to print the BEC
            # tensors
            lreal=False,
            nsw=1,
            nwrite=3,  # affects OUTCAR verbosity: explicitly forces
            # SQRT(mass)-divided eigenvectors to be printed
            atoms=atoms)
print(calc.potential_energy)
开发者ID:beeruyue,项目名称:dft-book,代码行数:23,代码来源:script-55.py

示例3: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import get_atoms [as 别名]
from ase.thermochemistry import IdealGasThermo
from vasp import Vasp
import numpy as np
import matplotlib.pyplot as plt
# first we get the electronic energies
c1 = Vasp('molecules/wgs/CO')
E_CO = c1.potential_energy
CO = c1.get_atoms()
c2 = Vasp('molecules/wgs/CO2')
E_CO2 = c2.potential_energy
CO2 = c2.get_atoms()
c3 = Vasp('molecules/wgs/H2')
E_H2 = c3.potential_energy
H2 = c3.get_atoms()
c4 = Vasp('molecules/wgs/H2O')
E_H2O = c4.potential_energy
H2O = c4.get_atoms()
# now we get the vibrational energies
h = 4.1356675e-15  # eV * s
c = 3.0e10  # cm / s
calc = Vasp('molecules/wgs/CO-vib')
vib_freq = calc.get_vibrational_frequencies()
CO_vib_energies = [h * c * nu for nu in vib_freq]
calc = Vasp('molecules/wgs/CO2-vib')
vib_freq = calc.get_vibrational_frequencies()
CO2_vib_energies = [h * c * nu for nu in vib_freq]
calc = Vasp('molecules/wgs/H2-vib')
vib_freq = calc.get_vibrational_frequencies()
H2_vib_energies = [h * c * nu for nu in vib_freq]
calc = Vasp('molecules/wgs/H2O-vib')
vib_freq = calc.get_vibrational_frequencies()
开发者ID:beeruyue,项目名称:dft-book,代码行数:33,代码来源:script-82.py

示例4: len

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import get_atoms [as 别名]
from vasp import Vasp
# don't forget to normalize your total energy to a formula unit. Cu2O
# has 3 atoms, so the number of formula units in an atoms is
# len(atoms)/3.
calc = Vasp('bulk/Cu2O')
atoms1 = calc.get_atoms()
cu2o_energy = atoms1.get_potential_energy()
calc = Vasp('bulk/CuO')
atoms2 = calc.get_atoms()
cuo_energy = atoms2.get_potential_energy()
# make sure to use the same cutoff energy for the O2 molecule!
calc = Vasp('molecules/O2-sp-triplet-400')
atoms3 = calc.get_atoms()
o2_energy = atoms3.get_potential_energy()
calc.stop_if(None in [cu2o_energy, cuo_energy, o2_energy])
cu2o_energy /= (len(atoms1) / 3)  # note integer math
cuo_energy /= (len(atoms2) / 2)
rxn_energy = 4.0 * cuo_energy - o2_energy - 2.0 * cu2o_energy
print 'Reaction energy = {0} eV'.format(rxn_energy)
开发者ID:beeruyue,项目名称:dft-book,代码行数:21,代码来源:script-145.py

示例5: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import get_atoms [as 别名]
from vasp import Vasp
# get relaxed geometry
calc = Vasp('molecules/wgs/CO2')
CO2 = calc.get_atoms()
# now do the vibrations
calc = Vasp('molecules/wgs/CO2-vib',
            xc='PBE',
            encut=350,
            ismear=0,
            ibrion=6,
            nfree=2,
            potim=0.02,
            nsw=1,
            atoms=CO2)
calc.wait()
vib_freq = calc.get_vibrational_frequencies()
for i, f in enumerate(vib_freq):
    print('{0:02d}: {1} cm^(-1)'.format(i, f))
开发者ID:beeruyue,项目名称:dft-book,代码行数:20,代码来源:script-79.py

示例6: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import get_atoms [as 别名]
from vasp import Vasp
# get relaxed geometry
calc = Vasp('molecules/wgs/CO')
CO = calc.get_atoms()
# now do the vibrations
calc = Vasp('molecules/wgs/CO-vib',
          xc='PBE',
            encut=350,
            ismear=0,
            ibrion=6,
            nfree=2,
            potim=0.02,
            nsw=1,
            atoms=CO)
calc.wait()
vib_freq = calc.get_vibrational_frequencies()
for i, f in enumerate(vib_freq):
    print('{0:02d}: {1} cm^(-1)'.format(i, f))
开发者ID:beeruyue,项目名称:dft-book,代码行数:20,代码来源:script-78.py

示例7: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import get_atoms [as 别名]
from vasp import Vasp
from ase.neb import NEB
import matplotlib.pyplot as plt
calc = Vasp('surfaces/Pt-slab-O-fcc')
initial_atoms = calc.get_atoms()
final_atoms = Vasp('surfaces/Pt-slab-O-hcp').get_atoms()
# here is our estimated transition state. we use vector geometry to
# define the bridge position, and add 1.451 Ang to z based on our
# previous bridge calculation. The bridge position is half way between
# atoms 9 and 10.
ts = initial_atoms.copy()
ts.positions[-1] = 0.5 * (ts.positions[9] + ts.positions[10]) + [0, 0, 1.451]
# construct the band
images = [initial_atoms]
images += [initial_atoms.copy()]
images += [ts.copy()]  # this is the TS
neb = NEB(images)
# Interpolate linearly the positions of these images:
neb.interpolate()
# now add the second half
images2 = [ts.copy()]
images2 += [ts.copy()]
images2 += [final_atoms]
neb2 = NEB(images2)
neb2.interpolate()
# collect final band. Note we do not repeat the TS in the second half
final_images = images + images2[1:]
calc = Vasp('surfaces/Pt-O-fcc-hcp-neb',
            ibrion=1,
            nsw=90,
            spring=-5,
开发者ID:beeruyue,项目名称:dft-book,代码行数:33,代码来源:script-205.py

示例8: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import get_atoms [as 别名]
from vasp import Vasp
from ase import Atom, Atoms
# parent metals
cu = Vasp('bulk/alloy/cu')
cu_e = cu.potential_energy / len(cu.get_atoms())
pd = Vasp('bulk/alloy/pd')
pd_e = pd.potential_energy / len(pd.get_atoms())
atoms = Atoms([Atom('Cu',  [-1.867,     1.867,      0.000]),
               Atom('Cu',  [0.000,      0.000,      0.000]),
               Atom('Cu',  [0.000,      1.867,      1.867]),
               Atom('Pd',  [-1.867,     0.000,      1.86])],
               cell=[[-3.735,  0.000,  0.000],
                     [0.000,  0.000,  3.735],
                     [0.000,  3.735,  0.000]])
calc = Vasp('bulk/alloy/cu3pd-2',
            xc='PBE',
            encut=350,
            kpts=[8, 8, 8],
            nbands=34,
            ibrion=2,
            isif=3,
            nsw=10,
            atoms=atoms)
e4 = atoms.get_potential_energy()
Vasp.wait(abort=True)
for atom in atoms:
    if atom.symbol == 'Cu':
        e4 -= cu_e
    else:
        e4 -= pd_e
e4 /= len(atoms)
开发者ID:beeruyue,项目名称:dft-book,代码行数:33,代码来源:script-142.py

示例9: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import get_atoms [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: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import get_atoms [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

示例11: bulk

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import get_atoms [as 别名]
from vasp import Vasp
from ase.lattice import bulk
from ase.optimize import BFGS as QuasiNewton
Al = bulk('Al', 'fcc', a=4.5, cubic=True)
calc = Vasp('bulk/Al-lda-ase',
            xc='LDA',
            atoms=Al)
from ase.constraints import StrainFilter
sf = StrainFilter(Al)
qn = QuasiNewton(sf, logfile='relaxation.log')
qn.run(fmax=0.1, steps=5)
print('Stress:\n', calc.stress)
print('Al post ASE volume relaxation\n', calc.get_atoms().get_cell())
print(calc)
开发者ID:beeruyue,项目名称:dft-book,代码行数:16,代码来源:script-120.py

示例12: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import get_atoms [as 别名]
                       P5 - P1])
    # now get interpolated point in terms of the cell basis
    s = np.dot(np.linalg.inv(cbasis.T), np.array([xi, yi, zi]) - P1)
    # now s = (sa, sb, sc) which are fractional coordinates in the vector space
    # next we do the interpolations
    ui1 = u1 + s[0] * (u2 - u1)
    ui2 = u3 + s[0] * (u4 - u3)
    ui3 = u5 + s[0] * (u6 - u5)
    ui4 = u7 + s[0] * (u8 - u7)
    ui5 = ui1 + s[1] * (ui2 - ui1)
    ui6 = ui3 + s[1] * (ui4 - ui3)
    ui7 = ui5 + s[2] * (ui6 - ui5)
    return ui7
### Setup calculators
calc = Vasp('molecules/benzene')
benzene = calc.get_atoms()
x1, y1, z1, cd1 = calc.get_charge_density()
calc = Vasp('molecules/chlorobenzene')
x2, y2, z2, cd2 = calc.get_charge_density()
cdiff = cd2 - cd1
#we need the x-y plane at z=5
import matplotlib.pyplot as plt
from scipy import mgrid
X, Y = mgrid[0: 10: 25j, 0: 10: 25j]
cdiff_plane = np.zeros(X.shape)
ni, nj = X.shape
for i in range(ni):
    for j in range(nj):
        cdiff_plane[i, j] = vinterp3d(x1, y1, z1, cdiff,
                                      X[i, j], Y[i, j], 5.0)
plt.imshow(cdiff_plane.T,
开发者ID:beeruyue,项目名称:dft-book,代码行数:33,代码来源:script-31.py


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