Skip to content

Commit

Permalink
More warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Fraux authored and Luthaf committed Sep 14, 2017
1 parent 4813260 commit bbecbcc
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 32 deletions.
1 change: 0 additions & 1 deletion examples/mc_npt_argon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//! Testing physical properties of a Lennard-Jones Argon using Monte Carlo
//! simulation.
extern crate lumol;
extern crate lumol_input as input;

use lumol::sys::{System, TrajectoryBuilder, UnitCell};
use lumol::energy::{LennardJones, PairInteraction};
Expand Down
3 changes: 1 addition & 2 deletions examples/mc_npt_ethane.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Lumol, an extensible molecular simulation engine
// Copyright (C) Lumol's contributors — BSD license
extern crate lumol;
extern crate lumol_input as input;

use lumol::sys::{UnitCell, System, TrajectoryBuilder};
use lumol::units;
Expand Down Expand Up @@ -91,7 +90,7 @@ fn main() {
// (See frequencies of moves:
// nmols/2 translations + nmols/2 rotations + 2 resize moves)
let moves_per_cycle = 10;
let cycles = 100000;
let cycles = 100_000;

// Some output and start of the simulation.
println!("Simuation of 100 ethane molecules.");
Expand Down
5 changes: 2 additions & 3 deletions examples/mc_npt_spce.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Lumol, an extensible molecular simulation engine
// Copyright (C) Lumol's contributors — BSD license
extern crate lumol;
extern crate lumol_input as input;

use lumol::sys::{UnitCell, System, TrajectoryBuilder};
use lumol::units;
Expand Down Expand Up @@ -102,14 +101,14 @@ fn main() {
simulation.add_output_with_frequency(
Box::new(EnergyOutput::new("npt_spce_ener.dat").unwrap()), 500);
simulation.add_output_with_frequency(
Box::new(TrajectoryOutput::new("npt_spce_conf.xyz").unwrap()), 10000);
Box::new(TrajectoryOutput::new("npt_spce_conf.xyz").unwrap()), 10_000);

// Often, a simulation is described using `MC cycles`.
// We define a `cycle` to contain `nmols+2` moves.
// (See frequencies of moves:
// nmols/2 translations + nmols/2 rotations + 2 resize moves)
let moves_per_cycle = 92;
let cycles = 10000;
let cycles = 10_000;

// Some output and start of the simulation.
println!("Simuation of 90 spce molecules.");
Expand Down
2 changes: 1 addition & 1 deletion examples/xenon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ fn main() {
let trajectory_out = Box::new(TrajectoryOutput::new("trajectory.xyz").unwrap());
simulation.add_output_with_frequency(trajectory_out, 50);

simulation.run(&mut system, 20000);
simulation.run(&mut system, 20_000);
}
6 changes: 1 addition & 5 deletions src/bin/lumol.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Lumol, an extensible molecular simulation engine
// Copyright (C) Lumol's contributors — BSD license

extern crate lumol;
extern crate lumol_input;

#[macro_use]
Expand All @@ -11,8 +9,6 @@ extern crate clap;
use lumol_input::Input;
use clap::{App, ArgMatches};

use std::process::exit;

fn parse_args<'a>() -> ArgMatches<'a> {
App::new("lumol")
.version(env!("CARGO_PKG_VERSION"))
Expand All @@ -28,7 +24,7 @@ fn main() {
Ok(config) => config,
Err(err) => {
error!("bad input file: {}", err);
exit(2);
std::process::exit(2)
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/core/src/energy/global/wolf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl GlobalPotential for Wolf {
let thread_forces_store = ThreadLocalStore::new(|| vec![Vector3D::zero(); natoms]);

(0..natoms).into_par_iter().for_each(|i| {
/// Get the thread local forces Vec
// Get the thread local forces Vec
let mut thread_forces = thread_forces_store.borrow_mut();

let qi = configuration.particle(i).charge;
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
cast_possible_wrap, float_cmp, or_fun_call, string_add, non_ascii_literal,
doc_markdown, missing_docs_in_private_items, module_inception, stutter,
unseparated_literal_suffix, new_without_default, new_without_default_derive,
zero_ptr,
zero_ptr, use_self, borrowed_box
)]

#[macro_use]
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/sim/simulations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl Simulation {
output.write(system);
}

if i % 10000 == 0 {
if i % 10_000 == 0 {
self.sanity_check(system);
}
}
Expand Down
20 changes: 10 additions & 10 deletions src/core/src/sys/config/molecules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl Molecule {
// We will not find any dihedral angle from these bonds
continue;
};
self.angles.insert(angle);
let _ = self.angles.insert(angle);

// Find dihedral angles
for bond3 in &self.bonds {
Expand All @@ -137,7 +137,7 @@ impl Molecule {
// improper dihedral.
continue;
};
self.dihedrals.insert(dihedral);
let _ = self.dihedrals.insert(dihedral);
}
}
}
Expand Down Expand Up @@ -180,17 +180,17 @@ impl Molecule {
assert_eq!(self.range.end, other.range.start);
self.range.end = other.range.end;
for bond in other.bonds() {
self.bonds.insert(*bond);
let _ = self.bonds.insert(*bond);
}

// Get angles and dihedrals from the other molecule, there is no need to
// rebuild these.
for angle in other.angles() {
self.angles.insert(*angle);
let _ = self.angles.insert(*angle);
}

for dihedral in other.dihedrals() {
self.dihedrals.insert(*dihedral);
let _ = self.dihedrals.insert(*dihedral);
}

self.rebuild_connections();
Expand All @@ -212,7 +212,7 @@ impl Molecule {

let mut new_bonds = HashSet::new();
for bond in &self.bonds {
new_bonds.insert(Bond::new(
let _ = new_bonds.insert(Bond::new(
bond.i().wrapping_add(delta),
bond.j().wrapping_add(delta)
));
Expand All @@ -221,7 +221,7 @@ impl Molecule {

let mut new_angles = HashSet::new();
for angle in &self.angles {
new_angles.insert(Angle::new(
let _ = new_angles.insert(Angle::new(
angle.i().wrapping_add(delta),
angle.j().wrapping_add(delta),
angle.k().wrapping_add(delta)
Expand All @@ -231,7 +231,7 @@ impl Molecule {

let mut new_dihedrals = HashSet::new();
for dihedral in &self.dihedrals {
new_dihedrals.insert(Dihedral::new(
let _ = new_dihedrals.insert(Dihedral::new(
dihedral.i().wrapping_add(delta),
dihedral.j().wrapping_add(delta),
dihedral.k().wrapping_add(delta),
Expand All @@ -247,7 +247,7 @@ impl Molecule {
assert!(self.contains(i));
assert!(self.contains(j));
assert_ne!(i, j);
self.bonds.insert(Bond::new(i, j));
let _ = self.bonds.insert(Bond::new(i, j));
self.rebuild();
}

Expand All @@ -271,7 +271,7 @@ impl Molecule {
bond_j -= 1;
}

new_bonds.insert(Bond::new(bond_i, bond_j));
let _ = new_bonds.insert(Bond::new(bond_i, bond_j));
}

self.bonds = new_bonds;
Expand Down
2 changes: 1 addition & 1 deletion src/input/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
cast_possible_truncation, cast_precision_loss, cast_sign_loss,
cast_possible_wrap, float_cmp, or_fun_call, string_add, non_ascii_literal,
doc_markdown, missing_docs_in_private_items, module_inception, stutter,
unseparated_literal_suffix, new_without_default_derive
unseparated_literal_suffix, new_without_default_derive, use_self
)]

extern crate lumol;
Expand Down
1 change: 0 additions & 1 deletion tests/mc-water.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Lumol, an extensible molecular simulation engine
// Copyright (C) Lumol's contributors — BSD license
extern crate lumol;
extern crate lumol_input as input;
extern crate env_logger;

Expand Down
1 change: 0 additions & 1 deletion tests/md-butane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Copyright (C) Lumol's contributors — BSD license

//! Testing molecular dynamics of butane
extern crate lumol;
extern crate lumol_input as input;
extern crate env_logger;

Expand Down
1 change: 0 additions & 1 deletion tests/md-methane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Copyright (C) Lumol's contributors — BSD license

//! Testing molecular dynamics of methane
extern crate lumol;
extern crate lumol_input as input;
extern crate env_logger;

Expand Down
1 change: 0 additions & 1 deletion tests/md-water.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Copyright (C) Lumol's contributors — BSD license

//! Testing physical properties of f-SPC water
extern crate lumol;
extern crate lumol_input as input;
extern crate env_logger;

Expand Down
2 changes: 0 additions & 2 deletions tests/nist-spce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
//! Testing energy computation for SPC/E water using data from
//! https://www.nist.gov/mml/csd/chemical-informatics-research-group/spce-water-reference-calculations-9%C3%A5-cutoff
//! https://www.nist.gov/mml/csd/chemical-informatics-research-group/spce-water-reference-calculations-10å-cutoff
extern crate lumol;
extern crate lumol_input as input;

use lumol::sys::{System, UnitCell};
use lumol::sys::TrajectoryBuilder;
Expand Down

0 comments on commit bbecbcc

Please sign in to comment.