Exemplo n.º 1
0
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"
Exemplo n.º 2
0
def writeStructure(*files):
    
    for file in files:
        try:
            filename = str(file)
        except:
            sys.stderr.write("ERROR(writeStructure): Invalid argument! Arguments should be string filenames\n")

        extension = file.split(".")[-1]

        if extension.lower() == 'gro':
            import ctools.GromacsExt.GromacsStructureParser as GromacsStructureParser
            print "Writing Gromacs structure file..."
            GromacsStructureParser.writeStructure(filename)
        
        elif extension.lower() == 'pdb':
            print "Writing PDB structure file..."

        else:
            sys.stderr.write(" Error: '%s' is not a supported structure file format\n" %(extension.lower()))

        print 'Finished writing "%s"\n' %(filename)
Exemplo n.º 3
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")

Exemplo n.º 4
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
Exemplo n.º 5
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 exist, 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 "Writing out Desmond structure %s"%(filename_out)
import ctools.DesmondExt.DesmondParser as DesmondParser
DesmondParser = DesmondParser()
DesmondParser.writeFile(filename_out)