Giter Club home page Giter Club logo

compscie-mc's Introduction

CircleCI codecov

Particlesim

Simple tool for particle markov simulations and simulated annealing using Ewald Summation.

Setup

To install the package, simply go to the package directory and run python setup.py install with in terminal.

Initialization

There are basically two ways to initialize a simulation:

Using a csv input file

  • The basic parameters are set in a config file that looks like this
[general]
k_cutoff = 1.0
sigma_ewald = 1.0
r_cutoff = 3.0
box-size = 20.0

[manual]
csv_path = /path/to/csvfile/example_init_positions.
[ewald_summation]
use_ewald = yes
sigma = 1.0

[lennard_jones]
use_lennard_jones = yes

  • The initial particle configuration is defined by a csv file at the location given in the config and should look similar to this example
label,x,y,z,Charge,LJ-Epsilon,LJ-Sigma
Na,1,0,0,1,0.5,1
Cl,2,2,1,-1,0.5,3
Cl,1,0,1,-1,1,1
Na,1,1,1,1,0.5,1

  • Then the following commands are necessary to initialize the setup
# Get a ProblemCreator file from the config file
creator = ProblemCreator(test_config_path)

# Initialize a SystemConfiguration Object from the config file
system_config = creator.generate_problem()

Using a config input file

  • The basic parameters are set in a config file similar to the previous case but without a [manual] section. But instead, it contains sections for each particle type beginning with particle_class_*. Each class will be collected in the following.
[general]
k_cutoff = 1.0
Sigma_ewald = 1.0
r_cutoff = 3.0
box-size = 20.0

[particle_class_1]
label = Natrium
type = NA
charge = 1
distribution = uniform
number = 10

[particle_class_2]
label = Chlor
type = CL
charge = -1
distribution = uniform
number = 20

The Lennard-Jones parameters for the atom types are defined in lib/particle_types.py. This file can be edited to fit your purpose. In the following, a particle setup is created according to your statements for the attributes distribution and number. (At this point, only the creation of uniform particle distributions is supported.)

  • The initialization process is equal to the previous method
# Get a ProblemCreator file from the config file
creator = ProblemCreator(test_config_path)

# Initialize a SystemConfiguration Object from the config file
system_config = creator.generate_problem()

Run

To run the simulation simply create a sampler with

sampler = particlesim.api.Sampler(system_configuration=system_conf)

And run one simple metropolis simulation with

xyz_trajectory, potential = sampler.metropolis(iteration_number=1000,beta=100)

Or metropolis with simulated annealing

xyz_trajectory, potential = sampler.metropolis(iteration_number=1000, step=0.1, beta=100)

beta can be a single value - in this case it gets interpreted as the maximum value -, a tuple that defines the minimum and maximum value or a list with a length of iteration_number to define a beta value for each simulation step.

Evaluation

At this point a trajectory export to xyz-Format and csv output is supported and can be accessed with the particlesim.utils.xyz and particlesim.config_parser module.

compscie-mc's People

Contributors

simontreu avatar jaappe avatar stefaanhessmann avatar tcrhadler avatar hannawu31 avatar thadler avatar

Stargazers

 avatar  avatar Mark avatar

Watchers

 avatar Mark avatar  avatar  avatar  avatar

Forkers

hannawu31

compscie-mc's Issues

Index out of error

In the new neighbouring implementation there is an out of index error

Tests Failing after neighbour update

Since the last commit to neighbouring there are 4 failing tests. I didn't yet review it completely but it might be a rounding error do to this change:

  •    nr_cells = int(self.box_size/r + 1)
    

is changed to

  •    nr_cells = int(box_size / r)
    

i had the +1 to force a round up allways.

To see the errors run pytest in the project directory

Periodicity

In neighboring lists we need to take care of the periodic boundary conditions! For example if the cutoff is much larger then the box size we would get each particle several times.

Bad sampler test

I added a bad test in test_sampler.py. I will remove it tomorrow

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.