def get_p_axis(self): totalizator = [ 0, 0, 0 ] #each of the indexes refer to an axis of the cartesian space for line in self.mol_file: #run through the file searching for values near 0 'zero' data = line.split() if len( data ) >= 4: #it is agreed that the lines must have this length and all the values should be numbers if not is_number(data[1]): continue if not is_number(data[2]): continue if not is_number(data[3]): continue axis = [('X', 0, abs(float(data[1]))), ('Y', 1, abs(float(data[2]))), ('Z', 2, abs(float(data[3])))] temp = sorted(axis, key=lambda eixo: eixo[2]) totalizator[temp[0][1]] += 1 greater = 0 for i in range(len(totalizator)): if totalizator[i] > totalizator[greater]: greater = i return self.axis_enum[greater]
def get_biggest_coordinate(self):#get the biggest coordinate of any atom in a molucule in any axis biggest_ = 0 for line in self.mol_file : if len(line.split()) >= 4 : x = abs(float(line.split()[1])) if is_number(line.split()[1])else "" y = abs(float(line.split()[2])) if is_number(line.split()[2])else "" z = abs(float(line.split()[3])) if is_number(line.split()[3])else "" if x == "" or y == "" or z == "" :#do not compute invalid lines continue if biggest_ < x : biggest_ = x if biggest_ < y : biggest_ = y if biggest_ < z: biggest_ = z return biggest_
def get_biggest_coordinate(mol_file):#get the biggest coordinate of any atom in a molucule in any axis biggest_ = 0 for line in mol_file : if len(line.split()) >= 4 : x = abs(float(line.split()[1])) if is_number(line.split()[1])else "" y = abs(float(line.split()[2])) if is_number(line.split()[2])else "" z = abs(float(line.split()[3])) if is_number(line.split()[3])else "" if x == "" or y == "" or z == "" :#do not compute invalid lines continue if biggest_ < x : biggest_ = x if biggest_ < y : biggest_ = y if biggest_ < z: biggest_ = z return biggest_
def get_p_axis(mol_file): totalizator = [0,0,0]#each of the indexes refer to an axis of the cartesian space index_ = 0 for line in mol_file :#run through the file searching for values near 0 'zero' if len(line.split()) >= 4 : x = abs(float(line.split()[1])) if is_number(line.split()[1])else "" y = abs(float(line.split()[2])) if is_number(line.split()[2])else "" z = abs(float(line.split()[3])) if is_number(line.split()[3])else "" if x == "" or y == "" or z == "" :#do not compute invalid lines continue index_ = 0 if x < y and x < z else 1 if y < z and y < x else 2#the smaller one is the winner totalizator[index_] += 1#and is incremented if totalizator[0] > totalizator[1] :#return the string representing the axis that is perpendicular to the plane of the molucule if totalizator[0] > totalizator[2] : return 'BXLAO' else : return 'BZLAO' elif totalizator[1] > totalizator[2]: return 'BYLAO' else : return 'BZLAO'
def get_p_axis(self): totalizator = [0, 0, 0]#each of the indexes refer to an axis of the cartesian space for line in self.mol_file :#run through the file searching for values near 0 'zero' data = line.split() if len(data) >= 4:#it is agreed that the lines must have this length and all the values should be numbers if not is_number(data[1]) : continue if not is_number(data[2]) : continue if not is_number(data[3]) : continue axis = [ ('X', 0, abs(float(data[1]))), ('Y', 1, abs(float(data[2]))), ('Z', 2, abs(float(data[3])))] temp = sorted(axis, key=lambda eixo:eixo[2] ) totalizator[temp[0][1]] += 1 greater = 0 for i in range(len(totalizator)): if totalizator[i] > totalizator[greater]: greater = i return self.axis_enum[greater]