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


Python FaceCenteredCubic.get_potential_energy方法代码示例

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


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

示例1: test_mix_eam_alloy

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_potential_energy [as 别名]
    def test_mix_eam_alloy(self):
        if False:
            source,parameters,F,f,rep = read_eam("CuAu_Zhou.eam.alloy",kind="eam/alloy")
            source1,parameters1,F1,f1,rep1 = mix_eam(["Cu_Zhou.eam.alloy","Au_Zhou.eam.alloy"],"eam/alloy","weight")
            write_eam(source1,parameters1,F1,f1,rep1,"CuAu_mixed.eam.alloy",kind="eam/alloy")

            calc0 = EAM('CuAu_Zhou.eam.alloy')
            calc1 = EAM('CuAu_mixed.eam.alloy')
       
            a = FaceCenteredCubic('Cu', size=[2,2,2])
            a.set_calculator(calc0)
            FIRE(StrainFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
            e0 = a.get_potential_energy()/len(a)
            a = FaceCenteredCubic('Cu', size=[2,2,2])
            a.set_calculator(calc1)
            FIRE(StrainFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
            e1 = a.get_potential_energy()/len(a)
            self.assertTrue(e0-e1 < 0.0005)

            a = FaceCenteredCubic('Au', size=[2,2,2])
            a.set_calculator(calc0)
            FIRE(StrainFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
            e0 = a.get_potential_energy()/len(a)
            a = FaceCenteredCubic('Au', size=[2,2,2])
            a.set_calculator(calc1)
            FIRE(StrainFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
            e1 = a.get_potential_energy()/len(a)
            self.assertTrue(e0-e1 < 0.0005)

            a = L1_2(['Au', 'Cu'], size=[2,2,2], latticeconstant=4.0)
            a.set_calculator(calc0)
            FIRE(UnitCellFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
            e0 = a.get_potential_energy()/len(a)
            a = L1_2(['Au', 'Cu'], size=[2,2,2], latticeconstant=4.0)
            a.set_calculator(calc1)
            FIRE(UnitCellFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
            e1 = a.get_potential_energy()/len(a)
            self.assertTrue(e0-e1 < 0.0005)

            a = L1_2(['Cu', 'Au'], size=[2,2,2], latticeconstant=4.0)
            a.set_calculator(calc0)
            FIRE(UnitCellFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
            e0 = a.get_potential_energy()/len(a)
            a = L1_2(['Cu', 'Au'], size=[2,2,2], latticeconstant=4.0)
            a.set_calculator(calc1)
            FIRE(UnitCellFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
            e1 = a.get_potential_energy()/len(a)
            self.assertTrue(e0-e1 < 0.0005)

            a = B1(['Au', 'Cu'], size=[2,2,2], latticeconstant=4.0)
            a.set_calculator(calc0)
            FIRE(UnitCellFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
            e0 = a.get_potential_energy()/len(a)
            a = B1(['Au', 'Cu'], size=[2,2,2], latticeconstant=4.0)
            a.set_calculator(calc1)
            FIRE(UnitCellFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
            e1 = a.get_potential_energy()/len(a)
            self.assertTrue(e0-e1 < 0.0005)
          
            os.remove("CuAu_mixed.eam.alloy")
开发者ID:libAtoms,项目名称:matscipy,代码行数:62,代码来源:eam_io.py

示例2: relax

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_potential_energy [as 别名]
def relax(input_atoms, ref_db):
    atoms_string = input_atoms.get_chemical_symbols()

    # Open connection to the database with reference data
    db = connect(ref_db)

    # Load our model structure which is just FCC
    atoms = FaceCenteredCubic('X', latticeconstant=1.)
    atoms.set_chemical_symbols(atoms_string)

    # Compute the average lattice constant of the metals in this individual
    # and the sum of energies of the constituent metals in the fcc lattice
    # we will need this for calculating the heat of formation
    a = 0
    ei = 0
    for m in set(atoms_string):
        dct = db.get(metal=m)
        count = atoms_string.count(m)
        a += count * dct.latticeconstant
        ei += count * dct.energy_per_atom
    a /= len(atoms_string)
    atoms.set_cell([a, a, a], scale_atoms=True)

    # Since calculations are extremely fast with EMT we can also do a volume
    # relaxation
    atoms.set_calculator(EMT())
    eps = 0.05
    volumes = (a * np.linspace(1 - eps, 1 + eps, 9))**3
    energies = []
    for v in volumes:
        atoms.set_cell([v**(1. / 3)] * 3, scale_atoms=True)
        energies.append(atoms.get_potential_energy())

    eos = EquationOfState(volumes, energies)
    v1, ef, B = eos.fit()
    latticeconstant = v1**(1. / 3)

    # Calculate the heat of formation by subtracting ef with ei
    hof = (ef - ei) / len(atoms)

    # Place the calculated parameters in the info dictionary of the
    # input_atoms object
    input_atoms.info['key_value_pairs']['hof'] = hof
    
    # Raw score must always be set
    # Use one of the following two; they are equivalent
    input_atoms.info['key_value_pairs']['raw_score'] = -hof
    # set_raw_score(input_atoms, -hof)
    
    input_atoms.info['key_value_pairs']['latticeconstant'] = latticeconstant

    # Setting the atoms_string directly for easier analysis
    atoms_string = ''.join(input_atoms.get_chemical_symbols())
    input_atoms.info['key_value_pairs']['atoms_string'] = atoms_string
开发者ID:rosswhitfield,项目名称:ase,代码行数:56,代码来源:ga_fcc_alloys_relax.py

示例3: test_Grochola

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_potential_energy [as 别名]
 def test_Grochola(self):
     a = FaceCenteredCubic('Au', size=[2,2,2])
     calc = EAM('Au-Grochola-JCP05.eam.alloy')
     a.set_calculator(calc)
     FIRE(StrainFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
     a0 = a.cell.diagonal().mean()/2
     self.assertTrue(abs(a0-4.0701)<2e-5)
     self.assertTrue(abs(a.get_potential_energy()/len(a)+3.924)<0.0003)
     C, C_err = fit_elastic_constants(a, symmetry='cubic', verbose=False)
     C11, C12, C44 = Voigt_6x6_to_cubic(C)
     self.assertTrue(abs((C11-C12)/GPa-32.07)<0.7)
     self.assertTrue(abs(C44/GPa-45.94)<0.5)
开发者ID:libAtoms,项目名称:matscipy,代码行数:14,代码来源:eam_calculator.py

示例4: test_CuAg

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_potential_energy [as 别名]
    def test_CuAg(self):
        a = FaceCenteredCubic('Cu', size=[2,2,2])
        calc = EAM('CuAg.eam.alloy')
        a.set_calculator(calc)
        FIRE(StrainFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
        e_Cu = a.get_potential_energy()/len(a)

        a = FaceCenteredCubic('Ag', size=[2,2,2])
        a.set_calculator(calc)
        FIRE(StrainFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
        e_Ag = a.get_potential_energy()/len(a)
        self.assertTrue(abs(e_Ag+2.85)<1e-6)

        a = L1_2(['Ag', 'Cu'], size=[2,2,2], latticeconstant=4.0)
        a.set_calculator(calc)
        FIRE(UnitCellFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
        e = a.get_potential_energy()
        syms = np.array(a.get_chemical_symbols())
        self.assertTrue(abs((e-(syms=='Cu').sum()*e_Cu-
                               (syms=='Ag').sum()*e_Ag)/len(a)-0.096)<0.0005)

        a = B1(['Ag', 'Cu'], size=[2,2,2], latticeconstant=4.0)
        a.set_calculator(calc)
        FIRE(UnitCellFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
        e = a.get_potential_energy()
        syms = np.array(a.get_chemical_symbols())
        self.assertTrue(abs((e-(syms=='Cu').sum()*e_Cu-
                               (syms=='Ag').sum()*e_Ag)/len(a)-0.516)<0.0005)

        a = B2(['Ag', 'Cu'], size=[2,2,2], latticeconstant=4.0)
        a.set_calculator(calc)
        FIRE(UnitCellFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
        e = a.get_potential_energy()
        syms = np.array(a.get_chemical_symbols())
        self.assertTrue(abs((e-(syms=='Cu').sum()*e_Cu-
                               (syms=='Ag').sum()*e_Ag)/len(a)-0.177)<0.0003)

        a = L1_2(['Cu', 'Ag'], size=[2,2,2], latticeconstant=4.0)
        a.set_calculator(calc)
        FIRE(UnitCellFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
        e = a.get_potential_energy()
        syms = np.array(a.get_chemical_symbols())
        self.assertTrue(abs((e-(syms=='Cu').sum()*e_Cu-
                               (syms=='Ag').sum()*e_Ag)/len(a)-0.083)<0.0005)
开发者ID:libAtoms,项目名称:matscipy,代码行数:46,代码来源:eam_calculator.py

示例5: FaceCenteredCubic

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_potential_energy [as 别名]
from asap3 import Atoms, EMT, units
from ase.lattice.cubic import FaceCenteredCubic
from asap3.md.verlet import VelocityVerlet

# Create the atoms
atoms = FaceCenteredCubic(size=(3,3,3), symbol="Cu", pbc=False)

# Give the first atom a non-zero momentum
atoms[0].set_momentum(array([0, -11.3, 0]))
print "Kinetic energies of all atoms:"
p = atoms.get_momenta()
kinenergies = 0.5 * (p * p).sum(1) / atoms.get_masses()
print kinenergies

# Associate the EMT potential with the atoms
atoms.set_calculator(EMT())

# Now do molecular dynamics, printing kinetic, potential and total
# energy every ten timesteps.
dyn = VelocityVerlet(atoms, 5.0*units.fs)
print ""
print "Energy per atom:"
print "  %15s %15s %15s" % ("Pot. energy", "Kin. energy", "Total energy")

for i in range(25):
    dyn.run(10)
    epot = atoms.get_potential_energy()/len(atoms)
    ekin = atoms.get_kinetic_energy()/len(atoms)
    print "%15.5f %15.5f %15.5f" % (epot, ekin, epot+ekin)

开发者ID:auag92,项目名称:n2dm,代码行数:31,代码来源:SimpleMD.py

示例6: FaceCenteredCubic

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_potential_energy [as 别名]
 atoms_kim = FaceCenteredCubic(size=(10,10,10), symbol='Cu')
 #atoms_kim = FaceCenteredCubic(directions=[[1,0,0],[0,1,0],[0,0,1]],
 #                    size=(30, 30, 30),
 #                    symbol="Cu")
 natoms = len(atoms_kim)
 atoms_kim.set_pbc(pbc)
 r = atoms_kim.get_positions()
 r.flat[:] += 0.1 * np.sin(np.arange(3*natoms))
 atoms_kim.set_positions(r)
 atoms_emt = atoms_kim.copy()
 kim = OpenKIMcalculator(openkimmodel, allowed=nbltype)
 emt = EMT()
 emt.set_subtractE0(False)
 atoms_kim.set_calculator(kim)
 atoms_emt.set_calculator(emt)
 ek = atoms_kim.get_potential_energy()
 ee = atoms_emt.get_potential_energy()
 ReportTest(txt+"Total energy", ek, ee, 1e-8)
 ek = atoms_kim.get_potential_energies()
 ee = atoms_emt.get_potential_energies()
 for i in range(0, natoms, step):
     ReportTest(txt+"Energy of atom %i" % (i,), ek[i], ee[i], 1e-8)
 fk = atoms_kim.get_forces()
 fe = atoms_emt.get_forces()
 n = 0
 for i in range(0, natoms, step):
     n = (n + 1) % 3
     ReportTest(txt+"Force(%i) of atom %i" % (n, i), fk[i, n], fe[i, n], 1e-8)
 sk = atoms_kim.get_stress()
 se = atoms_emt.get_stress()
 for i in range(6):
开发者ID:auag92,项目名称:n2dm,代码行数:33,代码来源:OpenKIM_EMT.py

示例7: connect

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_potential_energy [as 别名]
import numpy as np

from ase.lattice.cubic import FaceCenteredCubic
from ase.calculators.emt import EMT
from ase.utils.eos import EquationOfState
from ase.db import connect

db = connect('refs.db')

metals = ['Al', 'Au', 'Cu', 'Ag', 'Pd', 'Pt', 'Ni']
for m in metals:
    atoms = FaceCenteredCubic(m)
    atoms.set_calculator(EMT())
    e0 = atoms.get_potential_energy()
    a = atoms.cell[0][0]

    eps = 0.05
    volumes = (a * np.linspace(1 - eps, 1 + eps, 9))**3
    energies = []
    for v in volumes:
        atoms.set_cell([v**(1. / 3)] * 3, scale_atoms=True)
        energies.append(atoms.get_potential_energy())

    eos = EquationOfState(volumes, energies)
    v1, e1, B = eos.fit()

    atoms.set_cell([v1**(1. / 3)] * 3, scale_atoms=True)
    ef = atoms.get_potential_energy()

    db.write(atoms, metal=m,
             latticeconstant=v1**(1. / 3),
开发者ID:PHOTOX,项目名称:fuase,代码行数:33,代码来源:ga_fcc_references.py

示例8: print

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_potential_energy [as 别名]
    print("#"*60)
    print("GPAW benchmark: Copper Sheet")
    print("  dimensions: x=%d, y=%d, z=%d" % (x, y, z))
    print("  grid spacing: h=%f" % h)
    print("  Brillouin-zone sampling: kpts=" + str(kpts))
    print("  MPI task: %d out of %d" % (rank, size))
    print("  using MICs: " + str(use_mic))
    print("#"*60)
    print("")

# setup the system
atoms = FaceCenteredCubic(directions=[[1,-1,0], [1,1,-2], [1,1,1]],
        size=(x,y,z), symbol='Cu', pbc=(1,1,0))
#add_vacuum(atoms, 10.0)
atoms.center(vacuum=6.0, axis=2)
calc = GPAW(h=h, nbands=-20, width=0.2,
            kpts=kpts, xc='PBE',
            maxiter=maxiter,
            txt=txt, eigensolver=RMM_DIIS(niter=2),
            parallel={'sl_auto': True},
            mixer=Mixer(0.1, 5, 100),
           )
atoms.set_calculator(calc)

# execute the run
try:
    atoms.get_potential_energy()
except ConvergenceError:
    pass

开发者ID:mlouhivu,项目名称:gpaw-accelerator-benchmarks,代码行数:31,代码来源:input.py

示例9: FaceCenteredCubic

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_potential_energy [as 别名]
from ase.lattice.cubic import FaceCenteredCubic
from jasp import *
atoms = FaceCenteredCubic('Ag')
KPTS = [2, 3, 4, 5, 6, 8, 10]
TE = []
ready = True
for k in KPTS:
    with jasp('bulk/Ag-kpts-{0}'.format(k),
              xc='PBE',
              kpts=(k, k, k), #specifies the Monkhorst-Pack grid
              encut=300,
              atoms=atoms) as calc:
        try:
            TE.append(atoms.get_potential_energy())
        except (VaspSubmitted, VaspQueued):
            ready = False
if not ready:
    import sys; sys.exit()
import matplotlib.pyplot as plt
# consider the change in energy from lowest energy state
TE = np.array(TE)
TE -= TE.min()
plt.plot(KPTS, TE)
plt.xlabel('number of k-points in each dimension')
plt.ylabel('Total Energy (eV)')
plt.savefig('images/Ag-kpt-convergence.png')
plt.show()
开发者ID:EmuxEvans,项目名称:dft-book,代码行数:29,代码来源:script-86.py

示例10: in

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_potential_energy [as 别名]
 for boundary in ((1,1,1), (0,0,0), (0,1,1), (1,0,0)):
     print ("CPU Layout: %s.  Periodic boundary conditions: %s."
            % (str(cpulayout), str(boundary)))
     if ismaster:
         atoms = FaceCenteredCubic(size=(160,20,20), symbol="Cu",
                                   pbc=boundary, latticeconstant=3.61*1.04)
     else:
         atoms = None
     if isparallel:
         atoms = MakeParallelAtoms(atoms, cpulayout)
     natoms = atoms.get_number_of_atoms()
     atoms.set_calculator(EMT())
     MaxwellBoltzmannDistribution(atoms, 3000*units.kB)
     if ismaster:
         print "Initializing"
     e_st_pot = atoms.get_potential_energy()/natoms
     try:
         e_start_pot = e_start_dict[boundary]
     except KeyError:
         e_start_pot = e_start_dict[boundary] = e_st_pot
     else:
          ReportTest("Initial energy ", e_st_pot, e_start_pot, 1e-4,
                     silent=True)
     dyn = VelocityVerlet(atoms, logfile="-", dt=3*units.fs, loginterval=1)
     dyn.run(50)
     e_start = (atoms.get_potential_energy() 
                + atoms.get_kinetic_energy())/natoms
     if ismaster:
         print "Running"
     dyn = VelocityVerlet(atoms, dt=5*units.fs)
     logger = MDLogger(dyn, atoms, '-', peratom=True)
开发者ID:auag92,项目名称:n2dm,代码行数:33,代码来源:parallelLongVerlet.py

示例11: FaceCenteredCubic

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_potential_energy [as 别名]
from kimcalculator import *
from numpy import *

symbol = 'Ar'
cells = 15
ar = FaceCenteredCubic(symbol, pbc=[(1,1,1)], directions=[[1,0,0],[0,1,0],[0,0,1]], size=[cells,cells,1])

for m in listmodels():
    if symbol in m:
        try:
            print "Try model: ", m
            calc1 = KIMCalculator(m)
            ar.set_calculator(calc1)
           
            N = ar.get_number_of_atoms()
            ar.set_pbc([(1,1,1)])
            bulk_energy = ar.get_potential_energy() / N

            ar.set_pbc([(1,1,0)])
            surf_energy = ar.get_potential_energy() / N
            print "\tsurface = ", surf_energy - bulk_energy  

            #virial = ar.get_stresses()
            #print "\tvirial = ", virial
            print      
        except SupportError, e:
            print "\tskipping ", m, "\n\t", e, " ...\n"
            continue 


开发者ID:mattbierbaum,项目名称:openkim-kimcalculator-ase,代码行数:30,代码来源:test_surface_energy.py

示例12: FaceCenteredCubic

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_potential_energy [as 别名]
from kimservice import *
import ase
from ase.lattice.cubic import FaceCenteredCubic, SimpleCubic 
from ase.visualize import view
from kimcalculator import *
from numpy import *
from ase.calculators.emt import EMT

N = 10 
ar = FaceCenteredCubic('Ar', pbc=[(1,1,1)], directions=[[1,0,0],[0,1,0],[1,1,1]], size=[N,N,N])

calc1 = KIMCalculator("ex_model_Ar_P_LJ")
ar.set_calculator(calc1)
print "energy = ", ar.get_potential_energy()

开发者ID:woosong,项目名称:openkim-python,代码行数:16,代码来源:test_ase_kim.py

示例13: FaceCenteredCubic

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_potential_energy [as 别名]
"""Check that energy is correct even after wrapping through periodic boundary conditions.
"""

from ase.lattice.cubic import FaceCenteredCubic
from asap3 import *
from asap3.testtools import *
import random

ref_atoms = FaceCenteredCubic(size=(7,7,7), symbol="Cu", pbc=(True, False, True))
ref_atoms.set_calculator(EMT())

ref_energy = ref_atoms.get_potential_energy()
ref_energies = ref_atoms.get_potential_energies()
ref_forces = ref_atoms.get_forces()

passes = 5
for ps in range(passes):
    print "Pass", ps, "of", passes

    atoms = ref_atoms.copy()
    atoms.set_calculator(EMT())
    nat = random.randint(0, len(atoms))
    assert nat < len(atoms)
    pos0 = atoms[nat].position
    cell = atoms.get_cell()
    for d in range(1,4):
        for dx in (-d, 0, d):
            #for dy in (-d, 0, d):
            for dy in (0,):
                for dz in (-d, 0 ,d):
                    deltar = dx * cell[0] + dy * cell[1] + dz * cell[2]
开发者ID:auag92,项目名称:n2dm,代码行数:33,代码来源:PBCwrap.py

示例14: FaceCenteredCubic

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_potential_energy [as 别名]
from jasp import *
from ase.lattice.cubic import FaceCenteredCubic
from ase.dft import DOS
atoms = FaceCenteredCubic(directions=[[0,1,1],
                                      [1,0,1],
                                      [1,1,0]],
                                      size=(1,1,1),
                                      symbol='Ni')
atoms[0].magmom = 1
with jasp('bulk/Ni-PBE',
          ismear=-5,
          kpts=(5,5,5),
          xc='PBE',
          ispin=2,lorbit=11,
          atoms=atoms) as calc:
    print 'PBE energy:   ',atoms.get_potential_energy()
    dos = DOS(calc, width=0.2)
    e_pbe = dos.get_energies()
    d_pbe = dos.get_dos()
    calc.clone('bulk/Ni-PBE0')
    calc.clone('bulk/Ni-HSE06')
with jasp('bulk/Ni-PBE0') as calc:
     calc.set(lhfcalc=True,
              algo='D',
              time=0.4)
     atoms = calc.get_atoms()
     print 'PBE0 energy:  ',atoms.get_potential_energy()
     dos = DOS(calc, width=0.2)
     e_pbe0 = dos.get_energies()
     d_pbe0 = dos.get_dos()
with jasp('bulk/Ni-HSE06') as calc:
开发者ID:kcantosh,项目名称:dft-book,代码行数:33,代码来源:script-200.py

示例15: enumerate

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_potential_energy [as 别名]
            for i2, p2 in enumerate(positions[:i1]):
                diff = p2 - p1
                d2 = np.dot(diff, diff)
                c6 = (self.sigma**2 / d2)**3
                c12 = c6**2
                if d2 < self.cutoff**2:
                    self.energy += 4 * self.epsilon * (c12 - c6) - self.shift
                F = 24 * self.epsilon * (2 * c12 - c6) / d2 * diff
                self._forces[i1] -= F
                self._forces[i2] += F
        self.positions = positions.copy()



N = 5
ar = FaceCenteredCubic('Ar', pbc=[(0,0,0)], directions=[[1,0,0],[0,1,0],[0,0,1]], size=[N,N,N])
print ar.get_cell()
#view(ar) 

calc1 = KIMCalculator("ex_model_Ar_P_LJ")
ar.set_calculator(calc1)
kim_energy = ar.get_potential_energy()
print "kim energy = ", kim_energy 

calc2 = LennardJones(epsilon=epsilon, sigma=sigma, cutoff=cutoff)
ar.set_calculator(calc2)
ase_energy = ar.get_potential_energy()
print "ase energy = ", ase_energy 

print "difference = ", kim_energy - ase_energy
开发者ID:mattbierbaum,项目名称:openkim-kimcalculator-ase,代码行数:32,代码来源:test_lj_energy.py


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