Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traits #1

Merged
merged 23 commits into from
Aug 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ target
tags
data*
.ropeproject
target
Cargo.lock
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: rust
rust:
- stable
- beta
41 changes: 0 additions & 41 deletions Cargo.lock

This file was deleted.

20 changes: 8 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
[package]
name = "vegas-rs"
version = "0.1.0"
authors = ["Oscar David Arbeláez Echeverri <[email protected]>"]
description = "Atomistic magnetic system simulation in rust"
license = "GPL-3.0"

[lib]
name = "vegas"
path = "src/vegas/lib.rs"

[[bin]]
name = "vegas"
path = "src/bin/main.rs"
version = "0.0.1"
authors = ["Oscar Arbelaeze <@odarbelaeze>"]
description = "Little Monte Carlo code in rust"
keywords = ["Monte Carlo", "MCMC", "physics"]
readme = "README.md"
repository = "https://github.com/odarbelaeze/vegas-rs"
documentation = "https://github.com/odarbelaeze/vegas-rs"
license = "MIT"

[dependencies]
rand = "0.3"
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Oscar David Arbelaez, PCM Computational Applications

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
This is an experimental implementation of an atomistic simulation paclage for
magnetic systems. **vegas-rs**'s main goal is to determine how performant is
the [rust](www.rust-lang.com) language for this kind of application.

Read more about the [vegas project](https://pcm-ca.github.io/vegas/)
41 changes: 41 additions & 0 deletions benches/bench_energy.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#![feature(test)]
extern crate vegas_rs;
extern crate test;

use vegas_rs::state::{Spin, HeisenbergSpin, State};
use vegas_rs::energy::{Gauge, UniaxialAnisotropy, EnergyComponent, CompoundEnergy};


#[bench]
fn gauge_energy_of_a_1_k_heisenberg_state(b: &mut test::Bencher) {
let state = State::<HeisenbergSpin>::rand_with_size(1_000);
let gauge = Gauge::new(1.0);
b.iter(|| {
let energy = gauge.total_energy(&state);
assert!(energy == 1_000.0);
})
}


#[bench]
fn anisotropy_energy_of_a_1k_heisenberg_state(b: &mut test::Bencher) {
let state = State::<HeisenbergSpin>::up_with_size(1_000);
let anisotropy = UniaxialAnisotropy::new(HeisenbergSpin::up(), 1.0);
b.iter(|| {
let energy = anisotropy.total_energy(&state);
assert!(energy == 1_000.0);
})
}


#[bench]
fn compound_energy_hit_1k_heisenberg(b: &mut test::Bencher) {
let state = State::<HeisenbergSpin>::up_with_size(1_000);
let gauge = Gauge::new(1.0);
let anisotropy = UniaxialAnisotropy::new(HeisenbergSpin::up(), 1.0);
let compound = CompoundEnergy::new(gauge, anisotropy);
b.iter(|| {
let energy = compound.total_energy(&state);
assert!(energy == 2_000.0);
})
}
44 changes: 44 additions & 0 deletions benches/bench_integration.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#![feature(test)]

#[macro_use] extern crate vegas_rs;
extern crate test;

use vegas_rs::state::{Spin, IsingSpin, HeisenbergSpin, State};
use vegas_rs::energy::{Gauge, UniaxialAnisotropy};
use vegas_rs::integrator::{Integrator, MetropolisIntegrator};


#[bench]
fn integration_of_1k_heisenberg_spin_with_gauge(b: &mut test::Bencher) {
let gauge = Gauge::new(1.0);
let integrator = MetropolisIntegrator::new(3.0);
let mut state = State::<HeisenbergSpin>::rand_with_size(1_000);
b.iter(|| {
state = integrator.step(&gauge, &state)
})
}


#[bench]
fn integration_of_1k_ising_spin_with_gauge(b: &mut test::Bencher) {
let gauge = Gauge::new(1.0);
let integrator = MetropolisIntegrator::new(3.0);
let mut state = State::<IsingSpin>::rand_with_size(1_000);
b.iter(|| {
state = integrator.step(&gauge, &state)
})
}


#[bench]
fn integration_of_1k_heisenberg_spin_with_compound_energy(b: &mut test::Bencher) {
let hamiltonian = hamiltonian!(
Gauge::new(1.0),
UniaxialAnisotropy::new(HeisenbergSpin::up(), 10.0)
);
let integrator = MetropolisIntegrator::new(3.0);
let mut state = State::<HeisenbergSpin>::rand_with_size(1_000);
b.iter(|| {
state = integrator.step(&hamiltonian, &state)
})
}
31 changes: 31 additions & 0 deletions benches/bench_spin.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#![feature(test)]
extern crate vegas_rs;
extern crate test;

use vegas_rs::state::{Spin, IsingSpin, HeisenbergSpin, State};


#[bench]
fn create_1k_ising_spins(b: &mut test::Bencher) {
b.iter(|| {
for _ in 0..1_000 {
let _spin = IsingSpin::rand();
}
});
}

#[bench]
fn create_1k_heisenberg_spins(b: &mut test::Bencher) {
b.iter(|| {
for _ in 0..1_000 {
let _spin = HeisenbergSpin::rand();
}
});
}

#[bench]
fn create_a_1k_spin_state(b: &mut test::Bencher) {
b.iter(|| {
let _state = State::<HeisenbergSpin>::rand_with_size(1_000);
})
}
44 changes: 0 additions & 44 deletions src/bin/main.rs

This file was deleted.

Loading