-
Notifications
You must be signed in to change notification settings - Fork 3
/
test_initial_system.py
51 lines (41 loc) · 1.19 KB
/
test_initial_system.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
45
46
47
48
49
50
51
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 2 13:36:36 2014
@author: goran
"""
def main():
path = '/home/goran/lammps-28Jun14/examples/Abel_runs/x_moltemplates'
filename = 'coto_evap_sys_standing.data'
fullname = os.path.join(path,filename)
#print fullname
ofile = open(fullname,'r')
condition = True
while (condition == True): #read until...
line = ofile.readline()
#print line
if ('Atoms' in line):
condition == False
break
ofile.readline() # mpty line
condition = True
total_charge = 0
while (condition == True):
line = ofile.readline()
values = line.split()
if (len(values) <= 1):
condition = False
break
ID = int(values[0])
bond = int(values[1])
mol = int(values[2])
try:
charge = float(values[3])
# gidder ikke ta resten, siden det bare er charge jeg er interessert i nå :-)
total_charge += charge
except:
continue
print total_charge
if (__name__ == "__main__"):
import os
print "Running main..."
main()