Molecular grid weights API#

This section provides a reference for the GauXC API related to molecular grid weights, which can be applied to LoadBalancer tasks to modify their weights based on the molecular grid. The API includes C++ class definitions

C++ definitions#

class GauXC::MolecularWeights#

A class representing molecular grid weights in GauXC, which can be applied to a LoadBalancer’s tasks.

void modify_weights(LoadBalancer &lb)#

Apply molecular weights to a LoadBalancer’s tasks

Parameters:

lb – LoadBalancer instance to which the molecular grid weights will be applied.

class GauXC::MolecularWeightsFactory#

A factory class for creating MolecularWeights instances in GauXC.

MolecularWeightsFactory(ExecutionSpace ex, std::string local_work_kernel_name, MolecularWeightsSettings settings)#

Construct a MolecularWeightsFactory instance with the specified settings.

Parameters:
  • ex – The execution space for which to create molecular grid weights.

  • local_work_kernel_name – Name of the local work kernel to be used.

  • settings – A MolecularWeightsSettings struct containing settings for computing molecular grid weights.

Returns:

A MolecularWeightsFactory instance initialized with the specified settings.

MolecularWeights get_instance()#

Get a MolecularWeights instance created by the factory.

Returns:

A MolecularWeights instance created by the factory.

std::shared_ptr<MolecularWeights> get_shared_instance()#

Get a shared pointer to a MolecularWeights instance created by the factory.

Returns:

A shared pointer to a MolecularWeights instance created by the factory.

struct GauXC::MolecularWeightsSettings#

Struct representing settings for computing molecular grid weights in GauXC.

XCWeightAlg weight_alg = XCWeightAlg::Becke#

The algorithm to be used for computing molecular grid weights. Possible values are defined in the XCWeightAlg enum.

bool becke_size_adjustment#

Whether to apply Becke size adjustment to the molecular grid weights. Default should be true.

enum GauXC::XCWeightAlg#

The following options are available:

enumerator NOTPARTITIONED#

No partitioning.

enumerator Becke#

Becke’s original algorithm for computing molecular grid weights.

enumerator SSF#

Stratmann-Scuseria-Frisch algorithm for computing molecular grid weights.

enumerator LKO#

Lauqua-Kuessman-Ochsenfeld algorithm for computing molecular grid weights.

C bindings#

struct GauXCMolecularWeights#

Opaque struct representing molecular grid weights in the GauXC C API.

void gauxc_molecular_weights_modify_weights(GauXCStatus *status, GauXCMolecularWeights mw, LoadBalancer lb)#

Apply molecular weights to a LoadBalancer’s tasks

Parameters:
  • status – Pointer to a GauXCStatus struct where the status of the operation will be stored.

  • mw – GauXCMolecularWeights struct from which to get the molecular grid weight.

  • lb – LoadBalancer struct to which the molecular grid weights will be applied.

void gauxc_molecular_weights_delete(GauXCStatus *status, GauXCMolecularWeights *mw)#

Delete a molecular grid weights instance.

Parameters:
  • status – Pointer to a GauXCStatus struct where the status of the operation will be stored.

  • mw – Pointer to the GauXCMolecularWeights instance to be deleted.

struct GauXCMolecularWeightsFactory#

Opaque struct representing a factory for creating molecular grid weights in the GauXC C API.

GauXCMolecularWeightsFactory gauxc_molecular_weights_factory_new(GauXCStatus *status, GauXCMolecularWeightsSettings settings)#

Create a new GauXCMolecularWeightsFactory instance with the specified settings.

Parameters:
  • status – Pointer to a GauXCStatus struct where the status of the operation will be stored.

  • settings – GauXCMolecularWeightsSettings struct containing settings for computing molecular grid weights.

Returns:

A new GauXCMolecularWeightsFactory instance initialized with the specified settings.

GauXCMolecularWeights gauxc_molecular_weights_factory_get_instance(GauXCStatus *status, GauXCMolecularWeightsFactory mwf, enum GauXC_ExecutionSpace ex, char *local_work_kernel_name, GauXCMolecularWeightsSettings settings)#

Get a GauXCMolecularWeights instance created by the factory.

Parameters:
  • status – Pointer to a GauXCStatus struct where the status of the operation will be stored.

  • mwf – GauXCMolecularWeightsFactory struct from which to get the molecular grid weights instance.

  • local_work_kernel_name – Name of the local work kernel to be used.

  • settings – GauXCMolecularWeightsSettings struct containing settings for computing molecular grid weights.

Returns:

A GauXCMolecularWeights instance created by the factory.

void gauxc_molecular_weights_factory_delete(GauXCStatus *status, GauXCMolecularWeightsFactory *mwf)#

Delete a GauXCMolecularWeightsFactory instance.

Parameters:
  • status – Pointer to a GauXCStatus struct where the status of the operation will be stored.

  • mwf – Pointer to the GauXCMolecularWeightsFactory instance to be deleted.

struct GauXCMolecularWeightsSettings#

Representation of settings for computing molecular grid weights in the GauXC C API.

enum GauXC_XCWeightAlg weight_alg#

The algorithm to be used for computing molecular grid weights. Possible values are defined in the GauXC_XCWeightAlg enum.

bool becke_size_adjustment#

Whether to apply Becke size adjustment to the molecular grid weights. Default should be true.

enum GauXC_XCWeightAlg#

Enumeration of algorithms for computing molecular grid weights in the GauXC C API.

The following algorithms are available:

enumerator GauXC_XCWeightAlg_NOTPARTITIONED#

No partitioning.

enumerator GauXC_XCWeightAlg_Becke#

Becke’s original algorithm for computing molecular grid weights.

enumerator GauXC_XCWeightAlg_SSF#

Stratmann-Scuseria-Frisch algorithm for computing molecular grid weights.

enumerator GauXC_XCWeightAlg_LKO#

Lauqua-Kuessman-Ochsenfeld algorithm for computing molecular grid weights.

Fortran bindings#

type  gauxc_molecular_weights_type#

Opaque type representing molecular grid weights in the GauXC Fortran API. Available in the module gauxc_molecular_weights.

function  gauxc_molecular_weights_modify_weights(status, mw, lb)#

Apply molecular weights to a LoadBalancer’s tasks

Parameters:
  • status [type(gauxc_status_type)] :: Pointer to a GauXCStatus variable to store the status of the operation.

  • mw [type(gauxc_molecular_weights_type)] :: The molecular grid weights instance from which to get the molecular grid weight.

  • lb [type(gauxc_load_balancer_type)] :: The LoadBalancer instance to which the molecular grid weights will be applied.

function  gauxc_molecular_weights_delete(status, mw)#

Delete a molecular grid weights instance. Part of the gauxc_delete() interface.

Parameters:
  • status [type(gauxc_status_type)] :: Pointer to a GauXCStatus variable to store the status of the operation.

  • mw [type(gauxc_molecular_weights_type)] :: The molecular grid weights instance to be deleted.

type  gauxc_molecular_weights_factory_type#

Opaque type representing a factory for creating molecular grid weights in the GauXC Fortran API. Available in the module gauxc_molecular_weights.

function  gauxc_molecular_weights_factory_new(status, ex, local_work_kernel_name, settings)#

Create a new GauXCMolecularWeightsFactory instance with the specified settings.

Parameters:
  • status [type(gauxc_status_type)] :: Pointer to a GauXCStatus variable to store the status of the operation.

  • ex [integer(c_int)] :: The execution space for which to get the molecular grid weights instance. Possible values are defined in the gauxc_xc_weight_alg type.

  • local_work_kernel_name [character(len=*)] :: Name of the local work kernel to be used.

  • settings [type(gauxc_molecular_weights_settings_type)] :: The settings for computing molecular grid weights.

Return:

type (gauxc_molecular_weights_factory_type) :: A new GauXCMolecularWeightsFactory instance initialized with the specified settings.

function  gauxc_molecular_weights_factory_get_instance(status, mwf)#

Get a GauXCMolecularWeights instance created by the factory. Part of the gauxc_get_instance() interface.

Parameters:
  • status [type(gauxc_status_type)] :: Pointer to a GauXCStatus variable to store the status of the operation.

  • mwf [type(gauxc_molecular_weights_factory_type)] :: The GauXCMolecularWeightsFactory instance from which to get the molecular grid weights instance.

Return:

type (gauxc_molecular_weights_type) :: A GauXCMolecularWeights instance created by the factory.

function  gauxc_molecular_weights_factory_delete(status, mwf)#

Delete a GauXCMolecularWeightsFactory instance. Part of the gauxc_delete() interface.

Parameters:
  • status [type(gauxc_status_type)] :: Pointer to a GauXCStatus variable to store the status of the operation.

  • mwf [type(gauxc_molecular_weights_factory_type)] :: The GauXCMolecularWeightsFactory instance to be deleted.

Example#
use gauxc_enums, only : gauxc_executionspace
use gauxc_load_balancer, only : gauxc_load_balancer_type
use gauxc_molecular_weights, only : gauxc_molecular_weights_factory_type, gauxc_molecular_weights_factory_new, &
  & gauxc_get_instance, gauxc_molecular_weights_type, gauxc_molecular_weights_modify_weight, gauxc_delete

type(gauxc_load_balancer_type) :: lb
type(gauxc_status_type) :: status
type(gauxc_molecular_weights_factory_type) :: mwf
type(gauxc_molecular_weights_type) :: mw

! setup load balancer here

main: block
call gauxc_molecular_weights_factory_new(status, gauxc_executionspace%host, &
  & "Default", gauxc_molecular_weights_settings())
if (status%code /= 0) exit main
mw = gauxc_get_instance(status, mwf)
if (status%code /= 0) exit main
call gauxc_molecular_weights_modify_weight(status, mw, lb)
if (status%code /= 0) exit main
end block main
if (status%code /= 0) then
   ! handle error
end if

call gauxc_delete(status, mw)
call gauxc_delete(status, mwf)
type  gauxc_molecular_weights_settings#

Parameter instance of a derived type representing settings for computing molecular grid weights in the GauXC Fortran API. Available in the module gauxc_molecular_weights.

Type fields:
  • % weight_alg [integer(c_int)] :: The algorithm to be used for computing molecular grid weights. Possible values are defined in the gauxc_xc_weight_alg type.

  • % becke_size_adjustment [logical(c_bool)] :: Whether to apply Becke size adjustment to the molecular grid weights. Default should be true.

Example#
use gauxc_enums, only : gauxc_xcweightalg
use gauxc_molecular_weights, only : gauxc_molecular_weights_settings
type(gauxc_molecular_weights_settings) :: settings
settings%weight_alg = gauxc_xcweightalg%becke
settings%becke_size_adjustment = .true.
type  gauxc_xcweightalg#

Parameter instance of a derived type representing the algorithm to be used for computing molecular grid weights in the GauXC Fortran API. Available in the module gauxc_enums.

The following algorithms are available:

Type fields:
  • % notpartitioned [integer(c_int)] :: No partitioning.

  • % becke [integer(c_int)] :: Becke’s original algorithm for computing molecular grid weights.

  • % ssf [integer(c_int)] :: Stratmann-Scuseria-Frisch algorithm for computing molecular grid weights.

  • % lko [integer(c_int)] :: Lauqua-Kuessman-Ochsenfeld algorithm for computing molecular grid weights.