Révision c6e71e46
b/modules/formats.py | ||
---|---|---|
151 | 151 |
@return: list of collection-of-atoms objects. (rdkit.Mol, ase.Atoms, etc.) |
152 | 152 |
""" |
153 | 153 |
import os |
154 |
# Relate file-name patterns to codes |
|
154 | 155 |
if code == 'cp2k': |
155 | 156 |
pattern = '-pos-1.xyz' |
156 | 157 |
else: |
157 | 158 |
pattern = '' |
158 |
return [adapt_format(req, f'{run_type}/{conf}/{fil}', spec_atms) |
|
159 |
for conf in os.listdir(run_type) |
|
160 |
for fil in os.listdir(f"{run_type}/{conf}") if pattern in fil] |
|
159 |
|
|
160 |
# Read appropriate files and transform them to adequate object |
|
161 |
atoms_list = [] |
|
162 |
for conf in os.listdir(run_type): |
|
163 |
if not os.path.isdir(f'{run_type}/{conf}') or 'conf_' not in conf: |
|
164 |
continue |
|
165 |
for fil in os.listdir(f"{run_type}/{conf}"): |
|
166 |
if pattern not in fil: |
|
167 |
continue |
|
168 |
atoms_list.append(adapt_format(req, f'{run_type}/{conf}/{fil}', |
|
169 |
spec_atms)) |
|
170 |
return atoms_list |
|
161 | 171 |
|
162 | 172 |
|
163 | 173 |
def read_energies(code, run_type): |
Formats disponibles : Unified diff