molecule_atom.m

Contents

Version

2.12

Contact

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

Examples

  1. atom = molecule_atom(atom) % Basic input arguments
  2. atom = molecule_atom(atom,Molid) % Setting the Molid to an integer number
  3. atom = molecule_atom(atom,Molid,Resname) % Also adding a residue name
  4. atom = molecule_atom(atom,Molid,Resname,Element) % To set atomtype names to the resp. elements (1), or not (0)
function atom = molecule_atom(atom,varargin)

% Default values, may be overwritten below
Molid=1;
Resname='MOL';
Element=0;

if nargin==2
    Molid=varargin{1};
elseif nargin==3
    Molid=varargin{1};
    Resname=varargin{2};
elseif nargin==4
    Molid=varargin{1};
    Resname=varargin{2};
    Element=varargin{3};
end

if Molid>0
    [atom.molid]=deal(Molid);
end

if iscell(Resname)
    Resname=char(Resname);
end
if numel(Resname)>0
    [atom.resname]=deal({Resname});
end

if Element>0
    atom=element_atom(atom);
end