Skip to content

Commit f5feb9c

Browse files
HuangJiamengZLI-afk
authored andcommitted
update: add a new option of absolute volume in /dpgen/dpgen/auto_test/EOS.py (deepmodeling#741)
* update: add a new option of absolute volume in ./dpgen/auto_test/EOS.py * update: add doc in /dpgen/doc/toymodels/ * update: change the description for eos, change the doc in /dpgen/doc/toymodels/ * update: change the notice of absolute volume from print into dlog.info
1 parent a0c7333 commit f5feb9c

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

doc/toymodels/JiamengHuang_pr.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
A new parameter "vol_abs" is added. If you want to use absolute volume to get EOS, you can add
2+
3+
"vol_abs": true,
4+
5+
in the "eos" part of property.json
6+
if it's not mentioned, "False" is set defaultly
7+
when you are using absolute volume, there will be a notation in the last line of output during "make" process, which is like
8+
9+
treat vol_start and vol_end as absolute volume

dpgen/auto_test/EOS.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ def __init__(self,
2424
self.vol_start = parameter['vol_start']
2525
self.vol_end = parameter['vol_end']
2626
self.vol_step = parameter['vol_step']
27+
parameter['vol_abs'] = parameter.get('vol_abs', False)
28+
self.vol_abs = parameter['vol_abs']
2729
parameter['cal_type'] = parameter.get('cal_type', 'relaxation')
2830
self.cal_type = parameter['cal_type']
2931
default_cal_setting = {"relax_pos": True,
@@ -117,6 +119,10 @@ def make_confs(self,
117119

118120
else:
119121
print('gen eos from ' + str(self.vol_start) + ' to ' + str(self.vol_end) + ' by every ' + str(self.vol_step))
122+
if self.vol_abs :
123+
dlog.info('treat vol_start and vol_end as absolute volume')
124+
else :
125+
dlog.info('treat vol_start and vol_end as relative volume')
120126
equi_contcar = os.path.join(path_to_equi, 'CONTCAR')
121127
if not os.path.exists(equi_contcar):
122128
raise RuntimeError("please do relaxation first")
@@ -138,8 +144,13 @@ def make_confs(self,
138144
task_list.append(output_task)
139145
os.symlink(os.path.relpath(equi_contcar), 'POSCAR.orig')
140146
# scale = (vol / vol_to_poscar) ** (1. / 3.)
141-
scale = vol ** (1. / 3.)
142-
eos_params = {'volume': vol * vol_to_poscar, 'scale': scale}
147+
148+
if self.vol_abs :
149+
scale = (vol / vol_to_poscar) ** (1. / 3.)
150+
eos_params = {'volume': vol, 'scale': scale}
151+
else :
152+
scale = vol ** (1. / 3.)
153+
eos_params = {'volume': vol * vol_to_poscar, 'scale': scale}
143154
dumpfn(eos_params, 'eos.json', indent=4)
144155
self.parameter['scale2equi'].append(scale) # 06/22
145156
vasp.poscar_scale('POSCAR.orig', 'POSCAR', scale)

0 commit comments

Comments
 (0)