From 28c961c8511ebfb39cb4062b6d0948303fd78b14 Mon Sep 17 00:00:00 2001 From: tao Date: Fri, 3 Mar 2017 18:42:39 -0800 Subject: [PATCH] align --- lib/align.py | 39 +++++ lib/tt | 297 --------------------------------------- tools/vasp/get_potcar.py | 2 +- 3 files changed, 40 insertions(+), 298 deletions(-) create mode 100644 lib/align.py delete mode 100644 lib/tt diff --git a/lib/align.py b/lib/align.py new file mode 100644 index 0000000..386870c --- /dev/null +++ b/lib/align.py @@ -0,0 +1,39 @@ +""" +Calculated Rotation Matrix to align Vector A to Vector B in 3d using +Rodrigues' rotation formula. + +octave code: +v1 = [1 1 1]'; +v2 = [0 0 1]'; +w = cross(v1,v2); +w = w/norm(w); +w_hat = [0,-w(3),w(2);w(3),0,-w(1);-w(2),w(1),0]; +cos_tht = v1'*v2/norm(v1)/norm(v2); +tht = acos(cos_tht); +R = eye(size(v1,1)) + w_hat*sin(tht) + w_hat^2*(1-cos(tht)); +t1 = R*v1; +t1 = t1/norm(t1)*norm(v2); + +""" +import math +import numpy as np + +def align_axis(v1, v2): + w = np.cross(v1,v2) + w = w/np.linalg.norm(w) + w_hat = np.matrix([[ 0, -w[2], w[1]], + [ w[2], 0, -w[0]], + [-w[1], w[0], 0]]) + cos_tht = np.dot(v1, v2)/np.linalg.norm(v1)/np.linalg.norm(v2) + tht = np.arccos(cos_tht) + R = np.identity(3) + w_hat*np.sin(tht) + w_hat*w_hat*(1-np.cos(tht)) + return R + +def test(): + v1 = np.array([1.0, 1.0, 1.0]) + v2 = np.array([0.0, 0.0, 1.0]) + R = align_axis(v1, v2) + print R + +if __name__ == "__main__": + test() diff --git a/lib/tt b/lib/tt deleted file mode 100644 index 3f5fbac..0000000 --- a/lib/tt +++ /dev/null @@ -1,297 +0,0 @@ - Search for a local minimum. - Step number 20 out of a maximum of 20 on scan point 30 out of 31 - All quantities printed in internal units (Hartrees-Bohrs-Radians) - Update second derivatives using D2CorN and points 20 - Trust test= 2.08D+00 RLast= 4.77D-02 DXMaxT set to 1.77D-01 - The second derivative matrix: - r3 r4 - r3 0.00019 - r4 0.01568 0.00541 - Eigenvalues --- 0.000191000.00000 - RFO step: Lambda=-5.14571317D-07. - Skip linear search -- no minimum in search direction. - Variable Old X -DE/DX Delta X Delta X Delta X New X - (Linear) (Quad) (Total) - r3 7.35739 0.00001 0.00000 0.05181 0.05181 7.40920 - r4 1.11769 0.18273 0.00000 0.00000 0.00000 1.11769 - Item Value Threshold Converged? - Maximum Force 0.000010 0.000450 YES - RMS Force 0.000010 0.000300 YES - Maximum Displacement 0.051811 0.001800 NO - RMS Displacement 0.036636 0.001200 NO - Predicted change in Energy=-2.572838D-07 - Optimization stopped. - -- Number of steps exceeded, NStep= 20 - -- Flag reset to prevent archiving. - ---------------------------- - ! Non-Optimized Parameters ! - ! (Angstroms and Degrees) ! - ---------------------- ---------------------- - ! Name Value Derivative information (Atomic Units) ! - ------------------------------------------------------------------------ - ! r3 3.9208 -DE/DX = 0.0 ! - ! r4 0.5915 -DE/DX = 0.1827 ! - ------------------------------------------------------------------------ - GradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGrad - - Leave Link 103 at Wed Jun 5 02:22:48 2013, MaxMem= 6291456 cpu: 0.0 - (Enter /state/partition1/apps/g03sun/l202.exe) - ------------------------------------------------------------------------ - Z-MATRIX (ANGSTROMS AND DEGREES) - CD Cent Atom N1 Length/X N2 Alpha/Y N3 Beta/Z J - ------------------------------------------------------------------------ - 1 1 H - 2 X 1 1.000000( 1) - 3 2 H 1 3.920780( 2) 2 90.000( 4) - 4 3 H 1 0.491454( 3) 2 90.000( 5) 3 180.000( 6) 0 - ------------------------------------------------------------------------ - Z-Matrix orientation: - --------------------------------------------------------------------- - Center Atomic Atomic Coordinates (Angstroms) - Number Number Type X Y Z - --------------------------------------------------------------------- - 1 1 0 0.000000 0.000000 0.000000 - 2 -1 0 0.000000 0.000000 1.000000 - 3 1 0 3.920780 0.000000 0.000000 - 4 1 0 -0.491454 0.000000 0.000000 - --------------------------------------------------------------------- - Distance matrix (angstroms): - 1 2 3 4 - 1 H 0.000000 - 2 X 1.000000 0.000000 - 3 H 3.920780 4.046296 0.000000 - 4 H 0.491454 1.114238 4.412234 0.000000 - Interatomic angles: - X2-H1-H3= 90. X2-H1-H4= 90. H3-H1-H4=180. - Stoichiometry H3(2) - Framework group C*V[C*(HHH)] - Deg. of freedom 2 - Full point group C*V - Largest Abelian subgroup C2V NOp 4 - Largest concise Abelian subgroup C1 NOp 1 - Standard orientation: - --------------------------------------------------------------------- - Center Atomic Atomic Coordinates (Angstroms) - Number Number Type X Y Z - --------------------------------------------------------------------- - 1 1 0 0.000000 0.000000 -1.143109 - 2 1 0 0.000000 0.000000 2.777671 - 3 1 0 0.000000 0.000000 -1.634563 - --------------------------------------------------------------------- - Rotational constants (GHZ): 0.0000000 42.8815890 42.8815890 - Leave Link 202 at Wed Jun 5 02:22:48 2013, MaxMem= 6291456 cpu: 0.0 - (Enter /state/partition1/apps/g03sun/l301.exe) - Standard basis: 6-311G(d,p) (5D, 7F) - There are 12 symmetry adapted basis functions of A1 symmetry. - There are 0 symmetry adapted basis functions of A2 symmetry. - There are 3 symmetry adapted basis functions of B1 symmetry. - There are 3 symmetry adapted basis functions of B2 symmetry. - Integral buffers will be 131072 words long. - Raffenetti 2 integral format. - Two-electron integral symmetry is turned on. - 18 basis functions, 24 primitive gaussians, 18 cartesian basis functions - 2 alpha electrons 1 beta electrons - nuclear repulsion energy 1.3316597978 Hartrees. - IExCor= 402 DFT=T Ex=B+HF Corr=LYP ExCW=0 ScaHFX= 0.200000 - ScaDFX= 0.800000 0.720000 1.000000 0.810000 - IRadAn= 0 IRanWt= -1 IRanGd= 0 ICorTp=0 - NAtoms= 3 NActive= 3 NUniq= 3 SFac= 7.50D-01 NAtFMM= 80 NAOKFM=F Big=F - Leave Link 301 at Wed Jun 5 02:22:48 2013, MaxMem= 6291456 cpu: 0.0 - (Enter /state/partition1/apps/g03sun/l302.exe) - NPDir=0 NMtPBC= 1 NCelOv= 1 NCel= 1 NClECP= 1 NCelD= 1 - NCelK= 1 NCelE2= 1 NClLst= 1 CellRange= 0.0. - One-electron integrals computed using PRISM. - NBasis= 18 RedAO= T NBF= 12 0 3 3 - NBsUse= 18 1.00D-06 NBFU= 12 0 3 3 - Precomputing XC quadrature grid using - IXCGrd= 2 IRadAn= 0 IRanWt= -1 IRanGd= 0. - NRdTot= 189 NPtTot= 24066 NUsed= 25402 NTot= 25434 - NSgBfM= 18 18 18 18. - Leave Link 302 at Wed Jun 5 02:22:48 2013, MaxMem= 6291456 cpu: 0.1 - (Enter /state/partition1/apps/g03sun/l303.exe) - DipDrv: MaxL=1. - Leave Link 303 at Wed Jun 5 02:22:48 2013, MaxMem= 6291456 cpu: 0.0 - (Enter /state/partition1/apps/g03sun/l401.exe) - Initial guess read from the read-write file: - Guess basis will be translated and rotated to current coordinates. - Initial guess orbital symmetries: - Alpha Orbitals: - Occupied (SG) (SG) - Virtual (SG) (SG) (SG) (SG) (PI) (PI) (PI) (PI) (SG) (SG) - (SG) (PI) (PI) (SG) (SG) (SG) - Beta Orbitals: - Occupied (SG) - Virtual (SG) (SG) (SG) (SG) (SG) (PI) (PI) (SG) (PI) (PI) - (SG) (SG) (PI) (PI) (SG) (SG) (SG) - The electronic state of the initial guess is 2-SG. - of initial guess= 0.7500 - Generating alternative initial guess. - Harris functional with IExCor= 402 diagonalized for initial guess. - ExpMin= 1.03D-01 ExpMax= 3.39D+01 ExpMxC= 3.39D+01 IAcc=1 IRadAn= 1 AccDes= 1.00D-06 - HarFok: IExCor= 402 AccDes= 1.00D-06 IRadAn= 1 IDoV=1 - ScaDFX= 1.000000 1.000000 1.000000 1.000000 - Harris En= -1.59345824174330 - Leave Link 401 at Wed Jun 5 02:22:48 2013, MaxMem= 6291456 cpu: 0.0 - (Enter /state/partition1/apps/g03sun/l502.exe) - UHF open shell SCF: - Requested convergence on RMS density matrix=1.00D-08 within 128 cycles. - Requested convergence on MAX density matrix=1.00D-06. - Requested convergence on energy=1.00D-06. - No special actions if energy rises. - Using DIIS extrapolation, IDIIS= 1040. - Integral symmetry usage will be decided dynamically. - 25401 words used for storage of precomputed grid. - Keep R1 and R2 integrals in memory in canonical form, NReq= 1731192. - IEnd= 44345 IEndB= 44345 NGot= 6291456 MDV= 6234788 - LenX= 6234788 - Symmetry not used in FoFDir. - MinBra= 0 MaxBra= 1 Meth= 1. - IRaf= 0 NMat= 1 IRICut= 1 DoRegI=T DoRafI=F ISym2E= 0 JSym2E=0. - Integral accuracy reduced to 1.0D-05 until final iterations. - - Cycle 1 Pass 0 IDiag 1: - E= -1.59952016450433 - DIIS: error= 1.90D-02 at cycle 1 NSaved= 1. - NSaved= 1 IEnMin= 1 EnMin= -1.59952016450433 IErMin= 1 ErrMin= 1.90D-02 - ErrMax= 1.90D-02 EMaxC= 1.00D-01 BMatC= 1.12D-02 BMatP= 1.12D-02 - IDIUse=3 WtCom= 8.10D-01 WtEn= 1.90D-01 - Coeff-Com: 0.100D+01 - Coeff-En: 0.100D+01 - Coeff: 0.100D+01 - Recover alternate guess density for next cycle. - RMSDP=6.29D-03 MaxDP=7.90D-02 OVMax= 0.00D+00 - - Cycle 2 Pass 0 IDiag 1: - E= -1.58671385808020 Delta-E= 0.012806306424 Rises=F Damp=F - Switch densities from cycles 1 and 2 for lowest energy. - DIIS: error= 4.50D-02 at cycle 2 NSaved= 2. - NSaved= 2 IEnMin= 1 EnMin= -1.59952016450433 IErMin= 1 ErrMin= 1.90D-02 - ErrMax= 4.50D-02 EMaxC= 1.00D+00 BMatC= 4.43D-02 BMatP= 1.12D-02 - IDIUse=1 WtCom= 1.00D+00 WtEn= 0.00D+00 - Coeff-Com: 0.671D+00 0.329D+00 - Coeff: 0.671D+00 0.329D+00 - Gap= 0.573 Goal= None Shift= 0.000 - Gap= 0.443 Goal= None Shift= 0.000 - RMSDP=1.34D-03 MaxDP=8.77D-03 DE= 1.28D-02 OVMax= 2.99D-02 - - Cycle 3 Pass 0 IDiag 1: - E= -1.60233369019368 Delta-E= -0.015619832113 Rises=F Damp=F - DIIS: error= 4.95D-04 at cycle 3 NSaved= 3. - NSaved= 3 IEnMin= 3 EnMin= -1.60233369019368 IErMin= 3 ErrMin= 4.95D-04 - ErrMax= 4.95D-04 EMaxC= 1.00D+00 BMatC= 7.42D-06 BMatP= 1.12D-02 - IDIUse=1 WtCom= 1.00D+00 WtEn= 0.00D+00 - Coeff-Com: -0.339D-01-0.477D-02 0.104D+01 - Coeff: -0.339D-01-0.477D-02 0.104D+01 - Gap= 0.421 Goal= None Shift= 0.000 - Gap= 0.451 Goal= None Shift= 0.000 - RMSDP=6.67D-05 MaxDP=9.60D-04 DE=-1.56D-02 OVMax= 6.16D-04 - - Cycle 4 Pass 0 IDiag 1: - E= -1.60233543453482 Delta-E= -0.000001744341 Rises=F Damp=F - DIIS: error= 2.43D-05 at cycle 4 NSaved= 4. - NSaved= 4 IEnMin= 4 EnMin= -1.60233543453482 IErMin= 4 ErrMin= 2.43D-05 - ErrMax= 2.43D-05 EMaxC= 1.00D+00 BMatC= 6.63D-09 BMatP= 7.42D-06 - IDIUse=1 WtCom= 1.00D+00 WtEn= 0.00D+00 - Coeff-Com: 0.315D-02 0.625D-03-0.948D-01 0.109D+01 - Coeff: 0.315D-02 0.625D-03-0.948D-01 0.109D+01 - Gap= 0.421 Goal= None Shift= 0.000 - Gap= 0.451 Goal= None Shift= 0.000 - RMSDP=4.17D-06 MaxDP=7.18D-05 DE=-1.74D-06 OVMax= 3.63D-05 - - Initial convergence to 1.0D-05 achieved. Increase integral accuracy. - Cycle 5 Pass 1 IDiag 1: - E= -1.60233115612014 Delta-E= 0.000004278415 Rises=F Damp=F - DIIS: error= 1.28D-05 at cycle 1 NSaved= 1. - NSaved= 1 IEnMin= 1 EnMin= -1.60233115612014 IErMin= 1 ErrMin= 1.28D-05 - ErrMax= 1.28D-05 EMaxC= 1.00D+00 BMatC= 3.65D-09 BMatP= 3.65D-09 - IDIUse=1 WtCom= 1.00D+00 WtEn= 0.00D+00 - Coeff-Com: 0.100D+01 - Coeff: 0.100D+01 - Gap= 0.421 Goal= None Shift= 0.000 - Gap= 0.452 Goal= None Shift= 0.000 - RMSDP=4.17D-06 MaxDP=7.18D-05 DE= 4.28D-06 OVMax= 2.37D-05 - - Cycle 6 Pass 1 IDiag 1: - E= -1.60233115720703 Delta-E= -0.000000001087 Rises=F Damp=F - DIIS: error= 1.25D-06 at cycle 2 NSaved= 2. - NSaved= 2 IEnMin= 2 EnMin= -1.60233115720703 IErMin= 2 ErrMin= 1.25D-06 - ErrMax= 1.25D-06 EMaxC= 1.00D+00 BMatC= 4.93D-11 BMatP= 3.65D-09 - IDIUse=1 WtCom= 1.00D+00 WtEn= 0.00D+00 - Coeff-Com: -0.394D-01 0.104D+01 - Coeff: -0.394D-01 0.104D+01 - Gap= 0.421 Goal= None Shift= 0.000 - Gap= 0.452 Goal= None Shift= 0.000 - RMSDP=2.41D-07 MaxDP=3.31D-06 DE=-1.09D-09 OVMax= 2.97D-06 - - Cycle 7 Pass 1 IDiag 1: - E= -1.60233115722340 Delta-E= -0.000000000016 Rises=F Damp=F - DIIS: error= 3.55D-07 at cycle 3 NSaved= 3. - NSaved= 3 IEnMin= 3 EnMin= -1.60233115722340 IErMin= 3 ErrMin= 3.55D-07 - ErrMax= 3.55D-07 EMaxC= 1.00D+00 BMatC= 2.24D-12 BMatP= 4.93D-11 - IDIUse=1 WtCom= 1.00D+00 WtEn= 0.00D+00 - Coeff-Com: -0.190D-01 0.156D+00 0.863D+00 - Coeff: -0.190D-01 0.156D+00 0.863D+00 - Gap= 0.421 Goal= None Shift= 0.000 - Gap= 0.452 Goal= None Shift= 0.000 - RMSDP=3.01D-08 MaxDP=1.99D-07 DE=-1.64D-11 OVMax= 6.76D-07 - - Cycle 8 Pass 1 IDiag 1: - E= -1.60233115722420 Delta-E= -0.000000000001 Rises=F Damp=F - DIIS: error= 4.11D-08 at cycle 4 NSaved= 4. - NSaved= 4 IEnMin= 4 EnMin= -1.60233115722420 IErMin= 4 ErrMin= 4.11D-08 - ErrMax= 4.11D-08 EMaxC= 1.00D+00 BMatC= 3.22D-14 BMatP= 2.24D-12 - IDIUse=1 WtCom= 1.00D+00 WtEn= 0.00D+00 - Coeff-Com: 0.790D-02-0.693D-01-0.336D+00 0.140D+01 - Coeff: 0.790D-02-0.693D-01-0.336D+00 0.140D+01 - Gap= 0.421 Goal= None Shift= 0.000 - Gap= 0.452 Goal= None Shift= 0.000 - RMSDP=8.52D-09 MaxDP=5.83D-08 DE=-7.94D-13 OVMax= 1.24D-07 - - SCF Done: E(UB+HF-LYP) = -1.60233115722 A.U. after 8 cycles - Convg = 0.8520D-08 -V/T = 1.8167 - S**2 = 0.7500 - KE= 1.962059740436D+00 PE=-5.860584100929D+00 EE= 9.645334054468D-01 - Annihilation of the first spin contaminant: - S**2 before annihilation 0.7500, after 0.7500 - Leave Link 502 at Wed Jun 5 02:22:48 2013, MaxMem= 6291456 cpu: 0.2 - (Enter /state/partition1/apps/g03sun/l701.exe) - Compute integral first derivatives. - ... and contract with generalized density number 0. - Leave Link 701 at Wed Jun 5 02:22:48 2013, MaxMem= 6291456 cpu: 0.1 - (Enter /state/partition1/apps/g03sun/l702.exe) - L702 exits ... SP integral derivatives will be done elsewhere. - Leave Link 702 at Wed Jun 5 02:22:48 2013, MaxMem= 6291456 cpu: 0.0 - (Enter /state/partition1/apps/g03sun/l703.exe) - Compute integral first derivatives, UseDBF=F. - Integral derivatives from FoFDir, PRISM(SPDF). - Petite list used in FoFDir. - MinBra= 0 MaxBra= 1 Meth= 1. - IRaf= 0 NMat= 1 IRICut= 1 DoRegI=T DoRafI=F ISym2E= 1 JSym2E=1. - Leave Link 703 at Wed Jun 5 02:22:48 2013, MaxMem= 6291456 cpu: 0.1 - (Enter /state/partition1/apps/g03sun/l716.exe) - Dipole = 0.00000000D+00 0.00000000D+00 2.88385745D-03 - ***** Axes restored to original set ***** - ------------------------------------------------------------------- - Center Atomic Forces (Hartrees/Bohr) - Number Number X Y Z - ------------------------------------------------------------------- - 1 1 0.455074045 0.000000000 0.000000000 - 2 1 0.000011458 0.000000000 0.000000000 - 3 1 -0.455085503 0.000000000 0.000000000 - ------------------------------------------------------------------- - Cartesian Forces: Max 0.455085503 RMS 0.214526663 - ------------------------------------------------------------------------ - Internal Coordinate Forces (Hartree/Bohr or radian) - Cent Atom N1 Length/X N2 Alpha/Y N3 Beta/Z J - ------------------------------------------------------------------------ - 1 H - X 1 0.000000( 1) - 2 H 1 0.000011( 2) 2 0.000000( 4) - 3 H 1 0.455086( 3) 2 0.000000( 5) 3 0.000000( 6) 0 - ------------------------------------------------------------------------ - Internal Forces: Max 0.455085503 RMS 0.185787879 - Leave Link 716 at Wed Jun 5 02:22:48 2013, MaxMem= 6291456 cpu: 0.0 - (Enter /state/partition1/apps/g03sun/l103.exe) - - GradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGradGrad - Berny optimization. diff --git a/tools/vasp/get_potcar.py b/tools/vasp/get_potcar.py index 892b0df..8980166 100644 --- a/tools/vasp/get_potcar.py +++ b/tools/vasp/get_potcar.py @@ -32,7 +32,7 @@ "Br":"Br", "D": "H", "Si": "Si", "Ni": "Ni", "Pt":"Pt_pv", "Co":"Co", "Cr":"Cr", "I":"I", "K":"K_pv", "F":"F", "W":"W", "Au":"Au", "Cs":"Cs_sv", "Mg":"Mg", "Ag":"Ag", "Se":"Se", "B":"B", "He":"He", "Ar":"Ar", "Xe":"Xe", "Kr":"Kr", - "Mo": "Mo",} + "Mo": "Mo", "Fe": "Fe",} if socket.gethostname() == "cluster.hpc.org": POT_DATA_BASE = "/project/source/VASP/vasp.5.3.5/potcar/potpaw_PBE"