-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from deepmodeling/devel
Merge new features to master
- Loading branch information
Showing
54 changed files
with
3,454 additions
and
59 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 |
---|---|---|
|
@@ -19,3 +19,4 @@ build | |
dist | ||
dpdata.egg-info | ||
_version.py | ||
!tests/cp2k/aimd/cp2k.log |
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
Empty file.
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,61 @@ | ||
|
||
#%% | ||
import numpy as np | ||
from collections import OrderedDict | ||
import re | ||
|
||
def cell_to_low_triangle(A,B,C,alpha,beta,gamma): | ||
""" | ||
Convert cell to low triangle matrix. | ||
Parameters | ||
---------- | ||
A : float | ||
cell length A | ||
B : float | ||
cell length B | ||
C : float | ||
cell length C | ||
alpha : float | ||
radian. The angle between vector B and vector C. | ||
beta : float | ||
radian. The angle between vector A and vector C. | ||
gamma : float | ||
radian. The angle between vector B and vector C. | ||
Returns | ||
------- | ||
cell : list | ||
The cell matrix used by dpdata in low triangle form. | ||
""" | ||
if not np.pi*5/180<alpha< np.pi*175/180: | ||
raise RuntimeError("alpha=={}: must be a radian, and \ | ||
must be in np.pi*5/180 < alpha < np.pi*175/180".format(alpha)) | ||
if not np.pi*5/180<beta< np.pi*175/180: | ||
raise RuntimeError("beta=={}: must be a radian, and \ | ||
must be in np.pi*5/180 < beta < np.pi*175/180".format(beta)) | ||
if not np.pi*5/180<gamma< np.pi*175/180: | ||
raise RuntimeError("gamma=={}: must be a radian, and \ | ||
must be in np.pi*5/180 < gamma < np.pi*175/180".format(gamma)) | ||
if not A > 0.2: | ||
raise RuntimeError("A=={}, must be greater than 0.2".format(A)) | ||
if not B > 0.2: | ||
raise RuntimeError("B=={}, must be greater than 0.2".format(B)) | ||
if not C > 0.2: | ||
raise RuntimeError("C=={}, must be greater than 0.2".format(C)) | ||
|
||
lx = A | ||
xy = B * np.cos(gamma) | ||
xz = C * np.cos(beta) | ||
ly = B* np.sin(gamma) | ||
if not ly > 0.1: | ||
raise RuntimeError("ly:=B* np.sin(gamma)=={}, must be greater than 0.1",format(ly)) | ||
yz = (B*C*np.cos(alpha)-xy*xz)/ly | ||
if not C**2-xz**2-yz**2 > 0.01: | ||
raise RuntimeError("lz^2:=C**2-xz**2-yz**2=={}, must be greater than 0.01",format(C**2-xz**2-yz**2)) | ||
lz = np.sqrt(C**2-xz**2-yz**2) | ||
cell = np.asarray([[lx, 0 , 0], | ||
[xy, ly, 0 ], | ||
[xz, yz, lz]]).astype('float32') | ||
return cell | ||
|
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
Empty file.
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
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
Empty file.
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
Empty file.
Empty file.
Oops, something went wrong.