From 15b055f3e33b7c5f5165161e444c9692d29810d7 Mon Sep 17 00:00:00 2001 From: Xavier Andrade Date: Tue, 9 Jul 2024 01:45:45 -0700 Subject: [PATCH] Add a subcommand to set the pseudopotential for a species. --- src/interface/species.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/interface/species.hpp b/src/interface/species.hpp index 52ee5be4..9e14d20b 100644 --- a/src/interface/species.hpp +++ b/src/interface/species.hpp @@ -117,6 +117,16 @@ These are the options available: Python example: `pinq.species.pseudo-set("He", "sg15")` +- Shell: `species file ` + Python: `species.file("symbol", "filename")` + + Sets the pseudopotential file that will be used for the species + given by . + + Shell example: `inq species Xe file Xe.upf` + Python example: `pinq.species.pseudo-set("Xe", "Xe.upf")` + + - Shell: `species mass ` Python: `species.pseudo_set("symbol", value)` @@ -212,6 +222,15 @@ These are the options available: ions.save(input::environment::global().comm(), ".inq/default_ions"); } + static void file(std::string symbol, std::string const & file) { + + symbol[0] = std::toupper(symbol[0]); + auto ions = systems::ions::load(".inq/default_ions"); + if(not ions.species_list().contains(symbol)) ions.species_list().insert(string_to_species(symbol)); + ions.species_list()[symbol].pseudo_file(file); + ions.save(input::environment::global().comm(), ".inq/default_ions"); + } + static void mass(std::string symbol, double const & mass_value) { symbol[0] = std::toupper(symbol[0]); @@ -271,6 +290,12 @@ These are the options available: actions::normal_exit(); } + if(args.size() == 3 and args[1] == "file") { + file(args[0], args[2]); + status(); + actions::normal_exit(); + } + if(args.size() == 3 and args[1] == "mass") { mass(args[0], str_to(args[2])); status();