Skip to content

Commit

Permalink
update vasp
Browse files Browse the repository at this point in the history
  • Loading branch information
srmnitc committed Oct 21, 2024
1 parent 10de082 commit 32a1bd0
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 45 deletions.
77 changes: 45 additions & 32 deletions atomrdf/workflow/pyiron/vasp.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,50 @@ def identify_method(job, method_dict):
method_dict['method'] = method
method_dict['dof'] = dof

encut = mdict['ENCUT']
method_dict['encut'] = encut

inputs = []
inputs.append(
{
"label": "EnergyCutoff",
"value": encut,
"unit": "EV",
}
)

indf = job.input.to_dict()['kpoints/data_dict']
params = indf['Parameter']
vals = indf['Value']

kpoint_type = vals[2]
kpoint_grid = vals[3]
method_dict['kpoint_type'] = kpoint_type
method_dict['kpoint_grid'] = kpoint_grid

if kpoint_type == 'Monkhorst-pack':
inputs.append(
{
"label": "MonkhorstPackKPointMesh",
"value": kpoint_grid,
}
)
elif kpoint_type == 'Gamma':
inputs.append(
{
"label": "GammaCenteredKPointMesh",
"value": kpoint_grid,
}
)
elif kpoint_type in ['Reciprocal', 'Cartesian']:
inputs.append(
{
"label": "ExplicitKPointMesh",
"value": kpoint_grid,
}
)
else:
inputs.append(
{
"label": "KPointMesh",
"value": kpoint_grid,
}
)

indf = job.input.to_dict()['potcar/data_dict']
xc = indf['Value'][0]
Expand Down Expand Up @@ -153,39 +186,19 @@ def extract_calculated_quantities(job, method_dict):
)
outputs.append(
{
"label": "TotalVolume",
"value": np.round(job.output.volume[-1], decimals=5),
"unit": "ANGSTROM3",
"associate_to_sample": True,
}
)
structure = job.get_structure(frame=-1)
lx = np.linalg.norm(structure.cell[0])
ly = np.linalg.norm(structure.cell[1])
lz = np.linalg.norm(structure.cell[2])

outputs.append(
{
"label": "SimulationCellLength_x",
"value": np.round(lx, decimals=4),
"unit": "ANGSTROM",
"label": "PotentialEnergy",
"value": np.round(job.output.energy_pot[-1], decimals=5),
"unit": "EV",
"associate_to_sample": True,
}
)
outputs.append(
{
"label": "SimulationCellLength_y",
"value": np.round(ly, decimals=4),
"unit": "ANGSTROM",
"label": "Volume",
"value": np.round(job.output.volume[-1], decimals=5),
"unit": "ANGSTROM3",
"associate_to_sample": True,
}
)
outputs.append(
{
"label": "SimulationCellLength_z",
"value": np.round(lz, decimals=4),
"unit": "ANGSTROM",
"associate_to_sample": True,
}
)

method_dict['outputs'] = outputs
46 changes: 33 additions & 13 deletions examples/workflow_examples/02_vasp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "fe747ff19deb48f78e4a3641d148c6c1",
"model_id": "7d2179bc22d84ea8a30013374dbdad2c",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -43,7 +43,7 @@
"metadata": {},
"outputs": [],
"source": [
"pr = Project('wfy1')"
"pr = Project('wfy1e')"
]
},
{
Expand All @@ -63,7 +63,7 @@
"output_type": "stream",
"text": [
"fccSi fccSi\n",
"job was stored with the job ID 468\n"
"job was stored with the job ID 1199\n"
]
}
],
Expand Down Expand Up @@ -117,14 +117,14 @@
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>468</td>\n",
" <td>1199</td>\n",
" <td>finished</td>\n",
" <td>Si</td>\n",
" <td>fccSi</td>\n",
" <td>/fccSi</td>\n",
" <td>None</td>\n",
" <td>/mnt/c/Users/menon/Documents/repos/projects-iuc17/atomRDF/examples/workflow_examples/wfy1/</td>\n",
" <td>2024-05-08 16:32:24.518895</td>\n",
" <td>/mnt/c/Users/menon/Documents/repos/projects-iuc17/atomRDF/examples/workflow_examples/wfy1e/</td>\n",
" <td>2024-10-21 11:32:41.253871</td>\n",
" <td>None</td>\n",
" <td>None</td>\n",
" <td>pyiron@cmleo26#1</td>\n",
Expand All @@ -138,14 +138,14 @@
"</div>"
],
"text/plain": [
" id status chemicalformula job subjob projectpath \\\n",
"0 468 finished Si fccSi /fccSi None \n",
" id status chemicalformula job subjob projectpath \\\n",
"0 1199 finished Si fccSi /fccSi None \n",
"\n",
" project \\\n",
"0 /mnt/c/Users/menon/Documents/repos/projects-iuc17/atomRDF/examples/workflow_examples/wfy1/ \n",
" project \\\n",
"0 /mnt/c/Users/menon/Documents/repos/projects-iuc17/atomRDF/examples/workflow_examples/wfy1e/ \n",
"\n",
" timestart timestop totalcputime computer hamilton \\\n",
"0 2024-05-08 16:32:24.518895 None None pyiron@cmleo26#1 Vasp \n",
"0 2024-10-21 11:32:41.253871 None None pyiron@cmleo26#1 Vasp \n",
"\n",
" hamversion parentid masterid \n",
"0 None None None "
Expand All @@ -162,13 +162,33 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"job = pr.load('fccSi')"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(array([-4.87738472]), array([-4.87738472]))"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"job.output.energy_tot, job.output.energy_pot"
]
},
{
"cell_type": "code",
"execution_count": 6,
Expand Down Expand Up @@ -683,7 +703,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.1.-1"
"version": "3.11.10"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 32a1bd0

Please sign in to comment.