コード例 #1
0
def read_nbitp(fn):
    l = open(fn, "r").readlines()
    l = kickOutComments(l, ";")
    l = kickOutComments(l, "#")
    l = readSection(l, "[ atomtypes ]", "[")
    l = parseList("ssiffsff", l)
    dic = {}
    for entry in l:
        dic[entry[0]] = entry[1:]
    return dic
コード例 #2
0
def read_nbitp(fn):
    l = open(fn,'r').readlines()
    l = kickOutComments(l,';')
    l = kickOutComments(l,'#')
    l = readSection(l,'[ atomtypes ]','[')
    l = parseList('ssiffsff',l)
    dic = {}
    for entry in l:
        dic[entry[0]]=entry[1:]
    return dic
コード例 #3
0
ファイル: build_mst_graph.py プロジェクト: zjing7/pmx
    def read_from_file(self,filename,nodeDeg):
	fp = open(filename,'r')
	lines = fp.readlines()
	fp.close()
	lines = pmxparser.kickOutComments( lines, comment = '#')
	for l in lines:
	    l = l.rstrip()
	    l = l.lstrip()
	    foo = l.split()
	    foo[-1] = foo[-1].replace("'","")
	    foo[-1] = foo[-1].replace("\"","")
	    if 'None' == foo[-1]:
		self.opt[foo[0]] = None
		continue
	    if 'False' == foo[-1]:
		self.opt[foo[0]] = None
		continue
	    if 'True' == foo[-1]:
		self.opt[foo[0]] = True
		continue
	    self.opt[foo[0]] = foo[-1]
	    if ('Size' in foo[0]) or ('min' in foo[0]) or ('max' in foo[0]) or ('Transp' in foo[0]) or ('Width' in foo[0]) or ('Pos' in foo[0]) or ('Offset' in foo[0]):
	        self.opt[foo[0]] = float(foo[-1])
	# some options need adjustment
	if self.opt['nodeColor']=='var':
	    self.opt['nodeColor']=nodeDeg
コード例 #4
0
def assign_mass_atp(r1, r2, ffatomtypes):
    fp = open(ffatomtypes, "r")
    lst = fp.readlines()
    lst = kickOutComments(lst, ";")
    fp.close()
    mass = {}
    for l in lst:
        foo = l.split()
        mass[foo[0]] = float(foo[1])
    for atom in r1.atoms + r2.atoms:
        atom.m = mass[atom.atomtype]