Skip to content

Commit

Permalink
Changed the INQ interface so when a new perturbation is defined, it
Browse files Browse the repository at this point in the history
overwrites the previous one instead of being included in the list. The
previos behavior was confusing for users.
  • Loading branch information
xavierandrade committed Nov 16, 2024
1 parent 4c00ca4 commit 11ae9aa
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/interface/perturbations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ These are the uses for the command:
Python: `perturbations.status()`
Without any arguments (or with the status() function in Python),
`perturbations` prints a list of the perturbations that are
currently defined.
`perturbations` prints a the perturbations that are currently
defined.
Shell example: `inq perturbations`.
Python example: `pinq.perturbations.status()`
Expand All @@ -61,7 +61,7 @@ These are the uses for the command:
- Shell: `perturbations kick <px> <py> <pz>`
Python: `perturbations.kick([px, py, pz])`
Adds a kick perturbation. This corresponds of a uniform
Specifies a kick perturbation. This corresponds of a uniform
time-dependent electric field. The time profile is a delta function
at time 0. The direction and intensity of the field is given by the
values _px_, _py_ and _pz_ (these values are in cartesian units and
Expand Down Expand Up @@ -124,13 +124,15 @@ These are the uses for the command:

static void kick(vector3<double, cartesian> const & polarization) {
auto perturbations = perturbations::blend::load(".inq/default_perturbations");
perturbations.clear();
auto cell = systems::ions::load(".inq/default_ions").cell();
perturbations.add(perturbations::kick(cell, polarization));
perturbations.save(input::environment::global().comm(), ".inq/default_perturbations");
}

static void laser(vector3<double, cartesian> const & polarization, quantity<magnitude::energy> freq) {
auto perturbations = perturbations::blend::load(".inq/default_perturbations");
perturbations.clear();
auto cell = systems::ions::load(".inq/default_ions").cell();
if(cell.periodicity() == 0){
perturbations.add(perturbations::laser(polarization, freq, perturbations::gauge::length));
Expand Down

0 comments on commit 11ae9aa

Please sign in to comment.