Examples demonstrating how to add new atoms or ions to an atom struct

(For a full list of functions that can add atoms/ions/molecules, go to List_build_functions

Contents

First set some convenient matlab settings

format compact; set(gcf,'Visible','on');

Create new atoms with create_atom

This function creates new atoms/particles within a certain region defined by limits. It can also add particles on a plane by setting Lx|Ly|Lz to 0 or something small. We call the function by issuing something like:

atom = create_atom(type,resname,limits,nmax,varargin)

Input arguments

Examples

atom = create_atom('Na','Na',[10 20 30],10) % Adding 10 Na in a 10x20x30 Å box
atom = create_atom('Na','Na',[0 0 0 10 20 30],10) % same as above
atom = create_atom('Na','Na',[0 0 30 10 20 30],10) % Adding 10 Na on a plane at z=30Å in a 10x20x30 Å box
atom = create_atom('Na','Na',[10 20 30],10,2) % Double the minimum spacing between the Na atoms
atom = create_atom('Na','Na',[10 20 30],10,1.5,in_atom) % Making sure there is no atomic overlap with another in_atom struct

Insert new atoms or molecules with insert_atom

atom = insert_atom(atom_in,limits,rotate,r,nmax,varargin)

Input arguments

Examples

atom_in = import_atom('Ethanol.pdb'); % Import the example Ethanol molecule
limits=[30 30 30]; % Set some volime defined by <limits_variable limits>
r=2; % rmin cutoff
maxsol=10; % max number of atoms/molecules to insert
atom1 = insert_atom(atom_in,limits,'rotate',r,maxsol)
atom2 = insert_atom(atom_in,limits,[10 20 30],r,maxsol,[])
atom3 = insert_atom(atom_in,limits,'rotate',r,2,atom_in,[1 2],0.3) % Here we make sure the first atomtype in a molecule has a z-coordinates 0.3 Å > than the second atomtype within the same molecule

Add ions with ionize_atom

Input arguments

%

Examples

atom = ionize_atom('Na','Na',[10 20 30],10)
atom = ionize_atom('Na','Na',[10 20 30],10,2) % Nearest distance will be 2 * ionic radii
atom = ionize_atom('Na','Na',[10 20 30],10,2,in_atom) % Random placement without atomic overlap with in_atom
atom = ionize_atom('Na','Na',[10 20 30],10,2,in_atom,'surface') % Preferred placement at the 'surface' or 'bulk'
atom = ionize_atom('Na','Na',[10 20 30],10,2,in_atom,'surface'|'bulk','x'|'y'|'z'|20) % Preferred placement at the 'surface' or'bulk' within the x|y|z or [value] range