diff --git a/gedent.toml b/gedent.toml index 465d90b..80ca441 100644 --- a/gedent.toml +++ b/gedent.toml @@ -4,12 +4,14 @@ default_extension = "inp" [parameters] basis_set = "def2svp" charge = 1 -functional = "BP86" -functional_class = "GGA" -memory = 3000 -multiplicity = 1 +method = "BP86" +method_class = "GGA" +mem = 3000 +mult = 1 nprocs = 20 solvation = false solvent = "water" split_index = 10 hessian = false +solvation_model = "CPCM" +dispersion = "D3" diff --git a/src/main.rs b/src/main.rs index 7781ed5..e031339 100644 --- a/src/main.rs +++ b/src/main.rs @@ -42,22 +42,46 @@ enum Mode { Gen { /// The template to look for in ~/.config/gedent/templates template_name: String, - // TODO: Make this a flag /// xyz files #[arg(value_name = "XYZ files")] xyz_files: Option>, /// Print to screen and don't save file #[arg(short, long, default_value_t = false)] print: bool, + /// Set method + #[arg(long, default_value = None)] + method: Option, + /// Set basis_set + #[arg(long, default_value = None)] + basis_set: Option, + /// Set dispersion + #[arg(long, default_value = None)] + dispersion: Option, /// Set solvent to value and solvation to true #[arg(short, long, default_value = None)] solvent: Option>, + /// Set solvation_model + #[arg(long, default_value = None)] + solvation_model: Option, /// Set charge #[arg(short, long, default_value = None)] charge: Option, - /// Set multiplicity + /// Set hessian + #[arg(long, default_value_t = false)] + hessian: bool, #[arg(short, long, default_value = None)] - multiplicity: Option, + /// Set mult + #[arg(short, long, default_value = None)] + mult: Option, + /// Set nprocs + #[arg(long, default_value = None)] + nprocs: Option, + /// Set mem + #[arg(long, default_value = None)] + mem: Option, + /// Set split_index + #[arg(long, default_value = None)] + split_index: Option, }, // Subcommand to deal with configurations /// Access gedent configuration @@ -157,9 +181,17 @@ fn main() -> Result<()> { template_name, xyz_files, print, + method, + basis_set, + dispersion, solvent, + solvation_model, charge, - multiplicity, + hessian, + mult, + nprocs, + mem, + split_index, } => { let mut molecules: Vec = vec![]; if let Some(files) = xyz_files { @@ -168,7 +200,21 @@ fn main() -> Result<()> { } }; let template = Template::get(template_name)?; - let results = generate_input(template, molecules, solvent, multiplicity, charge)?; + let results = generate_input( + template, + molecules, + solvent, + mult, + charge, + method, + basis_set, + dispersion, + solvation_model, + hessian, + nprocs, + mem, + split_index, + )?; for input in results { if print { println!("{}", input.content); @@ -338,6 +384,14 @@ fn generate_input( solvation: Option>, mult: Option, charge: Option, + method: Option, + basis_set: Option, + dispersion: Option, + solvation_model: Option, + hessian: bool, + nprocs: Option, + mem: Option, + split_index: Option, ) -> Result, Error> { let mut context = tera::Context::new(); let config = Config::get()?; @@ -353,12 +407,31 @@ fn generate_input( } } - if let Some(mult) = mult { - context.insert("multiplicity", &mult); + if hessian { + context.insert("hessian", &hessian); } - if let Some(charge) = charge { - context.insert("charge", &charge); + for (k, v) in [ + ("charge", charge), + ("mult", mult), + ("nprocs", nprocs), + ("mem", mem), + ("split_index", split_index), + ] { + if let Some(v) = v { + context.insert(k, &v); + } + } + + for (k, v) in [ + ("method", method), + ("basis_set", basis_set), + ("dispersion", dispersion), + ("solvation_model", solvation_model), + ] { + if let Some(v) = v { + context.insert(k, &v); + } } let extension = match &template.options.extension { diff --git a/templates/adf/eda b/templates/adf/eda index ef19c51..cbebfa4 100644 --- a/templates/adf/eda +++ b/templates/adf/eda @@ -34,7 +34,7 @@ Engine adf XC Dispersion Grimme3 BJDAMP - {{ functional_class }} {{ functional }} + {{ method_class }} {{ functional }} end Beckegrid diff --git a/templates/adf/sp b/templates/adf/sp index 946c992..47ff6d8 100644 --- a/templates/adf/sp +++ b/templates/adf/sp @@ -18,7 +18,7 @@ Engine ADF end XC - {{ functional_class }} {{ functional }} + {{ method_class }} {{ functional }} Dispersion Grimme3 BJDAMP end diff --git a/templates/gaussian/nbo_del b/templates/gaussian/nbo_del index d894fd3..8e63316 100644 --- a/templates/gaussian/nbo_del +++ b/templates/gaussian/nbo_del @@ -3,8 +3,8 @@ extension = "gjf" --@ %chk={{ Molecule.filename }}.chk %nproc={{ nprocs }} -%mem={{ memory }}GB -# {{ functional }}/{{ basis_set }} pop=nbo6del nosymm +%mem={{ mem }}GB +# {{ method }}/{{ basis_set }} pop=nbo6del nosymm job title: {{ Molecule.filename }} diff --git a/templates/gaussian/opt b/templates/gaussian/opt index a61e535..081ccb3 100644 --- a/templates/gaussian/opt +++ b/templates/gaussian/opt @@ -8,8 +8,8 @@ extension = "gjf" {%endif-%} %chk={{ Molecule.filename }}.chk %nproc={{ nprocs }} -%mem={{ memory }}GB -# {{ functional }}/{{ basis_set }} opt freq=noraman {{ solvent }} +%mem={{ mem }}GB +# {{ method }}/{{ basis_set }} opt freq=noraman {{ solvent }} job title: {{ Molecule.filename }} diff --git a/templates/gaussian/sp b/templates/gaussian/sp index 4105fce..d039450 100644 --- a/templates/gaussian/sp +++ b/templates/gaussian/sp @@ -7,8 +7,8 @@ extension = "gjf" {%set solvent=""-%} {%endif-%} %nproc={{ nprocs }} -%mem={{ memory }}GB -# {{ functional }}/{{ basis_set }} freq=noraman scrf=(smd,solvent=ethanol) temperature=353 +%mem={{ mem }}GB +# {{ method }}/{{ basis_set }} freq=noraman scrf=(smd,solvent=ethanol) temperature=353 job title: {{ Molecule.filename }} diff --git a/templates/orca/neb b/templates/orca/neb index 8ab3cff..5673e15 100644 --- a/templates/orca/neb +++ b/templates/orca/neb @@ -1,4 +1,4 @@ -! {{ functional }} {{ basis_set }} +! {{ method }} {{ basis_set }} ! NEB-TS NumFreq IRC *xyzfile {{ charge }} {{ mult }} {{ xyz_file }} @@ -7,7 +7,7 @@ nprocs {{ nprocs }} end -%maxcore {{ memory }} +%maxcore {{ mem }} {% if solvation -%} %cpcm diff --git a/templates/orca/opt b/templates/orca/opt index ad05098..4281d8c 100644 --- a/templates/orca/opt +++ b/templates/orca/opt @@ -1,14 +1,14 @@ --@ extension = "inp" --@ -! {{ functional }} {{ basis_set }} +! {{ method }} {{ basis_set }} ! Opt freq D3BJ %pal nprocs {{ nprocs }} end -%maxcore {{ memory }} +%maxcore {{ mem }} {% if solvation -%} %cpcm diff --git a/templates/orca/scan b/templates/orca/scan index 497139a..91eb532 100644 --- a/templates/orca/scan +++ b/templates/orca/scan @@ -1,4 +1,4 @@ -! {{ functional }} {{ basis_set }} +! {{ method }} {{ basis_set }} ! Opt {% if solvation -%}