Révision 4e82c425 modules/formats.py

b/modules/formats.py
1
"""Module for the interconversion between different kinds of atomic data.
1
"""Module for the conversion between different kinds of atomic data.
2 2

  
3 3
functions:
4 4
confs_to_mol_list: Converts the conformers inside a rdkit.Mol object to a list
......
9 9
adapt_format: Converts the coordinate files into a required library object type.
10 10
read_coords_cp2k: Reads the coordinates from a CP2K restart file and returns an
11 11
    ase.Atoms object.
12
collect_coords: Directs the reading of coordinates on a set of subdirectories.
12
read_coords_vasp: Reads the coordinates from VASP OUTCAR file and returns an
13
    ase.Atoms object.
13 14
read_energy_cp2k: Reads the CP2K out file and returns its final energy.
14
collect_energies: Directs the reading of energies on a set of subdirectories.
15
collect_confs: Reads the coordinates and energies of a list of finished
16
    calculations.
15 17
"""
16 18

  
17 19
import logging
......
89 91
    Depending on the library required to use and the file type, it converts the
90 92
    coordinate file into a library-workable object.
91 93
    @param requirement: str, the library for which the conversion should be
92
    made. Accepted values: 'ase', 'rdkit'.
94
        made. Accepted values: 'ase', 'rdkit'.
93 95
    @param coord_file: str, path to the coordinates file aiming to convert.
94
    Accepted file tyoes: 'xyz', 'mol'.
96
        Accepted file formats: all file formats readable by ase.
95 97
    @param spec_atms: List of tuples containing pairs of new/traditional
96 98
        chemical symbols.
97 99
    @return: an object the required library can work with.
......
234 236
                                        spec_atms)
235 237
            # Assign energy
236 238
            for fil in os.listdir(conf_path):
237
                if is_binary(conf_path+fil):
239
                if is_binary(conf_path + fil):
238 240
                    continue
239
                conf_energy = read_energy_cp2k(conf_path+fil)
241
                conf_energy = read_energy_cp2k(conf_path + fil)
240 242
                if conf_energy is not None:
241 243
                    ase_atms.info["energy"] = conf_energy
242 244
                    break
......
252 254
            logger.error(err_msg)
253 255
            raise NotImplementedError(err_msg)
254 256
    return atoms_list
255

  

Formats disponibles : Unified diff