Skip to content

Commit

Permalink
Modify solvent flag behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
caprilesport committed Feb 3, 2024
1 parent a60ffa7 commit d580b1b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
9 changes: 5 additions & 4 deletions gedent.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ charge = 1
functional = "BP86"
functional_class = "GGA"
memory = 3000
mult = 1
nprocs = 8
solvent = "dmso"
multiplicity = 1
nprocs = 20
solvation = false
solvent = "water"
split_index = 10
start_hessian = false
hessian = false
19 changes: 10 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ enum Mode {
print: bool,
/// Set solvent to value and solvation to true
#[arg(short, long, default_value = None)]
solvent: Option<String>,
solvent: Option<Option<String>>,
/// Set charge
#[arg(short, long, default_value = None)]
charge: Option<usize>,
/// Set multiplicity
#[arg(short, long, default_value = None)]
mult: Option<usize>,
multiplicity: Option<usize>,
},
// Subcommand to deal with configurations
/// Access gedent configuration
Expand Down Expand Up @@ -159,7 +159,7 @@ fn main() -> Result<()> {
print,
solvent,
charge,
mult,
multiplicity,
} => {
let mut molecules: Vec<Molecule> = vec![];
if let Some(files) = xyz_files {
Expand All @@ -168,7 +168,7 @@ fn main() -> Result<()> {
}
};
let template = Template::get(template_name)?;
let results = generate_input(template, molecules, solvent, mult, charge)?;
let results = generate_input(template, molecules, solvent, multiplicity, charge)?;
for input in results {
if print {
println!("{}", input.content);
Expand Down Expand Up @@ -335,7 +335,7 @@ fn gedent_init(config: Option<PathBuf>) -> Result<(), Error> {
fn generate_input(
template: Template,
molecules: Vec<Molecule>,
solvent: Option<String>,
solvation: Option<Option<String>>,
mult: Option<usize>,
charge: Option<usize>,
) -> Result<Vec<Input>, Error> {
Expand All @@ -345,11 +345,12 @@ fn generate_input(
context.insert(key, &value);
}

// todo: pass option, if none send just solvation
// if Some() pass solvent as well
if let Some(solvent) = solvent {
if let Some(solvation) = solvation {
context.insert("solvation", &true);
context.insert("solvent", &solvent);
match solvation {
Some(solvent) => context.insert("solvent", &solvent),
None => (),
}
}

if let Some(mult) = mult {
Expand Down
2 changes: 1 addition & 1 deletion templates/orca/opt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ end

%maxcore {{ memory }}

{% if solvent -%}
{% if solvation -%}
%cpcm
smd true
smdsolvent "{{ solvent }}"
Expand Down

0 comments on commit d580b1b

Please sign in to comment.