ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/samples/Madelung/dipoles/changeCutoff.py
Revision: 1960
Committed: Mon Dec 30 10:29:37 2013 UTC (11 years, 7 months ago) by mlamichh
Content type: text/x-python
File size: 820 byte(s)
Log Message:

File Contents

# User Rev Content
1 mlamichh 1960 #!/usr/bin/python2.7 -tt
2    
3     import fileinput
4     import sys
5     import subprocess
6     import os
7     from numpy import *
8    
9     statfile = open("statfile", "w")
10     for i in range(5, 20):
11     o = open("output_verynew",'w')
12     for line in open("B_bcc_001.md"):
13     line = line.replace("cutoffRadius = "+"%.1f"%i,"cutoffRadius = "+"%.1f"%(i+1))
14     o.write(line)
15     o.close()
16     subprocess.call(['mv','output_verynew', 'B_bcc_001.md'])
17     subprocess.call(['../../../build/bin/openmd', 'B_bcc_001.md'])
18     f = open("B_bcc_001.stat")
19     f.next()
20     for line in f:
21     statfile.write(line)
22     f.close()
23     statfile.close()
24    
25     data = loadtxt("statfile", double)
26     electrostaticPotential = data[:,8]
27     reciporcalSpacePotential = data[:,9]
28     total = electrostaticPotential + reciporcalSpacePotential
29    
30     f= open("cutoffVsEnergy", 'w')
31     for i in range(6, 21):
32     print >> f, i, total[i]
33     f.close()
34