vmd.m

Contents

Version

2.11

Contact

Please report problems/bugs to michael.holmboe@umu.se

Examples

  1. vmd(atom)
  2. vmd(atom,Box_dim)
  3. vmd('filename.gro')
  4. vmd('filename.pdb')
  5. vmd('filename.pdb','filename.xtc')
function vmd(varargin)

% You need to set your own VMD path here!!!
PATH2VMD = '/Applications/VMD\ 1.9.4a38.app/Contents/MacOS/startup.command';


if nargin==1
    filename=varargin{1};
    if ~isstruct(filename)
        system(strcat(char({PATH2VMD()}),char(strcat({' '},{filename}))));
    else
        atom=filename;
        write_atom_gro(atom,[0 0 0],'temp_out.gro');
        system(strcat(char({PATH2VMD()}),char(strcat({' '},{'temp_out.gro'}))));
    end
else
    atom=varargin{1};
    if size(varargin{2},1)==1
    Box_dim=varargin{2};
    if numel(Box_dim)==1
        Box_dim(1)=Box_dim(1);
        Box_dim(2)=Box_dim(1);
        Box_dim(3)=Box_dim(1);
    end
    write_atom_gro(atom,Box_dim,'temp_out.gro');
    system(strcat(char({PATH2VMD()}),char(strcat({' '},{'temp_out.gro'}))));
    else
        % Assuming second argument is a traj file
        filenametraj=varargin{2};
        system(strcat(char({PATH2VMD()}),char(strcat({' '},{filename},{' '},{filenametraj}))));
    end
end