def test_one(): """Test one complex.""" elements, coordinates = read_xyz(DATA_DIR / "xyz" / "1.xyz") bv = BuriedVolume(elements, coordinates, 1, excluded_atoms=[1, 2, 3, 4, 5, 6, 7]) assert_almost_equal(bv.fraction_buried_volume * 100, 29.6, decimal=1)
def test_one(): """Test complex one.""" atom_areas_ref = np.loadtxt(DATA_DIR / "atom_areas/1.txt") elements, coordinates = read_xyz(XYZ_DIR / "1.xyz") sasa = SASA(elements, coordinates) atom_areas: Array1DFloat = np.array(list(sasa.atom_areas.values())) assert_almost_equal(sasa.area, 624, decimal=0) assert_array_almost_equal(atom_areas, atom_areas_ref, decimal=0)
def test_reference(sasa_data): """Test against SASA reference data.""" idx, data = sasa_data sasa_ref = float(data["area"]) atom_areas_ref = np.loadtxt(DATA_DIR / f"atom_areas/{idx}.txt") elements, coordinates = read_xyz(XYZ_DIR / f"{idx}.xyz") sasa = SASA(elements, coordinates) atom_areas: Array1DFloat = np.array(list(sasa.atom_areas.values())) assert_almost_equal(sasa.area, sasa_ref, decimal=0) assert_array_almost_equal(atom_areas, atom_areas_ref, decimal=0)
def test_reference(cone_angle_data): """Test against cone angle reference data.""" for metal in ("pd", "pt", "ni"): label, data = cone_angle_data cone_angle_ref = float(data[f"{metal}_cone_angle"]) if label == "standard": xyz_path = DATA_DIR / f"{metal}/{data[f'{metal}_xyz']}.xyz" elif label == "maximum": xyz_path = DATA_DIR / f"{metal}/maximum/{data[f'{metal}_xyz']}.xyz" elements, coordinates = read_xyz(xyz_path) ca = ConeAngle(elements, coordinates, 1, radii_type="bondi") assert_almost_equal(ca.cone_angle, cone_angle_ref, decimal=1)
def test_reference(bv_data): """Test against buried volume reference data.""" data = bv_data idx = int(data["idx"]) percent_buried_volume_ref = float(data["buried_volume"]) excluded_atoms = [int(i) for i in data["excluded_atoms"].split()] elements, coordinates = read_xyz(DATA_DIR / "xyz" / f"{idx}.xyz") bv = BuriedVolume(elements, coordinates, 1, excluded_atoms=excluded_atoms) assert_almost_equal(bv.fraction_buried_volume * 100, percent_buried_volume_ref, decimal=0)
def test_reference(bite_angle_data): """Test against buried volume reference data.""" data = bite_angle_data metal_idx = int(data["idx_metal"]) ligand_idx_1 = int(data["idx_ligand_1"]) ligand_idx_2 = int(data["idx_ligand_2"]) bite_angle_ref = float(data["bite_angle"]) filename = data["filename"] _, coordinates = read_xyz(DATA_DIR / "xyz" / filename) bite_angle = BiteAngle(coordinates, metal_idx, ligand_idx_1, ligand_idx_2) assert_almost_equal(bite_angle.angle, bite_angle_ref, decimal=2)
def test_fukui(): """Test Fukui coefficients.""" elements, coordinates = read_xyz(DATA_DIR / "1-penten-3-one.xyz") xtb = XTB(elements, coordinates) ref_data = np.genfromtxt(DATA_DIR / "fukui.csv", delimiter=",", names=True) f_nuc = list(xtb.get_fukui(variety="nucleophilicity").values()) assert_array_almost_equal(f_nuc, ref_data["f_nuc"], decimal=3) f_elec = list(xtb.get_fukui(variety="electrophilicity").values()) assert_array_almost_equal(f_elec, ref_data["f_elec"], decimal=3) f_rad = list(xtb.get_fukui(variety="radical").values()) assert_array_almost_equal(f_rad, ref_data["f_rad"], decimal=3) f_dual = list(xtb.get_fukui(variety="dual").values()) assert_array_almost_equal(f_dual, ref_data["f_dual"], decimal=3) f_loc_nuc = list(xtb.get_fukui(variety="local_nucleophilicity").values()) assert_array_almost_equal(f_loc_nuc, ref_data["f_loc_nuc"], decimal=3) f_loc_elec = list(xtb.get_fukui(variety="local_electrophilicity").values()) assert_array_almost_equal(f_loc_elec, ref_data["f_loc_elec"], decimal=3)
def test_PdPMe3(): """Test PdPMe3.""" elements, coordinates = read_xyz(DATA_DIR / "pd/PdPMe3.xyz") ca = ConeAngle(elements, coordinates, 1, radii_type="bondi") assert_almost_equal(ca.cone_angle, 120.4, decimal=1)
def test_inverted_atoms(): """Test inverted bite angle by reference vector method.""" _, coordinates = read_xyz(DATA_DIR / "xyz" / "inverted.xyz") bite_angle = BiteAngle(coordinates, 11, 10, 14, ref_atoms=[6]) assert_almost_equal(bite_angle.angle, 187.33, decimal=2)
def test_one(): """Test one complex.""" _, coordinates = read_xyz(DATA_DIR / "xyz" / "cis-B01_XantPhos.xyz") bite_angle = BiteAngle(coordinates, 60, 1, 37) assert_almost_equal(bite_angle.angle, 101.91, decimal=2)