def _hexagonal(self): """Define hexagonal molecule. Returns ------- hex : Molecule Hexagonal molecule object """ hex = Molecule() hex.add("Si", [0, 0, 0]) hex.add("O", 0, r=self._b, theta=self._a, phi=60) hex.add("Si", 1, r=self._b, bond=[0, 1]) hex.add("O", 2, r=self._b, theta=180, phi=0) hex.add("Si", 3, r=self._b, bond=[2, 3]) hex.add("O", 4, r=self._b, theta=self._a, phi=300) hex.add("Si", 5, r=self._b, bond=[4, 5]) hex.add("O", 6, r=-self._b, theta=self._a, phi=60) hex.add("Si", 7, r=self._b, bond=[6, 7]) hex.add("O", 8, r=-self._b, theta=180, phi=0) hex.add("Si", 9, r=self._b, bond=[8, 9]) hex.add("O", 10, r=-self._b, theta=self._a, phi=300) hex.rotate("y", 90) hex.rotate("z", 90) hex.rotate("y", 180) hex.rotate("x", geometry.angle(hex.bond(8, 6), [0, 1, 0])) hex.rotate("x", -90) return hex
def siloxane(self, sites, amount, normal, slx_dist=0.507, trials=1000, site_type="in"): """Attach siloxane bridges on the surface similar to Krishna et al. (2009). Here silicon atoms of silanol groups wich are at least 0.31 nm near each other can be converted to siloxan bridges, by removing one oxygen atom of the silanol groups and moving the other at the center of the two. Parameters ---------- sites : list List of silicon ids of which binding sites should be picked amount : int Number of molecules to attach normal : function Function that returns the normal vector of the surface for a given position slx_dist : float Silicon atom distance to search for parters in proximity trials : integer, optional Number of trials picking a random site site_type : string, optional Site type - interior **in**, exterior **ex** """ # Check site type input if not site_type in ["in", "ex"]: print("Pore - Wrong attachement site-type...") return # Create siloxane molecule mol = Molecule("siloxane", "SLX") mol.add("O", [0, 0, 0], name="OM1") mol.add("O", 0, r=0.09, name="OM1") mount = 0 axis = [0, 1] # Rotate molecule towards z-axis mol_axis = mol.bond(*axis) mol.rotate(geometry.cross_product(mol_axis, [0, 0, 1]), geometry.angle(mol_axis, [0, 0, 1])) mol.zero() # Search for silicon atoms near each other si_atoms = [self._block.get_atom_list()[atom] for atom in sites] si_dice = Dice(Molecule(inp=si_atoms), slx_dist+0.1, True) si_proxi = si_dice.find_parallel(None, ["Si", "Si"], slx_dist, 1e-2) si_matrix = {x[0]: x[1] for x in si_proxi} # Run through number of siloxan bridges to add mol_list = [] for i in range(amount): # Randomly pick an available site pair si = [] for j in range(trials): si_rand = random.choice(sites) if sites.index(si_rand) in si_matrix and si_matrix[sites.index(si_rand)]: si_rand_proxi = sites[si_matrix[sites.index(si_rand)][0]] if sites.index(si_rand_proxi) in si_matrix: if self._sites[si_rand]["state"] and (self._sites[si_rand_proxi]["state"]): si = [si_rand, si_rand_proxi] break # Place molecule on surface if si and self._sites[si[0]]["state"] and self._sites[si[1]]["state"]: # Create a copy of the molecule mol_temp = copy.deepcopy(mol) # Calculate center position pos_vec_halve = [x/2 for x in geometry.vector(self._block.pos(si[0]), self._block.pos(si[1]))] center_pos = [pos_vec_halve[x]+self._block.pos(si[0])[x] for x in range(self._dim)] # Rotate molecule towards surface normal vector surf_axis = normal(center_pos) mol_temp.rotate(geometry.cross_product([0, 0, 1], surf_axis), -geometry.angle([0, 0, 1], surf_axis)) # Move molecule to mounting position and remove temporary atom mol_temp.move(mount, center_pos) mol_temp.delete(0) # Add molecule to molecule list and global dictionary mol_list.append(mol_temp) if not mol_temp.get_short() in self._mol_dict[site_type]: self._mol_dict[site_type][mol_temp.get_short()] = [] self._mol_dict[site_type][mol_temp.get_short()].append(mol_temp) # Remove oxygen atom and if not geminal delete site for si_id in si: self._matrix.strip(self._sites[si_id]["o"][0]) if len(self._sites[si_id]["o"])==2: self._sites[si_id]["o"].pop(0) else: del self._sites[si_id] del si_matrix[sites.index(si_id)] return mol_list