From bc14fba27f50fa7ba7c3643c510631ad8d33a6a1 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Thu, 03 Mar 2016 16:16:22 +0000
Subject: [PATCH] Stated with python script

---
 python/trisurf/__module__.py                      |    0 
 python/tape                                       |   80 ++++++++++++++++++++++++++
 python/trisurf/trisurf.py                         |   73 ++++++++++++++++++++++++
 python/trisurf/__pycache__/trisurf.cpython-34.pyc |    0 
 python/tsmgr                                      |    9 +++
 python/trisurf/.trisurf.py.swp                    |    0 
 python/parse_vtu.py                               |   10 ++
 7 files changed, 170 insertions(+), 2 deletions(-)

diff --git a/python/parse_vtu.py b/python/parse_vtu.py
index 02113c2..3f864c3 100755
--- a/python/parse_vtu.py
+++ b/python/parse_vtu.py
@@ -6,7 +6,13 @@
 tree = ET.parse('../src/timestep_000000.vtu')
 root = tree.getroot()
 trisurf=root.find('trisurf')
+version=root.find('trisurfversion')
+print(version.text);
 print(trisurf.items())
-xml=zlib.decompress(base64.b64decode(trisurf.text))
 
-tree2=ET.ElementTree(ET.fromstring("<root>"+str(xml)[0:-1]+"</root>"))
+#xml=zlib.decompress(base64.b64decode(trisurf.text))
+#xml=trisurf.text
+#print(xml)
+
+#tree2=ET.ElementTree(ET.fromstring(str(xml))
+#tree2=ET.ElementTree(ET.fromstring("<root>"+str(xml)[0:-1]+"</root>"))
diff --git a/python/tape b/python/tape
new file mode 100644
index 0000000..baaac60
--- /dev/null
+++ b/python/tape
@@ -0,0 +1,80 @@
+####### Vesicle definitions ###########
+# nshell is a number of divisions of dipyramid
+nshell=5
+# dmax is the max. bond length (in units l_min)
+dmax=1.7
+# dmin_interspecies in the min. dist. between different vertex species (in units l_min)
+dmin_interspecies=1.2
+# bending rigidity of the membrane (in units kT)
+xk0=10.0
+# max step size (in units l_min)
+stepsize=0.15
+
+# Pressure calculations
+# (pswitch=1: calc. p*dV energy contribution)
+pswitch = 0
+# pressure difference: p_inside - p_outside (in units kT/l_min^3):
+pressure=0.0
+
+#Constant volume constraint (0 disable constant volume, 1 enable wiht additional vertex move, 2 enable with epsvol)
+constvolswitch=2
+constvolprecision=1e-14
+
+#Constant area constraint (0 disable constant area, 2 enable constant area with epsarea)
+constareaswitch=2
+
+####### Polymer (brush) definitions ###########
+# npoly is a number of polymers attached to npoly distinct vertices on vesicle
+npoly=2
+# nmono is a number of monomers in each polymer
+nmono=10
+# Spring constant between monomers of the polymer
+k_spring=800
+
+####### Filament (inside the vesicle) definitions ###########
+# nfil is a number of filaments inside the vesicle
+nfil=0
+# nfono is a number of monomers in each filament
+nfono=300
+# Persistence lenght of the filaments (in units l_min)
+xi=0
+
+####### Nucleus (inside the vesicle) ###########
+# Radius of an impenetrable hard sphere inside the vesicle
+R_nucleus=0
+
+#######  Cell definitions ############
+nxmax=60
+nymax=60
+nzmax=60
+
+
+####### Program Control ############
+#how many MC sweeps between subsequent records of states to disk
+#200000
+mcsweeps=20
+#how many initial mcsweeps*inititer MC sweeps before recording to disk?
+#2
+inititer=0
+#how many records do you want on the disk iteration are there in a run?
+#10000
+iterations=100
+
+
+###### Spherical harmonics ###########
+# If 0 then spherical harmonics are not calculated at all.
+spherical_harmonics_coefficients=21
+
+#shut up if we are using cluster!!!
+quiet=false
+
+#what type of multiprocessing? (*none, smp, cluster, distributed, cuda, auto)
+#currently only none makes sense.
+multiprocessing=none
+#how many cores are allowed to process in SMP?
+smp_cores=2
+#how many nodes in cluster?
+cluster_nodes=50
+#max number of processes in distributed (voluntary) environment
+distributed_processes=50
+#cuda options???
diff --git a/python/trisurf/.trisurf.py.swp b/python/trisurf/.trisurf.py.swp
new file mode 100644
index 0000000..fe43508
--- /dev/null
+++ b/python/trisurf/.trisurf.py.swp
Binary files differ
diff --git a/python/trisurf/__module__.py b/python/trisurf/__module__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/python/trisurf/__module__.py
diff --git a/python/trisurf/__pycache__/trisurf.cpython-34.pyc b/python/trisurf/__pycache__/trisurf.cpython-34.pyc
new file mode 100644
index 0000000..ea75c60
--- /dev/null
+++ b/python/trisurf/__pycache__/trisurf.cpython-34.pyc
Binary files differ
diff --git a/python/trisurf/trisurf.py b/python/trisurf/trisurf.py
new file mode 100644
index 0000000..6478f39
--- /dev/null
+++ b/python/trisurf/trisurf.py
@@ -0,0 +1,73 @@
+#!/usr/bin/python3
+
+import configobj
+
+'''
+This is a trisurf instance manager written in python
+
+
+Invoke with:
+tsmgr [-t tape | -r snapshot.vtu] [-s subdirectory]
+
+If tape is specified, the trisurf wilt start from tape with initial distribution, if snapshot is specified the trisurf will be restored from given snapshot file and simulation will continue.
+
+'''
+
+
+
+class Tape:
+	'''Has all the info on the tape'''
+
+	def __init__(self):
+		return
+
+	def readTape(self, tape='tape'):
+		try:
+			self.config=configobj.ConfigObj(tape)
+		except:
+			print("Error reading or parsing tape file!\n")
+			exit(1)
+	
+
+	def setTape(self, string):
+		self.tape=string
+		return
+
+	def getValue(self,key):
+		return self.config[key]
+
+
+
+class Runner:
+	'''
+	Class Runner consists of a single running or terminated instance of the trisurf
+	'''
+	def initFromTape(self, tape='tape'):
+		self.tape=Tape()
+		self.tape.readTape(tape)
+		pass
+
+	def initFromSnapshot(self, tape='snapshot.vtu'):
+		pass
+
+	def __init__(self, subdir='run0', tape='', snapshot=''):
+		self.subdir=subdir
+		if(tape!=''):
+			self.initFromTape(tape)
+		if(snapshot!=''):
+			self.initFromSnapshot(snapshot)
+
+		return
+
+	def getStatus(self):
+		pass
+
+	def start(self):
+		pass
+
+	def stop(self):
+		pass
+
+	def __str__(self):
+		return("Running instance")
+
diff --git a/python/tsmgr b/python/tsmgr
new file mode 100755
index 0000000..f82906a
--- /dev/null
+++ b/python/tsmgr
@@ -0,0 +1,9 @@
+#!/usr/bin/python3
+
+from trisurf import trisurf
+
+
+
+run1=trisurf.Runner(tape='tape')
+print(run1)
+print(run1.tape.getValue('nshell'))

--
Gitblit v1.9.3