def equilShape(element,params,size=(10,10,10),distance=25.0,corrections=0,structure='fcc'):
    """
    this is to use the ratio of energies to calculate the equilibrium crystal shape, cycle through a bunch of (h,k,l) indices
    """
    slab = FaceCenteredCubic(element,directions=([[1,0,0],[0,1,0],[0,0,1]]),size=(10,10,10))    
    energy100 = fitFunction([1,0,0],params,corrections,structure)
    h100 = distance
    orig_positions = slab.get_positions()
    kept_positions = list(orig_positions)
    center = slab.get_center_of_mass()
    for h in range(-12,12):
        for k in range(0,9):
            for l in range(0,9):
                nvector=list([h,k,l]/numpy.sqrt(h**2+k**2+l**2))
                energyhkl = fitFunction(nvector,params,corrections,structure)
                distancehkl = energyhkl/energy100*h100
                for i in range(0,len(kept_positions)):
                    list_to_pop = []
                    if numpy.dot(kept_positions[i],nvector) > distancehkl:
                        list_to_pop.append(i)
                for i in list_to_pop:
                    kept_positions.pop(i)
    
    # set up new slab with new positions
    number_of_atoms = len(kept_positions)
    elstring = str(number_of_atoms)+'Pt' 
    new_slab = Atoms(elstring,positions=kept_positions)

    return new_slab
Example #2
0
from ase.visualize import view
import math

a = float(input("Ingrese parametro de red : "))
arc = open("fcc_108000.txt","w")

atomos = FaceCenteredCubic(directions=[[1,0,0],[0,1,0],[0,0,1]],
 										size=(30,30,30),symbol='Cu',pbc=(1,1,1),latticeconstant=a)

posi = atomos.get_positions()
simbol = atomos.get_chemical_symbols()

arc.write(str(len(simbol))+"\n")

for i in range(len(simbol)):
	arc.write(str(posi[i,0])+" ")
	arc.write(str(posi[i,1])+" ")
	arc.write(str(posi[i,2])+"\n")

#----Luego borrar----#
#write('fcc_108000.txt',atomos,format='xyz')
pos = atomos.get_positions()
c_m = atomos.get_center_of_mass()
coor_x = pos[:,0]
coor_y = pos[:,1]
coor_z = pos[:,2]
print "posicion de cero",pos[0]
print "centro de masa", c_m
print "x_max y x_min:",coor_x.max(),coor_x.min()
#view(atoms)