Commit c64460e2 authored by Berk Onat's avatar Berk Onat

One function (OpenMolfile) packed pymolfile package

parent 700f0420
......@@ -176,6 +176,7 @@ class Trajectory(object):
self.fplugin = libpymolfile.get_plugin(C_MOLFILE_PLUGINS,
self.plugin[0])
self.pluginhandle = None
if self.natoms > 0:
try:
self.pluginhandle = libpymolfile.open_file_read(self.fplugin,
......@@ -191,7 +192,6 @@ class Trajectory(object):
empty = False
self.step = 0
while not empty:
print(f)
x = self.read_next()
if x is None:
empty = True
......@@ -259,7 +259,6 @@ def read_topology(self, file_name, file_format, plugin):
plugin is not None):
natoms=0
topo = Topology(plugin, file_name, file_format, natoms)
topo.natoms = natoms
#if 0 && vmdplugin_ABIVERSION > 17
# /* The new PDB file formats allows for much larger structures, */
# /* which can therefore require longer chain ID strings. The */
......@@ -446,7 +445,7 @@ class OpenMolfile(object):
self.smolplugin)
#libpymolfile.molfile_finish()
else:
print("Pymolfile can not find a plugin to open the '" +
warnings.warn("Pymolfile can not find a plugin to open the '" +
self.kwords["topology_format"] + "' file format of the file " +
str(topo_file_base) + "." + str(topo_file_ext))
......@@ -463,7 +462,7 @@ class OpenMolfile(object):
self.fplugin,
num_atoms)
else:
print("Pymolfile can not find a plugin to open the '" + self.kwords["file_format"] +
warnings.warn("Pymolfile can not find a plugin to open the '" + self.kwords["file_format"] +
"' file format of the file " + str(file_base) + "." + str(file_ext))
def initialize_settings(self):
......
......@@ -18,6 +18,7 @@ cfname="./test/ala3.dcd"
print("Reading topology")
moltopo = pym.OpenMolfile(sfname)
if moltopo.topology is not None:
print('topo.natoms:',moltopo.topology.natoms)
if moltopo.topology.structure is not None:
print(moltopo.topology.structure)
if moltopo.topology.bonds is not None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment