Exemplo n.º 1
0
from ase import *
from hotbit import *
from numpy import *
from box.systems import nanotube

# testing chiral
atoms = nanotube('C',1.42,5,0)
atoms = Atoms(atoms,container='Chiral')
atoms.set_container(angle=0.0)
traj=PickleTrajectory('tmp.trj','w',atoms)
for angle in concatenate( (linspace(0,pi/2,50),linspace(pi/2,0,50)) ):
    atoms.set_container(angle=angle,scale_atoms=True)
    traj.write()
        
    
h = atoms.get_cell()[2,2]
for height in concatenate( (linspace(h,2*h,59),linspace(2*h,h,50)) ):
    atoms.set_container(height=height,scale_atoms=True)
    traj.write()
    
for height,angle in zip( linspace(h,2*h),linspace(0,pi/4,50) ):
    atoms.set_container(angle=angle,height=height,scale_atoms=True)
    traj.write()
    
    
# testing wedge
atoms = Atoms('C2',[(2,0,0),(2.5,1,1)],container='Wedge')
atoms.set_container(angle=pi/4,height=2.0)

traj=PickleTrajectory('tmp2.trj','w',atoms)
for height in concatenate( (linspace(2,4,50),linspace(4,2,50)) ):
Exemplo n.º 2
0
from ase import *
from hotbit import *
from numpy import *
from box.systems import nanotube

# testing chiral
atoms = nanotube('C', 1.42, 5, 0)
atoms = Atoms(atoms, container='Chiral')
atoms.set_container(angle=0.0)
traj = PickleTrajectory('tmp.trj', 'w', atoms)
for angle in concatenate((linspace(0, pi / 2, 50), linspace(pi / 2, 0, 50))):
    atoms.set_container(angle=angle, scale_atoms=True)
    traj.write()

h = atoms.get_cell()[2, 2]
for height in concatenate((linspace(h, 2 * h, 59), linspace(2 * h, h, 50))):
    atoms.set_container(height=height, scale_atoms=True)
    traj.write()

for height, angle in zip(linspace(h, 2 * h), linspace(0, pi / 4, 50)):
    atoms.set_container(angle=angle, height=height, scale_atoms=True)
    traj.write()

# testing wedge
atoms = Atoms('C2', [(2, 0, 0), (2.5, 1, 1)], container='Wedge')
atoms.set_container(angle=pi / 4, height=2.0)

traj = PickleTrajectory('tmp2.trj', 'w', atoms)
for height in concatenate((linspace(2, 4, 50), linspace(4, 2, 50))):
    atoms.set_container(height=height, scale_atoms=True)
    traj.write()
Exemplo n.º 3
0
from ase import *
from hotbit import *
from numpy import *
from box.systems import nanotube

atoms = nanotube(9,0)
angle = atoms.container.get('angle')
traj = PickleTrajectory('twisting.traj','w',atoms)

# twist without scaling
for twist in linspace(0,pi/10,100):
    atoms.set_container(angle=angle+twist)
    traj.write()
    
# twist with scaling
atoms.set_container(angle=angle)
for twist in linspace(0,pi/10,100):
    atoms.set_container(angle=angle+twist,scale_atoms=True)
    traj.write()
    
# twist with scaling + view copies
cp = atoms.extended_copy((1,1,10))
traj = PickleTrajectory('twisting_extended.traj','w',cp)

atoms.set_container(angle=angle,scale_atoms=True)
for twist in linspace(0,pi/10,100):
    atoms.set_container(angle=angle+twist,scale_atoms=True)
    cp.set_positions( atoms.extended_copy((1,1,10)).get_positions() )
    traj.write()
    
    
from ase import *
from hotbit import *
from numpy import *
from box.systems import nanotube

atoms = nanotube(9, 0)
angle = atoms.container.get('angle')
traj = PickleTrajectory('twisting.traj', 'w', atoms)

# twist without scaling
for twist in linspace(0, pi / 10, 100):
    atoms.set_container(angle=angle + twist)
    traj.write()

# twist with scaling
atoms.set_container(angle=angle)
for twist in linspace(0, pi / 10, 100):
    atoms.set_container(angle=angle + twist, scale_atoms=True)
    traj.write()

# twist with scaling + view copies
cp = atoms.extended_copy((1, 1, 10))
traj = PickleTrajectory('twisting_extended.traj', 'w', cp)

atoms.set_container(angle=angle, scale_atoms=True)
for twist in linspace(0, pi / 10, 100):
    atoms.set_container(angle=angle + twist, scale_atoms=True)
    cp.set_positions(atoms.extended_copy((1, 1, 10)).get_positions())
    traj.write()
Exemplo n.º 5
0
from ase import *
from hotbit import *
from hotbit.atoms import Atoms
from box.systems import nanotube
from box.md import check_energy_conservation

nkpts=10
SCC=True
cut=5.0
# check that SCC works for chiral atoms

# energy of normal infinite (5,0) 
straight = nanotube('C',1.42,5,0)
straight.set_pbc((False,False,True))
for i in range(len(straight)):
    if straight[i].z<1.0:
        r=sqrt(straight[i].x**2+straight[i].y**2)
        c=(1+r)/r
        x,y,z = c*straight[i].x,c*straight[i].y,straight[i].z
        straight+=Atom('H',(x,y,z))
#view(straight)
calc = Hotbit(SCC=SCC,txt='chiral.cal',kpts=(1,1,nkpts),gamma_cut=cut)
straight.set_calculator(calc)
e1 = straight.get_potential_energy()



# same thing, but calculate by twisting 2*pi/5 while translating
height = straight.get_cell()[2,2]
chiral = Atoms(container='Chiral')
chiral += straight
Exemplo n.º 6
0
from ase import *
from hotbit import *
from math import pi
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))