abics.applications.latgas_abinitio_interface.run_base_mpi module

class abics.applications.latgas_abinitio_interface.run_base_mpi.run_mpispawn(path_to_solver, nprocs, nthreads, comm)[source]

Bases: object

Invoker via mpi_comm_spawn

path_to_solver

Path to solver program

Type

str

nprocs

Number of process which one solver uses

Type

int

nthreads

Number of threads which one solver process uses

Type

int

comm

MPI Communicator

Type

MPI.Comm

commsize

Size of comm

Type

int

commrank

My rank in comm

Type

int

worldrank

My rank in MPI.COMM_WORLD

Type

int

Parameters
  • path_to_solver (str) – Path to solver program

  • nprocs (int) – Number of process which one solver uses

  • nthreads (int) – Number of threads which one solver process uses

  • comm (MPI.Comm) – MPI Communicator

__init__(path_to_solver, nprocs, nthreads, comm)[source]
Parameters
  • path_to_solver (str) – Path to solver program

  • nprocs (int) – Number of process which one solver uses

  • nthreads (int) – Number of threads which one solver process uses

  • comm (MPI.Comm) – MPI Communicator

submit(solver_name, solverinput, output_dir, rerun=2)[source]

Run solver

Parameters
  • solver_name (str) – Name of solver (e.g., VASP)

  • solverinput (Solver.Input) – Input manager

  • output_dir (str) – Path to directory where a solver saves output

  • rerun (int, default = 2) – How many times to restart solver on failed

Returns

status – Always returns 0

Return type

int

class abics.applications.latgas_abinitio_interface.run_base_mpi.run_mpispawn_ready(path_to_spawn_ready_solver, nprocs, nthreads, comm)[source]

Bases: object

Invoker via mpi_comm_spawn for solvers which is MPI_Comm_spawn-ready

path_to_solver

Path to solver program

Type

str

nprocs

Number of process which one solver uses

Type

int

nthreads

Number of threads which one solver process uses

Type

int

comm

MPI Communicator

Type

MPI.Comm

commsize

Size of comm

Type

int

commrank

My rank in comm

Type

int

worldrank

My rank in MPI.COMM_WORLD

Type

int

Parameters
  • path_to_solver (str) – Path to solver program

  • nprocs (int) – Number of process which one solver uses

  • nthreads (int) – Number of threads which one solver process uses

  • comm (MPI.Comm) – MPI Communicator

__init__(path_to_spawn_ready_solver, nprocs, nthreads, comm)[source]
Parameters
  • path_to_solver (str) – Path to solver program

  • nprocs (int) – Number of process which one solver uses

  • nthreads (int) – Number of threads which one solver process uses

  • comm (MPI.Comm) – MPI Communicator

submit(solver_name, solverinput, output_dir, rerun=2)[source]

Run solver

Parameters
  • solver_name (str) – Name of solver (e.g., VASP)

  • solverinput (Solver.Input) – Input manager

  • output_dir (str) – Path to directory where a solver saves output

  • rerun (int, default = 2) – How many times to restart solver on failed

Returns

status – Always returns 0

Return type

int

Notes

If a solver failed (returned nonzero), this calls MPI_Abort on MPI_COMM_WORLD .

class abics.applications.latgas_abinitio_interface.run_base_mpi.run_mpispawn_wrapper(path_to_solver, nprocs, nthreads, comm)[source]

Bases: object

Invoker via mpi_comm_spawn

path_to_solver

Path to solver program

Type

str

nprocs

Number of process which one solver uses

Type

int

nthreads

Number of threads which one solver process uses

Type

int

comm

MPI Communicator

Type

MPI.Comm

commsize

Size of comm

Type

int

commrank

My rank in comm

Type

int

worldrank

My rank in MPI.COMM_WORLD

Type

int

Parameters
  • path_to_solver (str) – Path to solver program

  • nprocs (int) – Number of process which one solver uses

  • nthreads (int) – Number of threads which one solver process uses

  • comm (MPI.Comm) – MPI Communicator

__init__(path_to_solver, nprocs, nthreads, comm)[source]
Parameters
  • path_to_solver (str) – Path to solver program

  • nprocs (int) – Number of process which one solver uses

  • nthreads (int) – Number of threads which one solver process uses

  • comm (MPI.Comm) – MPI Communicator

submit(solver_name, solverinput, output_dir, rerun=2)[source]

Run solver

Parameters
  • solver_name (str) – Name of solver (e.g., VASP)

  • solverinput (Solver.Input) – Input manager

  • output_dir (str) – Path to directory where a solver saves output

  • rerun (int, default = 2) – How many times to restart solver on failed

Returns

status – Always returns 0

Return type

int

class abics.applications.latgas_abinitio_interface.run_base_mpi.run_subprocess(path_to_solver, nprocs, nthreads, comm)[source]

Bases: object

Invoker via subprocess

path_to_solver

Path to solver program

Type

str

nprocs

Number of process which one solver uses

Type

int

nthreads

Number of threads which one solver process uses

Type

int

Parameters
  • path_to_solver (str) – Path to solver program

  • nprocs (int) – Number of process which one solver uses

  • nthreads (int) – Number of threads which one solver process uses

  • comm (MPI.Comm or NoneType) – Never used

__init__(path_to_solver, nprocs, nthreads, comm)[source]
Parameters
  • path_to_solver (str) – Path to solver program

  • nprocs (int) – Number of process which one solver uses

  • nthreads (int) – Number of threads which one solver process uses

  • comm (MPI.Comm or NoneType) – Never used

submit(solver_name, solverinput, output_dir, rerun=0)[source]

Run solver

Parameters
  • solver_name (str) – Name of solver (e.g., VASP)

  • solverinput (Solver.Input) – Input manager

  • output_dir (str) – Path to directory where a solver saves output

  • rerun (int, default = 2) – How many times to restart solver on failed

Returns

status – Always returns 0

Return type

int

Raises

RuntimeError – Raises RuntimeError when solver failed.

class abics.applications.latgas_abinitio_interface.run_base_mpi.runner(base_input_dir, Solver, nprocs_per_solver, comm, perturb=0, nthreads_per_proc=1, solver_run_scheme='mpi_spawn_ready')[source]

Bases: object

Base class of runner (manager) of external solver program

solver_name

Name of solver program

Type

str

path_to_solver

Path to solver program

Type

str

run

Runner object

Type

Any

nprocs_per_solver

Number of processes which solver program uses

Type

int

nthreads_per_proc

Number of threads which a solver process uses

Type

int

comm

MPI Communicator

Type

MPI.Comm

perturb

perturbation of atom position for structure optimization

Type

float

base_solver_input

Input manager

Type

Solver.Input

output

Output manager

Type

Solver.Output

Parameters
  • base_input_dir (str) – Path to the directory including input file templates

  • Solver (SolverBase) – Solver

  • nprocs_per_solver (int) – Number of processes which one solver program uses

  • comm (MPI.Comm) – MPI Communicator

  • perturb (float, default 0.0) – Perturbation of atom position

  • nthreads_per_proc (int, default 1) – Number of threads which one solver process uses

  • solver_run_scheme (str, default "mpi_spawn_ready") – Scheme how to invoke a solver program

Raises

ValueError – Raises ValueError if unknown solver_run_scheme is passed

__init__(base_input_dir, Solver, nprocs_per_solver, comm, perturb=0, nthreads_per_proc=1, solver_run_scheme='mpi_spawn_ready')[source]
Parameters
  • base_input_dir (str) – Path to the directory including input file templates

  • Solver (SolverBase) – Solver

  • nprocs_per_solver (int) – Number of processes which one solver program uses

  • comm (MPI.Comm) – MPI Communicator

  • perturb (float, default 0.0) – Perturbation of atom position

  • nthreads_per_proc (int, default 1) – Number of threads which one solver process uses

  • solver_run_scheme (str, default "mpi_spawn_ready") – Scheme how to invoke a solver program

Raises

ValueError – Raises ValueError if unknown solver_run_scheme is passed

submit(structure, output_dir)[source]

Run a solver program and return results

Parameters
  • structure (pymatgen.Structure) – Structure of compounds

  • output_dir (str) – Name of directory where solver program saves output files

Returns

  • energy (float) – Total energy

  • structure (pymatgen.Structure) – Structure of compounds after optimization

class abics.applications.latgas_abinitio_interface.run_base_mpi.runner_multistep(base_input_dirs, Solver, runner, nprocs_per_solver, comm, perturb=0, nthreads_per_proc=1, solver_run_scheme='mpi_spawn_ready')[source]

Bases: object

Sequential runner

runners

Runners

Type

list[runner]

Parameters
  • base_input_dirs (list[str]) – List of paths to directories including base input files

  • Solver (SolverBase) – Solver

  • nprocs_per_solver (int) – Number of processes which one solver program uses

  • comm (MPI.Comm) – MPI Communicator

  • perturb (float, default 0.0) – Perturbation of atom position

  • nthreads_per_proc (int, default 1) – Number of threads which one solver process uses

  • solver_run_scheme (str, default "mpi_spawn_ready") – Scheme how to invoke a solver program

__init__(base_input_dirs, Solver, runner, nprocs_per_solver, comm, perturb=0, nthreads_per_proc=1, solver_run_scheme='mpi_spawn_ready')[source]
Parameters
  • base_input_dirs (list[str]) – List of paths to directories including base input files

  • Solver (SolverBase) – Solver

  • nprocs_per_solver (int) – Number of processes which one solver program uses

  • comm (MPI.Comm) – MPI Communicator

  • perturb (float, default 0.0) – Perturbation of atom position

  • nthreads_per_proc (int, default 1) – Number of threads which one solver process uses

  • solver_run_scheme (str, default "mpi_spawn_ready") – Scheme how to invoke a solver program

submit(structure, output_dir)[source]