-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdtt.template
80 lines (61 loc) · 3.05 KB
/
pdtt.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# -*- coding: utf-8 -*-
#!/usr/bin/python
import os, sys
from optparse import OptionParser
#from KPFM_sim.kpfm_sim_tasks import Descend_tip_task
#from KPFM_sim.kpfm_sim_task_db import Task_control_db
#from KPFM_sim.kpfm_sim_result_db import Result_db
from kpfm_sim_tasks import Descend_tip_task, prepare_db_for_task
from kpfm_sim_task_db import Task_control_db
from kpfm_sim_result_db import Result_db
# set this part :
x = -0.1243 + AAA * 1.2495 ; # (B0-B7)/7/2
y = -3.1602 + BBB * 0.7409 ; # (B0-N0)
s = 23.3277
V = 0.0
s_start = 22.076 ## >>> -0.0786-0.0457 = -0.1243 >>> 15.7430-18.9032 = 3.1602 >>> ss_r = 20.5662-13.4145 = 7.1517 >>> ss_v = 23.3277 >>> 2.8+3.1 = 5.9 >>> ss_v-(ss_r-5.9) = 22.076 >>> ss_v-(ss_r-2.8) = 18.976 ##
s_end = 18.976 # tip-apex height is ~ 2.8 and we want to go up to 3.1 -> 2.8+3.1
s_step = 0.1
debug=True
# don't touch the ater part, unless you know what you are doing
#parser = argparse.ArgumentParser(description='plan the task for either tip-descending (AFM) or KPFM')
parser = OptionParser()
parser.add_option('-f', '--files', action ="store", type="string", nargs=3,
help='3 files expected <taks_db_file> <result_db_file> <global_res_db_file>')
parser.add_option('-k', '--kpts', action='store_true', default = False,
help="if k-points are necesssary for the CP2K calc")
parser.add_option('-n', '--no_wfn', action='store_false', default = True,
help="do not store the wfn or kp file for late recalculations")
(options,args) = parser.parse_args()
if debug:
print("options:",options)
print("args:",args)
#print("options.files",len(options.files))
print("options.kpts",options.kpts)
if options.files == None:
sys.exit("3 *.db files are expected \n usage: python plan_descend_tip_task.py (optionally -k or --kpts if k-points are necessary; --no_wfn if storage of wfn is not necessary) <task_db_file> <result_db_file> <global_res_db_file>")
task_db_file = options.files[0]
result_db_file = options.files[1]
global_res_db_file = options.files[2]
if debug:
print("task_df_file",task_db_file)
print("result_df_file",result_db_file)
print("global_res_df_file",global_res_db_file)
#print('just a debugging at the moment moving out')
#sys.exit()
#nd = 6# number of digits for rounding -- not needed rounding of x, y, s, V, s_... is in : kpfm_sim_tasks.py
# not working - detach for whatever reason
#if not os.path.isfile(result_db_file):
# local_results = Result_db(result_db_file)
# with local_results:
# local_results.copy_atoms_data(global_res_db_file)
prepare_db_for_task(global_res_db_file, result_db_file, task_db_file)
"""
class Descend_tip_task(Abstract_task):
def __init__(self, x, y, s, V, s_start, s_end, s_step, result_db_file,
global_res_db_file, state = global_const.state_planned, slurm_id = None):
"""
new_task = Descend_tip_task(x, y, s, V, s_start, s_end, s_step, result_db_file, global_res_db_file, kpts=options.kpts, wfn=options.no_wfn)
task_db = Task_control_db(task_db_file)
with task_db:
task_db.write_task(new_task)