GithubHelp home page GithubHelp logo

t7saeki / ndmansfield Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jewettaij/ndmansfield

0.0 0.0 0.0 2.3 MB

generate random lattice Hamiltonian paths

Home Page: http://www.moltemplate.org

License: MIT License

Makefile 2.70% C++ 94.63% C 1.55% Shell 1.12%

ndmansfield's Introduction

License GitHub code size in bytes

ndmansfield

Usage:

ndmansfield -box xsize ysize zsize -tsave tsave [options] > traj.raw

Example:

ndmansfield -box 10 10 10 -tsave 2000 -tstop 20000 | tail -n 1001 > traj.raw

Description

color varies over length from blue to red

"ndmansfield" is a simple program which generates random self-avoiding space-filling curves (also called "lattice Hamiltonian paths") in an arbitrary number of dimensions using the algorithm developed by Marc L. Mansfield: (Mansfield, M.L., J. Chem Phys, 2006, 125(15):154103) The program runs a Monte-Carlo simulation which generates a series of curves. As the simulation progresses, the curves become increasingly random and independent of the starting shape. The coordinates for the shapes of these curves are saved as 3-column (or n-column) numeric text files (eg "traj.raw") containing xsize*ysize*zsize lines per curve, and blank lines as delimiters between new curves. Cyclic curves can also be generated. (See details below.)

The curves are assumed to be completely flexible, however stiffness and twist preferences can be introduced using the "-bend-energy" and "-twist-energy" arguments:

color varies over length from blue to red

For more details, including a complete list of options, see the doc_ndmansfield.md file. (The move-set used during the Monte-Carlo procedure is explained here, and here, as well as in the Mansfield paper.)

NOTE: The initial shape of the curve is included in the file generated by this program (which is not random). To skip this useless shape and save only the random shape at the end of the simulation, use "tail", to save the last N+1 lines of the file (as shown in the example above; where N=xsize*ysize*zsize and the +1 is for the trailing blank line delimiter.)

Moltemplate interoperability

This program was originally used to generate initial coordinates for polymer melt simulations using MOLTEMPLATE and LAMMPS. (The coordinates ndmansfield generates can be converted into arbitrary polymers which trace the same path using the "genpoly_lt.py" and "interpolate_curve.py" scripts. Below, a simple coarse-grained DNA polymer is wrapped along a curve generated by ndmansfield:

coarse grained DNA polymer model coarse grained DNA polymer model DNA wrapped around a curve. Color varies from blue to red.

A detailed example demonstrating how this can be done can be found here. This file explains how to download and run ndmansfield, choose the lattice size, and scale and interpolate the coordinates to fit a polymer of a given length inside a container of a given size. This file explains how to convert these coordinates into a polymer using genpoly_lt.py and moltemplate.sh. By running a LAMMPS simulation, the conformation of the polymer can be relaxed to get a more realistic conformation. (Note: The conformations generated by ndmansfield are typically entagled (knotted). To obtain a truly equilibrium conformation, it may be necessary to temporarily allow the polymer(s) to pass through itself.)

Running Time

The total running time necessary to generate a random curve is estimated to be O(n^2). (The number of iterations necessary to generate a random curve was estimated to grow as O(n) with the length of the curve. The running time per iteration is O(n). (This can be improved significantly, but it is currently fast enough for my needs.) The curves shown above have a length over 300000 and were generated in a few minutes.

Compilation

Linux and Apple macOS:

cd src
source setup_gcc.sh
make

(If you are not using the bash shell, enter "bash" into the terminal beforehand. Note: Apple users will need to install the gcc compiler and other build tools using Xcode or brew.)

Windows 10:

Install HyperV (with linux), or the Windows Subsystem for Linux (WSL) and run

sudo apt-get install build-essential

and then follow the instructions above. (Older windows users can install Cygwin or MinGW, or linux via virtualbox.)

Dimensionality:

ndmansfield can generate random paths in dimensions other than 3 by changing the number of integers following the -box argument.

Example in 2-D:

ndmansfield -box 20 20 -tsave 1000 -tstop 15000 | tail -n 401 > traj.raw

Example in 4-D:

ndmansfield -box 10 10 10 10 -tsave 20000 -tstop 200000 | tail -n 10001 > traj.raw

(If you use the -startcrd argument, you will have to change the number of columns in your file accordingly.)

License

ndmansfield is available under the terms of the MIT license.

ndmansfield's People

Contributors

jewettaij avatar t7saeki avatar

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.