Révision 439ce5f7 modules/formats.py

b/modules/formats.py
54 54
    Accepted file tyoes: 'xyz', 'mol'.
55 55
    @return: an object the required library can work with.
56 56
    """
57
    import ase.io
57 58
    from ase.io.formats import filetype
58 59

  
59 60
    req_vals = ['rdkit', 'ase']
......
74 75

  
75 76
    if requirement == 'rdkit':
76 77
        if filetype(coord_file) == 'xyz':
77
            from xyz2mol import read_xyz_file, xyz2mol
78
            atoms, charge, xyz_coordinates = read_xyz_file(coord_file)
79
            rd_mol_obj = xyz2mol(atoms, xyz_coordinates, charge=charge)
78
            from xyz2mol import xyz2mol
79
            ase_atms = ase.io.read(coord_file)
80
            atomic_nums = ase_atms.get_atomic_numbers().tolist()
81
            xyz_coordinates = ase_atms.positions.tolist()
82
            rd_mol_obj = xyz2mol(atomic_nums, xyz_coordinates, charge=0)  # TODO Charge
80 83
            logger.debug(conv_info)
81 84
            return rd_mol_obj
82 85
        elif filetype(coord_file) == 'mol':
......
85 88
            return MolFromMolFile(coord_file, removeHs=False)
86 89

  
87 90
    if requirement == 'ase':
88
        import ase.io
89 91
        logger.debug(conv_info)
90 92
        return ase.io.read(coord_file)

Formats disponibles : Unified diff