コード例 #1
0
def O_O(atoms, n_Al):
    '''
	finds the distance between two oxygen atoms where H is bonded
	Inputs:
		atoms: ase atoms object
		n_Al : number of Al atoms in qm region
	Output: distance between two oxygen atoms where H is bonded [0 if n_Al = 1]
	'''

    H_index, O_index = [], []  #indexes of H and O atoms

    if n_Al == 1:
        distance = 0
    elif n_Al == 2:
        for atom in atoms:
            'find H atoms in qm region'
            if atom.symbol == 'H':
                H_index.append(atom.index)

        for H in H_index:
            'find closest O to the H'
            d_min = 100  #start with a large value (dummy value)

            for atom in atoms:
                if atom.symbol == 'O':
                    if atoms.get_distance(H, atom.index) < d_min:
                        d_min = atoms.get_distance(H, atom.index)
                        O_atom = atom.index

            O_index.append(O_atom)

        distance = atoms.get_distance(O_index[0], O_index[1])

    return distance
コード例 #2
0
def Al_Al(atoms):
    '''
	finds distance between 2 Al atoms in qm region
	Input : ase atoms object
	Output: Al-Al distance [unless there is one Al, distance then is 0] and number of Al atoms
	'''

    n_Al = 0  #number of Al atoms
    Al_index = []  #index of Al atom

    for atom in atoms:
        if atom.symbol == 'Al':
            n_Al += 1
            Al_index.append(atom.index)

    if n_Al == 1:
        distance = 0
    elif n_Al == 2:
        distance = atoms.get_distance(Al_index[0], Al_index[1])

    return distance, n_Al
コード例 #3
0
ファイル: functions.py プロジェクト: aljamaha/Zeolite
def Pd_H(atoms, n_Al):
    '''
	finds the distance between Pd and H 
	Inputs:
		atoms: ase atoms object
		n_Al : number of Al atoms in qm region
	Output: distance between H and Pd atom [0 if n_Al = 1]
	'''

    if n_Al == 1:
        distance = 0
    elif n_Al == 2:
        for atom in atoms:
            'find H atoms in qm region'
            if atom.symbol == 'H':
                H_index = atom.index
            elif atom.symbol == 'Pd':
                Pd_index = atom.index

        distance = atoms.get_distance(Pd_index, H_index)

    return distance