Skip to content

Commit

Permalink
chore(templates): make default parameters more clear, capitalize mole…
Browse files Browse the repository at this point in the history
…cule in input (#37)

* Modify default names for some configs

* Modify annotations to description in molecule struct

* Modify molecule reference in templates to Molecule(capitalized)
  • Loading branch information
caprilesport authored Jan 17, 2024
1 parent 140d1a4 commit 8c884ce
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 41 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ Let's walk through an example using `gedent` to generate an input file for optim
charge = 1
basis_set = "def2svp"
functional = "BP86"
dft_type = "GGA"
functional_class = "GGA"
memory = 3000
mult = 1
nprocs = 8
Expand Down
9 changes: 4 additions & 5 deletions gedent.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ default_extension = "inp"

[parameters]
charge = 1
dft_basis_set = "def2svp"
dft_level = "PB86"
dft_type = "GGA"
basis_set = "def2svp"
functional = "BP86"
functional_class = "GGA" #required by adf
memory = 3000
mult = 1
nprocs = 8
solvation = false
solvent = "water"
split_index = 10
start_hessian = true
xyz_file = "init.xyz"
start_hessian = false
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ fn generate_input(

for molecule in molecules {
let mut mol_context = context.clone();
mol_context.insert("molecule", &molecule);
mol_context.insert("Molecule", &molecule);
results.push(Input {
filename: PathBuf::from(molecule.filename).with_extension(extension),
content: template.render(&mol_context)?,
Expand Down
16 changes: 8 additions & 8 deletions src/molecule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ use std::path::PathBuf;
#[derive(PartialEq, Serialize, Deserialize, Debug, Clone)]
pub struct Molecule {
pub filename: String,
pub annotations: String,
pub description: String,
pub atoms: Vec<String>,
}

impl Molecule {
fn new() -> Molecule {
Molecule {
filename: "".to_string(),
annotations: "".to_string(),
description: "".to_string(),
atoms: Vec::new(),
}
}
Expand Down Expand Up @@ -85,7 +85,7 @@ impl Molecule {
}

natoms += xyz_lines.next().unwrap().parse::<usize>()?;
mol.annotations = xyz_lines.next().unwrap_or("").to_string();
mol.description = xyz_lines.next().unwrap_or("").to_string();
mol.atoms.clear();
} else {
mol.atoms.push(xyz_lines.next().unwrap().to_string());
Expand Down Expand Up @@ -131,7 +131,7 @@ H -1.537653553 -0.759337000 -2.285220893"

let ch4 = Molecule {
filename: "./ch4".to_string(),
annotations: "symmetry c1".to_string(),
description: "symmetry c1".to_string(),
atoms: vec![
"C -0.702728547 0.000000000 -1.996862306".to_string(),
"H -0.172294601 -0.951333822 -1.920672276".to_string(),
Expand All @@ -142,7 +142,7 @@ H -1.537653553 -0.759337000 -2.285220893"
};
let h2o = Molecule {
filename: "./ch4_h2o_1".to_string(),
annotations: "symmetry c1".to_string(),
description: "symmetry c1".to_string(),
atoms: vec![
"O -1.537653553 0.000000000 -2.881263893".to_string(),
"H -1.537653553 0.759337000 -2.285220893".to_string(),
Expand Down Expand Up @@ -170,7 +170,7 @@ H -1.537653553 -0.759337000 -2.285220893"
fn molecule_split_works() {
let ch4 = Molecule {
filename: "./ch4".to_string(),
annotations: "symmetry c1".to_string(),
description: "symmetry c1".to_string(),
atoms: vec![
"C -0.702728547 0.000000000 -1.996862306".to_string(),
"H -0.172294601 -0.951333822 -1.920672276".to_string(),
Expand All @@ -182,7 +182,7 @@ H -1.537653553 -0.759337000 -2.285220893"

let ch3 = Molecule {
filename: "./ch4_split_1".to_string(),
annotations: "symmetry c1".to_string(),
description: "symmetry c1".to_string(),
atoms: vec![
"C -0.702728547 0.000000000 -1.996862306".to_string(),
"H -0.172294601 -0.951333822 -1.920672276".to_string(),
Expand All @@ -192,7 +192,7 @@ H -1.537653553 -0.759337000 -2.285220893"
};
let h = Molecule {
filename: "./ch4_split_2".to_string(),
annotations: "symmetry c1".to_string(),
description: "symmetry c1".to_string(),
atoms: vec!["H -1.233162492 0.045629756 -2.950150766".to_string()],
};
match ch4.split(4) {
Expand Down
8 changes: 4 additions & 4 deletions templates/adf/eda
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ AMS_JOBNAME=eda $AMSBIN/ams <<eor
Task SinglePoint

Engine adf
title {{ molecule.filename }}
title {{ Molecule.filename }}

ETSNOCV
RHOKmin 1e-3
Expand All @@ -26,15 +26,15 @@ Engine adf
end

Basis
type {{ dft_basis_set }}
type {{ basis_set }}
CORE none
end

Symmetry NoSYM

XC
Dispersion Grimme3 BJDAMP
{{ dft_type }} {{ dft_level }}
{{ functional_class }} {{ functional }}
end

Beckegrid
Expand All @@ -46,7 +46,7 @@ Engine adf
frag2 {{ get_env(name="PWD") }}/frag2.results/adf.rkf
end
EndEngine
{% set molecules = split_molecule(molecule=molecule, index=split_index) -%}
{% set molecules = split_molecule(molecule=Molecule, index=split_index) -%}

System
atoms
Expand Down
10 changes: 5 additions & 5 deletions templates/adf/sp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
--@
extension = "run"
--@
AMS_JOBNAME={{ molecule.filename }} $AMSBIN/ams <<eor
AMS_JOBNAME={{ Molecule.filename }} $AMSBIN/ams <<eor

Task SinglePoint

Engine ADF
title {{ molecule.filename }}
title {{ Molecule.filename }}

BASIS
TYPE {{ dft_basis_set }}
TYPE {{ basis_set }}
CreateOutput yes
end

Expand All @@ -18,7 +18,7 @@ Engine ADF
end

XC
{{ dft_type }} {{ dft_level }}
{{ functional_class }} {{ functional }}
Dispersion Grimme3 BJDAMP
end

Expand All @@ -30,7 +30,7 @@ EndEngine

System
atoms
{{ print_molecule(molecule=molecule) }}
{{ print_molecule(molecule=Molecule) }}
end
Charge {{ charge }}
end
Expand Down
8 changes: 4 additions & 4 deletions templates/gaussian/nbo_del
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
--@
extension = "gjf"
--@
%chk={{ molecule.filename }}.chk
%chk={{ Molecule.filename }}.chk
%nproc={{ nprocs }}
%mem={{ memory }}GB
# {{ dft_level }}/{{ dft_basis_set }} pop=nbo6del nosymm
# {{ functional }}/{{ basis_set }} pop=nbo6del nosymm

job title: {{ molecule.filename }}
job title: {{ Molecule.filename }}

{{ charge }} {{mult}}
{{print_molecule(molecule=molecule)}}
{{print_molecule(molecule=Molecule)}}

$nbo $end
$del lewis $end
Expand Down
8 changes: 4 additions & 4 deletions templates/gaussian/opt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ extension = "gjf"
{%else-%}
{%set solvent=""-%}
{%endif-%}
%chk={{ molecule.filename }}.chk
%chk={{ Molecule.filename }}.chk
%nproc={{ nprocs }}
%mem={{ memory }}GB
# {{ dft_level }}/{{ dft_basis_set }} opt freq=noraman {{ solvent }}
# {{ functional }}/{{ basis_set }} opt freq=noraman {{ solvent }}

job title: {{ molecule.filename }}
job title: {{ Molecule.filename }}

{{ charge }} {{mult}}
{{print_molecule(molecule=molecule)}}
{{print_molecule(molecule=Molecule)}}

6 changes: 3 additions & 3 deletions templates/gaussian/sp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ extension = "gjf"
{%endif-%}
%nproc={{ nprocs }}
%mem={{ memory }}GB
# {{ dft_level }}/{{ dft_basis_set }} freq=noraman scrf=(smd,solvent=ethanol) temperature=353
# {{ functional }}/{{ basis_set }} freq=noraman scrf=(smd,solvent=ethanol) temperature=353

job title: {{ molecule.filename }}
job title: {{ Molecule.filename }}

{{ charge }} {{mult}}
{{print_molecule(molecule=molecule)}}
{{print_molecule(molecule=Molecule)}}

2 changes: 1 addition & 1 deletion templates/orca/neb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! {{ dft_level }} {{ dft_basis_set }}
! {{ functional }} {{ basis_set }}
! NEB-TS NumFreq IRC

*xyzfile {{ charge }} {{ mult }} {{ xyz_file }}
Expand Down
6 changes: 3 additions & 3 deletions templates/orca/opt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--@
extension = "inp"
--@
! {{ dft_level }} {{ dft_basis_set }}
! {{ functional }} {{ basis_set }}
! Opt freq D3BJ

%pal
Expand All @@ -21,11 +21,11 @@ end
{% if start_hessian -%}
%Geom
InHess Read
InHessName "{{ molecule.filename }}.hess"
InHessName "{{ Molecule.filename }}.hess"
end

{% endif -%}

*xyz {{ charge }} {{ mult }}
{{ print_molecule(molecule = molecule) }}
{{ print_molecule(molecule = Molecule) }}
*
4 changes: 2 additions & 2 deletions templates/orca/scan
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! {{ dft_level }} {{ dft_basis_set }}
! {{ functional }} {{ basis_set }}
! Opt

{% if solvation -%}
Expand All @@ -16,5 +16,5 @@ end
end

*xyz {{ charge }} {{ mult }}
{{ print_molecule(molecule="molecule") }}
{{ print_molecule(molecule="Molecule") }}
*

0 comments on commit 8c884ce

Please sign in to comment.