예제 #1
0
파일: Driver.py 프로젝트: zhenglz/mmtools
def loadStructure(*files):

    for file in files:
        try:
            filename = str(file)
        except:
            sys.stderr.write("ERROR(loadStructure): Invalid argument! Arguments should be string filenames\n")

        extension = file.split(".")[-1]
       
        if extension.lower() == 'gro':
            import ctools.GromacsExt.GromacsStructureParser as GromacsStructureParser
            print 'Reading in Gromacs structure "%s"...' %(filename)
            GromacsStructureParser.readStructure(filename)
        
        elif extension.lower() == '':
            pass

        else:
            sys.stderr.write(" Error: '%s' is not a supported structure file format\n" %(extension.lower()))
        
        print "Structure loaded\n"
예제 #2
0
import sys
import os.path
from ctools.System import System

System._sys = System("Redone Sample")
print "System initialized\n"
print "ENTER FILENAME?\n"
filename = raw_input("")
while not (os.path.isfile(filename+".gro") or os.path.isfile(filename+".top")):
 print "File doesn't exit, try again\n"
 filename = raw_input("")
filename_out = filename + "_OUT"
from ctools.GromacsExt.GromacsTopologyParser import GromacsTopologyParser
print 'Reading in Gromacs topology "%s"...' %(filename)
if not GromacsTopologyParser._GroTopParser:
  GromacsTopologyParser._GroTopParser = GromacsTopologyParser()
GromacsTopologyParser._GroTopParser.parseTopology(filename + '.top')
import ctools.GromacsExt.GromacsStructureParser as GromacsStructureParser
print 'Reading in Gromacs structure "%s"...' %(filename)
GromacsStructureParser.readStructure(filename + '.gro')
print "\nWriting out Gromacs topology %s"%(filename_out+".top")
import ctools.GromacsExt.GromacsTopologyParser as GromacsTopologyParser
GromacsTopologyParser = GromacsTopologyParser()
GromacsTopologyParser.writeTopology(filename_out+".top")
print "\nWriting in Gromacs structure %s"%(filename_out+".gro")
import ctools.GromacsExt.GromacsStructureParser as GromacsStructureParser
GromacsStructureParser.writeStructure(filename_out+".gro")

예제 #3
0
    print "\nWriting out Desmond structure %s" % (filename_out)
    DesmondParser.writeFile(filename_out + ".cms")
elif num == 2:
    print "\nReading in Desmond structure %s" % (filename)
    import ctools.DesmondExt.DesmondParser as DesmondParser
    DesmondParser = DesmondParser()
    DesmondParser.readFile(filename + ".cms")
elif num == 3:
    from ctools.GromacsExt.GromacsTopologyParser import GromacsTopologyParser
    print 'Reading in Gromacs topology "%s"...' % (filename)
    if not GromacsTopologyParser._GroTopParser:
        GromacsTopologyParser._GroTopParser = GromacsTopologyParser()
    GromacsTopologyParser._GroTopParser.parseTopology(filename + '.top')
    import ctools.GromacsExt.GromacsStructureParser as GromacsStructureParser
    print 'Reading in Gromacs structure "%s"...' % (filename)
    GromacsStructureParser.readStructure(filename + '.gro')
    print "Writing out Desmond structure %s" % (filename_out)
    import ctools.DesmondExt.DesmondParser as DesmondParser
    DesmondParser = DesmondParser()
    DesmondParser.writeFile(filename_out)
elif num == 4:
    from ctools.GromacsExt.GromacsTopologyParser import GromacsTopologyParser
    print 'Reading in Gromacs topology "%s"...' % (filename)
    if not GromacsTopologyParser._GroTopParser:
        GromacsTopologyParser._GroTopParser = GromacsTopologyParser()
    GromacsTopologyParser._GroTopParser.parseTopology(filename + '.top')
    import ctools.GromacsExt.GromacsStructureParser as GromacsStructureParser
    print 'Reading in Gromacs structure "%s"...' % (filename)
    GromacsStructureParser.readStructure(filename + '.gro')
    print "\nWriting out Gromacs topology %s" % (filename_out + ".top")
    import ctools.GromacsExt.GromacsTopologyParser as GromacsTopologyParser