-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
654 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# cargo | ||
|
||
# [[file:~/Workspace/Programming/gosh/nebrun/neb.note::*cargo][cargo:1]] | ||
[package] | ||
name = "neb" | ||
version = "0.0.1" | ||
edition = "2018" | ||
authors = ["Wenping Guo <[email protected]>"] | ||
|
||
[dependencies] | ||
quicli = "0.4" | ||
structopt = "0.2" | ||
#gosh = {git = "https://github.com/gosh-rs/gosh.git", tag="v0.0.17"} | ||
gosh = {path = "/home/ybyygu/Workspace/Programming/gosh"} | ||
|
||
[dev-dependencies] | ||
approx = "0.3" | ||
# cargo:1 ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// entry | ||
|
||
use gosh::cmd_utils::*; | ||
use std::path::PathBuf; | ||
|
||
use gosh::gchemol::io; | ||
|
||
use neb::NEB; | ||
use gosh::models::*; | ||
|
||
/// An universal runner for Blackbox Model | ||
#[derive(Debug, StructOpt)] | ||
struct Cli { | ||
/// Input molecule file | ||
#[structopt(parse(from_os_str))] | ||
molfile: PathBuf, | ||
|
||
/// Template directory with all related files. The default is current directory. | ||
#[structopt(short = "t", long = "template-dir", parse(from_os_str))] | ||
tpldir: Option<PathBuf>, | ||
|
||
/// Output the caputured structure. e.g.: -o foo.xyz | ||
#[structopt(short = "o", long = "output", parse(from_os_str))] | ||
output: Option<PathBuf>, | ||
|
||
#[structopt(flatten)] | ||
verbosity: Verbosity, | ||
} | ||
|
||
fn main() -> CliResult { | ||
let args = Cli::from_args(); | ||
args.verbosity.setup_env_logger(&env!("CARGO_PKG_NAME"))?; | ||
|
||
// 1. load molecules | ||
info!("input molecule file: {}", &args.molfile.display()); | ||
let mut mols = io::read(args.molfile)?; | ||
info!("loaded {} molecules.", mols.len()); | ||
|
||
let bbm = if let Some(d) = args.tpldir { | ||
BlackBox::from_dotenv(&d) | ||
} else { | ||
BlackBox::default() | ||
}; | ||
|
||
let mut neb = NEB::new(mols); | ||
|
||
neb.run(&bbm)?; | ||
|
||
// output molecules | ||
if let Some(path) = args.output { | ||
let mut mols = vec![]; | ||
for image in neb.images { | ||
mols.push(image.mol.clone()); | ||
} | ||
|
||
println!("file saved to: {:}", path.display()); | ||
io::write(path, &mols)?; | ||
} | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// mods | ||
|
||
// [[file:~/Workspace/Programming/gosh/nebrun/neb.note::*mods][mods:1]] | ||
mod neb; | ||
|
||
pub use crate::neb::NEB; | ||
// mods:1 ends here | ||
|
||
// base | ||
|
||
// [[file:~/Workspace/Programming/gosh/nebrun/neb.note::*base][base:1]] | ||
pub(crate) mod common { | ||
pub use quicli::prelude::*; | ||
pub type Result<T> = ::std::result::Result<T, Error>; | ||
} | ||
// base:1 ends here |
Oops, something went wrong.