-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ase pwdft calculator file to pynta
- Loading branch information
Showing
11 changed files
with
1,002 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# PWDFT + ASE | ||
|
||
## About | ||
|
||
This module defines an ASE interface to PWDFT. | ||
PWDFT is a code of electronic structure that uses | ||
plane waves and pseudopotentials. | ||
|
||
PWDFT is available here: <https://github.com/ebylaska/PWDFT> | ||
|
||
## Acknowledgements | ||
This research used resources of the Argonne Leadership Computing Facility, which is a DOE Office of Science User Facility supported under Contract DE-AC02-06CH11357. Argonne National Laboratory’s work was supported by the U.S. Department of Energy, Office of Science, under contract DE-AC02-06CH11357. | ||
|
||
|
||
All rights reserved. Copyright Argonne National Laboratory UChicago LLC. Raymundo Hernandez-Esparza |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .pwdftio import * | ||
|
||
__all__ = ['PWDFT'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "876244c1", | ||
"metadata": {}, | ||
"source": [ | ||
"# Example of use PWDFT as a calculator" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"id": "5a2e405d", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from ase import Atoms\n", | ||
"from ase.visualize import view\n", | ||
"from ase.build import bulk\n", | ||
"from ase.io import write, Trajectory\n", | ||
"from ase.cell import *\n", | ||
"\n", | ||
"import sys\n", | ||
"import os\n", | ||
"import numpy as np\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"import ase\n", | ||
"sys.path.append(\"/home/rayhe/Github/utils_esp/ase_pwdft\")\n", | ||
"from pwdft import PWDFT" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "bf9b2a77", | ||
"metadata": {}, | ||
"source": [ | ||
"the line 'mpiexec -n 1 /home/rayhe/Github/PWDFT/build_new3/pwdft' indicates where binary is located, also I can increase the numper of mpiranks with -n $num" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"id": "11a7218f", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"Cu_pos = [[0.0, 0.0, 0.0],\n", | ||
" [0.0, 1, 1],\n", | ||
" [1, 0.0, 1],\n", | ||
" [1, 1, 0.0]]\n", | ||
"Cu_cell = [\n", | ||
" [2.0, 0.0, 0.0],\n", | ||
" [0.0, 2.0, 0.0],\n", | ||
" [0.0, 0.0, 2.0]]\n", | ||
"\n", | ||
"command = 'mpiexec -n 1 /home/rayhe/Github/PWDFT/build_new3/pwdft < PREFIX.nwxi > PREFIX.nwxo'\n", | ||
"cu = Atoms(\"Cu4\", \n", | ||
" positions=Cu_pos, \n", | ||
" cell=Cu_cell, pbc=(1,1,1),\n", | ||
" calculator=PWDFT(command=command,label='Cu',echo=True,charge=0\n", | ||
" ,nwpw={'cutoff':60, 'xc':'PBE', 'loop':'10 250'}\n", | ||
" )\n", | ||
" )" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"id": "c146b0cd", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"array([[-0.00011824, -0.00317398, -0.00014334],\n", | ||
" [-0.00059534, 0.00418138, -0.00011066],\n", | ||
" [-0.00026893, -0.00893213, 0.0002258 ],\n", | ||
" [ 0.00088577, 0.00788889, 0.00026748]])" | ||
] | ||
}, | ||
"execution_count": 7, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"cu.get_forces()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"id": "265e527f", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"-5391.361579138844" | ||
] | ||
}, | ||
"execution_count": 8, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"cu.get_potential_energy()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "eabda654", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.16" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "d55588a8", | ||
"metadata": {}, | ||
"source": [ | ||
"# Example of Optimization + Freq using PWDFT as a calculator" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "4150d3de", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from ase import Atoms\n", | ||
"from ase.visualize import view\n", | ||
"from ase.build import bulk\n", | ||
"from ase.io import write, Trajectory\n", | ||
"from ase.vibrations import Vibrations\n", | ||
"from ase.cell import *\n", | ||
"\n", | ||
"import sys\n", | ||
"import os\n", | ||
"import numpy as np\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"import ase\n", | ||
"sys.path.append(\"/home/rayhe/Github/utils_esp/ase_pwdft\")\n", | ||
"from pwdft import PWDFT\n", | ||
"from ase.optimize import BFGS \n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "c1e40963", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"command = 'mpiexec -n 4 /home/rayhe/Github/PWDFT/build_new3/pwdft < PREFIX.nwxi > PREFIX.nwxo'" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "20bcb8ba", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"water = Atoms(\"HOH\", positions=[[0,0,-1],[0,1,0],[0,0,1]],\n", | ||
" cell=[[10,0,0],[0,10,0],[0,0,10]], pbc=(1,1,1),\n", | ||
" calculator=PWDFT(command=command, label=\"Water\", echo=True, charge=0,\n", | ||
" nwpw={\"cutoff\":60, \"xc\":\"PBE\", 'loog':'10 250'}\n", | ||
" )\n", | ||
" )" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "4669535c", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"opt1 = BFGS(water, trajectory=\"pwdft.opt.traj\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"id": "f8ba8b14", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
" Step Time Energy fmax\n", | ||
"BFGS: 0 14:21:08 -464.084453 7.9911\n", | ||
"BFGS: 1 14:21:52 -465.870441 7.2755\n", | ||
"BFGS: 2 14:22:45 -468.142577 1.9503\n", | ||
"BFGS: 3 14:23:22 -468.142592 2.8405\n", | ||
"BFGS: 4 14:23:52 -468.229799 0.7549\n", | ||
"BFGS: 5 14:24:16 -468.249741 0.6259\n", | ||
"BFGS: 6 14:24:48 -468.277005 0.1669\n", | ||
"BFGS: 7 14:25:04 -468.277253 0.0204\n", | ||
"BFGS: 8 14:25:12 -468.277259 0.0088\n" | ||
] | ||
}, | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"True" | ||
] | ||
}, | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"opt1.run(fmax=0.01)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"id": "342c319a", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"vib = Vibrations(water)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"id": "b3603d9c", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"vib.run()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"id": "a887419e", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"---------------------\n", | ||
" # meV cm^-1\n", | ||
"---------------------\n", | ||
" 0 18.5i 149.2i\n", | ||
" 1 3.5i 28.5i\n", | ||
" 2 16.3 131.3\n", | ||
" 3 24.4 196.7\n", | ||
" 4 27.9 224.9\n", | ||
" 5 34.8 280.3\n", | ||
" 6 202.5 1633.2\n", | ||
" 7 446.4 3600.7\n", | ||
" 8 459.2 3703.9\n", | ||
"---------------------\n", | ||
"Zero-point energy: 0.606 eV\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"vib.summary()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 9, | ||
"id": "14224a25", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"vib.write_mode(-1)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.13" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.