Trisurf Monte Carlo simulator
Samo Penic
2016-03-03 bc14fba27f50fa7ba7c3643c510631ad8d33a6a1
Stated with python script
1 files modified
6 files added
172 ■■■■■ changed files
python/parse_vtu.py 10 ●●●● patch | view | raw | blame | history
python/tape 80 ●●●●● patch | view | raw | blame | history
python/trisurf/.trisurf.py.swp patch | view | raw | blame | history
python/trisurf/__module__.py patch | view | raw | blame | history
python/trisurf/__pycache__/trisurf.cpython-34.pyc patch | view | raw | blame | history
python/trisurf/trisurf.py 73 ●●●●● patch | view | raw | blame | history
python/tsmgr 9 ●●●●● patch | view | raw | blame | history
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>"))
python/tape
New file
@@ -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???
python/trisurf/.trisurf.py.swp
Binary files differ
python/trisurf/__module__.py
python/trisurf/__pycache__/trisurf.cpython-34.pyc
Binary files differ
python/trisurf/trisurf.py
New file
@@ -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")
python/tsmgr
New file
@@ -0,0 +1,9 @@
#!/usr/bin/python3
from trisurf import trisurf
run1=trisurf.Runner(tape='tape')
print(run1)
print(run1.tape.getValue('nshell'))