From: John Stone (johns_at_ks.uiuc.edu)
Date: Tue Mar 24 2020 - 11:06:27 CDT

Hi Francois-Xavier,
  
On Sun, Mar 22, 2020 at 11:00:35PM +0100, FX wrote:
> Hi,
>
> As far as I know, VMD currently does not allow reading CIF files (natively). If you try to open a CIF file, it will trigger the "pdbx" plugin, which fails to read the CIF file. It can, I think, read mmCIF files but it???s not the same as CIF. At least, it failed on all the CIF files I have tried to read in the past.

That is correct. VMD has a plugin for reading PDBx/mmCIF files used by
the RCSB PDB, but that plugin handles a restricted dictionary and expects
certain fields to be provided (guaranteed to exist) or else it will
return an error. That plugin is currently associated with the ".cif"
file extension since there isn't a more general CIF plugin yet, and because
that filename extension is being used by the PDB presently for mmCIF files
as well.

> I would be interested in having a native CIF file reader in VMD. It's not that hard to code, relying on existing libraries for parsing CIF format. I can write a short "cifplugin.C" (see attached) using the Gemmi library at https://gemmi.readthedocs.io/en/latest/index.html
> Since VMD does not handle symmetry operations, it will read the CIF file with any symmetry group, and convert everything into "P1" symmetry (i.e. populate the whole unit cell), and load that. It can read CIF files with multiple frames, provided they have the same characteristics.

That is a fine initial implementation strategy.

>
> Three questions:
>
> 1. Are there other people interested, outside of my group?

It would be great to have a full CIF plugin available in VMD,
whether using Gemmi, or by other means.

> 2. Gemmi is a C++ header-only library, so technically that doesn't
> add any extra dependency.

One complication is that it's described as being based C++11.
If accurate, this creates a compiler dependency that is incompatible
with a large number of existing production systems in the field, so
we can't expect to provide a pre-compiled binary that would work
on any but the latest Linux distros, for example. That being said,
because this is a plugin and not part of VMD itself, we could compile
this plugin with C++11 and if the target platform lacks the back-end
runtime support, it will simply fail to load at runtime and should not
cause problems for VMD or for the rest of the plugins, and so long as
it isn't too disruptive for users, that's an outcome I could live with.

It is certainly worth trying out.
In the longer term C++11 will be universally supported and the runtimes
on production systems will eventually catch up.

> It's under the MPL licence, which I read
> as compatible with VMD itself. Could someone confirm that?

It's MPL v2, which seems at my first read to be largely compatible.
I will have to go through it more carefully, but given that this is for a
VMD plugin (and not VMD itself), I'm already relativey confident it should
work out fine.

> 3. How could we deal with files so that CIF files are not
> preempted by the pdbx plugin, but can be read by this plugin?
> Right now, I can't make it work.

There are a number of ways of doing this.
And you can always force a file to be loaded with a specific plugin
using the graphical interface in VMD. (choose the plugin to use manually
rather than automatically)

Something that would make this easier would be to add some new code and
scripting APIs (maybe a GUI also) to allow a user preference
for a specific plugin to be associated with a file extension rather than
the default sorting by plugin major/minor version numbers.

Let me know if you have more questions, I'm happy to help.

Best,
  John Stone
  vmd_at_ks.uiuc.edu

>
>
> Thanks,
> FX Coudert
>
>

-- 
NIH Center for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
http://www.ks.uiuc.edu/~johns/           Phone: 217-244-3349
http://www.ks.uiuc.edu/Research/vmd/