def test_load_xyz_scenarios(xyz_path): path = os.path.join(xyz_path, '1_opt.xyz') m = Molecule(path, 'xyz') # 1 : xyz exist and optimizer is none assert m.to_xyz() # 2 xyz doesn't exist and pybel exist and optimizer is none m._xyz = None m.to_xyz() assert m.xyz.geometry.shape == (28, 3) # 3 xyz doesn't exist and pybel exist and optimizer is UFF m._xyz = None m.to_xyz(optimizer='UFF', maxIters=10210) assert m.xyz.geometry.shape == (28, 3)
def mols(): # Oxygen, Hydrogen, Hydrogen num = np.array([8, 1, 1]) num = num.reshape((3, 1)) sym = np.array(['O', 'H', 'H']) sym = sym.reshape((3, 1)) c = np.array([[1.464, 0.707, 1.056], [0.878, 1.218, 0.498], [2.319, 1.126, 0.952]]) xyz = XYZ(c,num,sym) m = Molecule('O', 'smiles') # forcefully overwrite xyz m._xyz = xyz return m