Skip to content

jesperschmidthansen/molsim

Repository files navigation

molsim - Molecular dynamics with GNU Octave

Trulli

molsim supports simulations of

  • simple Lennard-Jones systems,
  • molecular systems with bond, angle, and torsion potentials,
  • confined flow systems, eg., Couette and Poiseuille flows,
  • charged systems using shifted force and Wolf methods,
  • dissipative particle dynamics systems,
  • different ensembles,
  • and more . .

Installation

At the Octave prompt simply use the command

 
  >> pkg install "https://github.com/jesperschmidthansen/molsim/archive/refs/tags/v<version>.tar.gz"
  

where <version> is the version number. NOTE: Depdending on your system you may recieve warnings like

 
  note: expected 'const mwSize *' {aka 'const long long int *'} but argument is of type 'const long int *'
  
These warnings are not always harmful and not a molsim issue. Proceed with care.

An example

An example of an NVE water simulation script
nloops = 1000; temp0 = 298.15/78.2;
cutoff= 2.5; sigma=1.0; epsilon=1.0; aw=1.0; cutoff_sf = 2.9;
lbond = 0.316; kspring = 68421; 
angle = 1.97; kangle = 490;

molsim('set', 'cutoff', cutoff_sf);
molsim('set', 'timestep', 0.0005);
molsim('set', 'exclusion', 'molecule'); 

molsim('set', 'omp', 4);

molsim('load', 'xyz', 'sys_water.xyz');  molsim('load', 'top', 'sys_water.top');

for n=1:nloops 
  molsim('reset')
  
  molsim('calcforce', 'lj', 'OO', cutoff, sigma, epsilon, aw);
  molsim('calcforce', 'coulomb', 'sf', cutoff_sf);
  molsim('calcforce', 'bond', 0, lbond, kspring);
  molsim('calcforce', 'angle', 0, angle, kangle);
  
  molsim('integrate', 'leapfrog');
end

molsim('clear');

IMPORTANT NOTE: The 'sys_water.xyz' configuration file and 'sys_water.top' topology file must be in same directory from where you execute the script. They can be found under the project's resource/ folder

For further explanation check out the package tutorial under the project's doc/ folder

Contribution

I encourage anyone who uses or plans to use molsim to submit problematic issues - this includes issues regarding the documentation. I also welcome contributions to the code for the project, whether it is core features (seplib), post simulation data analysis programs, or extending the molsim wrapper.

To-do

Octave now supports object oriented programming. molsim is under complete reconstructed to benefit from this, see folder newmolsim. Matlab compatibility is relaxed.