Révision 2dfa562f
b/modules/calculation.py | ||
---|---|---|
10 | 10 |
""" |
11 | 11 |
new_name = file_name |
12 | 12 |
bak_num = 0 |
13 |
while new_name in os.listdir("."):
|
|
13 |
while os.path.isdir(new_name) or os.path.isfile(new_name):
|
|
14 | 14 |
bak_num += 1 |
15 | 15 |
new_name = new_name.split(".bak")[0] + f".bak{bak_num}" |
16 | 16 |
if bak_num > 0: |
... | ... | |
35 | 35 |
cp2k.parse(inp_file) |
36 | 36 |
force_eval = cp2k.CP2K_INPUT.FORCE_EVAL_list[0] |
37 | 37 |
if force_eval.SUBSYS.TOPOLOGY.Coord_file_name is None: |
38 |
logger.warning("'COORD_FILE_NAME' not specified on CP2K input. Using "
|
|
39 |
"default name 'coord.xyz', a new CP2K input file with "
|
|
40 |
"the 'COORD_FILE_NAME' variable is created and older "
|
|
41 |
"file is backed up with the following name:")
|
|
38 |
logger.warning("'COORD_FILE_NAME' not specified on CP2K input. Using\n"
|
|
39 |
"default name 'coord.xyz'. A new CP2K input file with "
|
|
40 |
"the 'COORD_FILE_NAME' variable is created. If there\n"
|
|
41 |
"is a name conflict the old file will be backed up")
|
|
42 | 42 |
force_eval.SUBSYS.TOPOLOGY.Coord_file_name = 'coord.xyz' |
43 |
check_bak(inp_file) |
|
44 |
cp2k.write_input_file(inp_file) |
|
43 |
print(inp_file.split('/')[-1]) |
|
44 |
check_bak(inp_file.split('/')[-1]) |
|
45 |
cp2k.write_input_file(inp_file.split('/')[-1]) |
|
45 | 46 |
|
46 | 47 |
coord_file = force_eval.SUBSYS.TOPOLOGY.Coord_file_name |
47 | 48 |
|
Formats disponibles : Unified diff