-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnlttnew.py
44 lines (32 loc) · 1.64 KB
/
nlttnew.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from modules import initialize
from modules import computenlttnew
import numpy as np
import os
root = './'
filename = 'dump1.1fs.lammpstrj'
fileinit = 'init.dat'
posox = float(input('position of the oxy:>\n'))
nkpoints = 100
ntrysnap = -1
if os.path.exists(root+filename):
inputcompute = initialize.getinitialize(filename, root, posox, nkpoints, ntrysnap)
else:
inputcompute = initialize.getinitialize(fileinit, root, posox, nkpoints, ntrysnap)
temp = float(input('temperature:>\n'))
natpermol = int(input('number of atoms per molecule:>\n'))
cp = float(input('specific heat in SI units:>\n'))
deltat = float(input('time step in metal units:>\n'))
tdump = int(input('dump interval:>\n'))
nltt, chi, corrk = computenlttnew.computenltt(inputcompute['root'], inputcompute['N'], inputcompute['size'],
inputcompute['number of k'], cp, deltat, tdump)
np.save(root+'nltt.npy', nltt)
xk = computenlttnew.Ggeneratemodall(nkpoints) * 2 * np.pi / (inputcompute['size']) #np.linspace(1, nkpoints, nkpoints-1)
with open(root+'nlttk.out', '+w') as f:
for i in range(nkpoints-1):
f.write('{}\t'.format(xk[i+1])+'{}\t'.format(np.real(np.mean(nltt[:, i, -1], axis=0)))
+'{}\t'.format(np.sqrt(np.var(nltt[:, i, -1], axis=0))/nltt.shape[0])
+'{}\t'.format(chi[i+1])
+'{}\n'.format(np.real(np.mean(np.sum(corrk[:,i, :int(corrk.shape[2]/2)+1], axis=1)))))
with open(root+'corren.out', 'w+') as f:
for i in range(corrk.shape[2]):
f.write('{}\t'.format(i)+'{}\t'.format(np.real(np.mean(corrk[:,0, i], axis=0)))+'{}\n'.format(np.real(np.mean(corrk[:,1, i], axis=0))))