From 7b90f5c0998e0cf4c8322c9914ccfd21526e098a Mon Sep 17 00:00:00 2001 From: zhzhang7549 Date: Thu, 9 Jan 2025 16:28:46 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=90=B8=E9=99=84?= =?UTF-8?q?=E5=88=86=E5=AD=90=E4=B8=8E=E5=90=B8=E9=99=84=E4=BD=8D=E7=82=B9?= =?UTF-8?q?=E7=9A=84=E4=BD=8D=E7=BD=AE=EF=BC=8C=E4=BD=BF=E5=85=B6=E5=A4=84?= =?UTF-8?q?=E4=BA=8E=E6=99=B6=E6=A0=BC=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HTMACat/model/Ads.py | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/HTMACat/model/Ads.py b/HTMACat/model/Ads.py index be1a7eb..166ba63 100644 --- a/HTMACat/model/Ads.py +++ b/HTMACat/model/Ads.py @@ -25,7 +25,7 @@ def __init__(self, species: list, sites: list, settings={}, spec_ads_stable=None "NH2": [2], "NH": [2, 4], "N": [2, 4], - "O": [2, 4], + "O": [3], "OH": [2, 4], "NO": [2, 4], "H2O": [1], @@ -136,7 +136,21 @@ def dist_of_nearest_diff_neigh_site(self, slab, site_coords): imagesites_distances = [np.sqrt(np.sum(np.square(v[:2]-coord_images[0][:2]))) for v in coord_images] d = np.min(imagesites_distances[1:]) return d - + + def adjust_fractional_coordinates(self, atoms): + cell = atoms.get_cell() + fractional_coords = atoms.get_scaled_positions() + + # 调整x坐标范围 + fractional_coords[:, 0] += 0.5 + fractional_coords[:, 0] %= 1.0 # 将x坐标重新映射到0到1之间 + # 调整y坐标范围 + fractional_coords[:, 1] += 0.5 + fractional_coords[:, 1] %= 1.0 # 将y坐标重新映射到0到1之间 + + # 将调整后的分数坐标应用回结构 + atoms.set_scaled_positions(fractional_coords) + def Construct_single_adsorption(self, ele=None): _direction_mode = self.settings['direction'] _rotation_mode = self.settings['rotation'] @@ -184,11 +198,13 @@ def Construct_single_adsorption(self, ele=None): direction_mode=_direction_mode, site_coord = coord_, z_bias=_z_bias) - if type(tmp) == list: + if isinstance(tmp, list): for ii, t in enumerate(tmp): + self.adjust_fractional_coordinates(t) slab_ad += [t] else: - slab_ad += [tmp] + self.adjust_fractional_coordinates(tmp) + slab_ad.append(tmp) #if len(bond_atom_ids) > 1: # slab_ad += [builder._single_adsorption(ads_use, bond=bond_id, site_index=j, direction_mode='decision_boundary', direction_args=bond_atom_ids)] else: @@ -204,11 +220,15 @@ def Construct_single_adsorption(self, ele=None): direction_mode=_direction_mode, site_coord = coord_, z_bias=_z_bias) - if type(tmp) == list: + if isinstance(tmp, list): for ii, t in enumerate(tmp): - slab_ad += [t] + # 调整分数坐标范围 + self.adjust_fractional_coordinates(t) + slab_ad.append(t) else: - slab_ad += [tmp] + # 调整分数坐标范围 + self.adjust_fractional_coordinates(tmp) + slab_ad.append(tmp) return slab_ad def Construct_double_adsorption(self): @@ -452,11 +472,13 @@ def Construct_coadsorption_11(self, ele=['','']): bind_surfatoms, bind_surfatoms_symb, ) = get_binding_adatom(adslab) + print(f"Adsorption {j+1}: {adspecie, bind_type_symb}") adspecie_tmp, bind_type_symb_tmp = [], [] for k, spe in enumerate(adspecie): if spe in ads_type.keys(): adspecie_tmp += [spe] bind_type_symb_tmp += [bind_type_symb[k]] + print(f"Adsorption configuration1 {j+1}: {adspecie_tmp, bind_type_symb_tmp}") if len(adspecie_tmp) < 2: # print('Can not identify the config!') slab_ad_final += [adslab] From 05402e85f5b66fc954198aaf659629d27c6af31e Mon Sep 17 00:00:00 2001 From: zhihongZhang <126555623+zhzhang7549@users.noreply.github.com> Date: Thu, 9 Jan 2025 16:45:23 +0800 Subject: [PATCH 2/4] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 762ed92..8e59314 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: matrix: python-version: ["3.7", "3.8"] From 2c28342f03ea22532202ca33408fc497603d9aae Mon Sep 17 00:00:00 2001 From: zhzhang7549 Date: Thu, 16 Jan 2025 15:31:57 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0O=E7=9A=84=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E5=90=B8=E9=99=84=E4=BD=8D=E7=82=B9=E7=A1=AE=E4=BF=9D?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HTMACat/model/Ads.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/HTMACat/model/Ads.py b/HTMACat/model/Ads.py index 166ba63..83bf774 100644 --- a/HTMACat/model/Ads.py +++ b/HTMACat/model/Ads.py @@ -25,7 +25,7 @@ def __init__(self, species: list, sites: list, settings={}, spec_ads_stable=None "NH2": [2], "NH": [2, 4], "N": [2, 4], - "O": [3], + "O": [2, 3], "OH": [2, 4], "NO": [2, 4], "H2O": [1], @@ -485,6 +485,8 @@ def Construct_coadsorption_11(self, ele=['','']): elif typ.get(bind_type_symb_tmp[0]) in ads_type.get(adspecie_tmp[0]) and \ typ.get(bind_type_symb_tmp[1]) in ads_type.get(adspecie_tmp[1]): slab_ad_final += [adslab] + print(len(slab_ad_final)) + print(slab_ad_final) return slab_ad_final def Construct_coadsorption_12(self): From 045e10c9aec28d021e7dc4e451772e80c32d0256 Mon Sep 17 00:00:00 2001 From: zhzhang7549 Date: Mon, 12 May 2025 15:37:34 +0800 Subject: [PATCH 4/4] test --- HTMACat/model/Ads.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HTMACat/model/Ads.py b/HTMACat/model/Ads.py index 83bf774..c116799 100644 --- a/HTMACat/model/Ads.py +++ b/HTMACat/model/Ads.py @@ -25,7 +25,7 @@ def __init__(self, species: list, sites: list, settings={}, spec_ads_stable=None "NH2": [2], "NH": [2, 4], "N": [2, 4], - "O": [2, 3], + "O": [1,2, 3], "OH": [2, 4], "NO": [2, 4], "H2O": [1],