Пример #1
0
    def _update_atoms(self, atoms):
        """ Update atoms-object, whether it is ase.Atoms or hotbit.Atoms. """

        if hasattr(atoms, 'container'):
            self.atoms = atoms.copy()
        else:
            container = container_magic(atoms)
            #print 'cc',container
            atoms_cont = Atoms(atoms=atoms, container=container)
            self.atoms = atoms_cont.copy()
Пример #2
0
    x3, y3 = calc.get_covalent_energy('atoms', i=1, j=1)
    assert abs((y1 + y2 + y3).sum() - y.sum()) < eps

    sm = 0.0
    for i in range(calc.st.norb):
        for j in range(i, calc.st.norb):
            x1, y1 = calc.get_covalent_energy('orbitals', i=i, j=j)
            sm += y1.sum()
    assert abs(y.sum() - sm) < eps

if True:
    # check that C1H1-presentation of C6H6 goes right
    n1 = 4
    SCC = True
    cut = 1E10
    a1 = Atoms('CH', [(1.42, 0, 0), (2.42, 0.1, 0.1)], container='Wedge')
    a1.set_container(M=6, height=10)
    aux = a1.extended_copy([(1, 0, 0)])
    a1 += aux
    a1.set_container(M=3, height=10)

    n2 = 12
    c1 = Hotbit(SCC=SCC,
                txt='-',
                kpts=(3, 1, 1),
                gamma_cut=cut,
                **default_param)
    a1.set_calculator(c1)
    a1.get_potential_energy()

    a2 = a1.extended_copy((3, 1, 1))
Пример #3
0
from ase import *
from ase import Atoms as ase_Atoms
from hotbit import *
from hotbit.atoms import Atoms
from box.md import check_energy_conservation
from hotbit.test.misc import default_param

SCC = True
cut = 3.0
atoms = Atoms('CH', [(1.42, 0, 0), (2.42, 0, 0)], container='Wedge')
atoms.set_container(M=6, height=10)

calc = Hotbit(SCC=SCC,
              txt='tmp.cal',
              kpts=(6, 1, 1),
              gamma_cut=cut,
              **default_param)
atoms.set_calculator(calc)
e1 = atoms.get_potential_energy()

aux = atoms.extended_copy((3, 1, 1))
atoms2 = Atoms(container='Wedge')
atoms2 += aux[0]
atoms2 += aux[-1]
atoms2.set_container(M=6, height=10)

#view(atoms2)
calc = Hotbit(SCC=SCC,
              txt='tmp.cal',
              kpts=(6, 1, 1),
              gamma_cut=cut,
Пример #4
0
import ase.units as units
from ase import *
from ase import Atoms as ase_Atoms
from hotbit import *
from hotbit.atoms import Atoms
from box.md import check_energy_conservation
from hotbit.test.misc import default_param

# check that C1H1-presentation of C6H6 goes right
SCC = True
cut = 3.0
atoms = Atoms('CH', [(1.42, 0, 0), (2.0, 1.0, 0.2)], container='Wedge')
atoms.set_container(M=6, height=10)

calc = Hotbit(SCC=SCC,
              txt='tmp.cal',
              kpts=(6, 1, 1),
              gamma_cut=cut,
              **default_param)
atoms.set_calculator(calc)
e1 = atoms.get_potential_energy()

atoms6 = ase_Atoms(pbc=False)
atoms6 += atoms.extended_copy([(i - 2, 0, 0) for i in range(6)])
#view(atoms)
calc = Hotbit(SCC=SCC, txt='tmp.cal', gamma_cut=cut, **default_param)
atoms6.set_calculator(calc)
e6 = atoms6.get_potential_energy()

assert abs(6 * e1 - e6) < 1E-5
Пример #5
0
from hotbit.atoms import Atoms
from box.systems import nanotube
from box.md import check_energy_conservation

nkpts=10

# energy of normal infinite (5,0) 
straight = nanotube(5,0,1.42)
calc = Hotbit(SCC=False,txt='chiral.cal',kpts=(1,1,nkpts))
straight.set_calculator(calc)
e1 = straight.get_potential_energy()
#view(straight)


# same thing, but calculate by twisting 2*pi/5 while translating
height = straight.get_cell()[2,2]
chiral = Atoms(container='Chiral')
chiral += straight
chiral.set_container(height=height,angle=2*pi/5)
calc = Hotbit(SCC=False,txt='chiral.cal',kpts=(1,1,nkpts))
chiral.set_calculator(calc)
e2 = chiral.get_potential_energy()
assert abs(e1-e2)<1E-6


# check the energy conservation for the chiral situation
#chiral.rattle(0.1)
#calc = Hotbit(SCC=False,txt='chiral.cal',kpts=(1,1,1))
#chiral.set_calculator(calc)
#conv = check_energy_conservation(chiral,dt=0.5*fs,steps=50,tol=0.01,plot=False)
#assert conv