Giter Club home page Giter Club logo

molsim's Introduction

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.

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');
    endfor
    
    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.

molsim's People

Contributors

jesperschmidthansen avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

samkenxstream

molsim's Issues

molsim('hello') fails

I gave the command
pkg install "https://github.com/jesperschmidthansen/molsim/archive/refs/tags/v1.0.0.tar.gz"
in Octave 9.0.1. There were some warnings and possibly an error:

source/sepintgr.c: In function 'sep_langevinGJF':
source/sepintgr.c:97:24: warning: comparison of integer expressions of different signedness: 'unsig
ned int' and 'long int' [-Wsign-compare]
   97 |   for ( unsigned n=0; n<sys->npart; n++ ){
      |                        ^
C:\PROGRA~1\GNUOCT~1\OCTAVE~1.1\mingw64\bin\ar.exe: creating libsep.a
molsim.c: In function 'action_get':
molsim.c:747:39: warning: passing argument 2 of 'mxCreateNumericArray' from incompatible pointer ty
pe [-Wincompatible-pointer-types]
  747 |     plhs[0] = mxCreateNumericArray(1, &nuau, mxINT32_CLASS, mxREAL);
      |                                       ^~~~~
      |                                       |
      |                                       const long int *
In file included from C:\PROGRA~1\GNUOCT~1\OCTAVE~1.1\mingw64\include\octave-9.0.1\octave/mex.h:68,

                 from molsim.h:4,
                 from molsim.c:2:
C:\PROGRA~1\GNUOCT~1\OCTAVE~1.1\mingw64\include\octave-9.0.1\octave/mexproto.h:184:67: note: expect
ed 'const mwSize *' {aka 'const long long int *'} but argument is of type 'const long int *'
  184 |                                                     const mwSize *dims,
      |                                                     ~~~~~~~~~~~~~~^~~~

molsim installed - hopefully without errors
...

When I do molsim('hello') I get this error message:
error: 'molsim' undefined near line 1, column 1
So I guess that last bit wasn't just a warning? Any idea what I might be doing wrong?
Thanks.

Compiler warning (seplib)

Kai from the Octave user group has found numerous compiler warnings. seplib and molsim compiles warning free with '-W -Wall -pedantic', but there are definitely several justified warnings as found by Kai.

In Octave 7.2 test seg. faults

When running the test in Octave 7.2 the test script crashes in test 2. This does not happen when test 1 is excluded or if loop number is printed to screen.

Array indicies

Index of first array element not consistent in get actions. That is, C's 'zero' and Octave's 'one'

Optimization of Coulomb interactions

Perhaps a simple if statement checking if the charge is zero can optimize the force calculations for mix of non-charged and charge particles (seplib issue)

Saving and loading

It appears that saving and loading does not give exact same answer. Simple check should be possible here

Typos and suggestions for tutorial.pdf

tutorial.pdf is very nicely done. Please see the following minor suggestions for typos and wording:

parallization, parallizaton -> parallelization [in several places]

such introduction -> such introductions

is on the form -> is of the form

every 100 time step -> every 100 time steps
every ten time step -> every ten time steps

an-isotropic scaling -> anisotropic scaling

barostate -> barostat

particular useful -> particularly useful

short ranged -> short-range
long ranged -> long-range

are model -> are modelled

diheadral -> dihedral

simulation of model liquid toluene -> simulation of liquid toluene

in same molecule -> in the same molecule [in 2 places]

bond length, but same force -> bond lengths, but the same force

form torsion angle -> form a torsion angle

sheared memory -> shared memory

as function of number -> as a function of the number

I hope this is useful.

Memory management

Currently the command "clear all" correctly (I think) clears the memory. This should be automated in a safe manner some how.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.