ForceBalance API  1.3
Automated optimization of force fields and empirical potentials
List of all members | Public Member Functions | Public Attributes
src.counterpoise.Counterpoise Class Reference

Target subclass for matching the counterpoise correction. More...

Inheritance diagram for src.counterpoise.Counterpoise:
[legend]
Collaboration diagram for src.counterpoise.Counterpoise:
[legend]

Public Member Functions

def __init__ (self, options, tgt_opts, forcefield)
 To instantiate Counterpoise, we read the coordinates and counterpoise data. More...
 
def loadxyz (self, fnm)
 Parse an XYZ file which contains several xyz coordinates, and return their elements. More...
 
def load_cp (self, fnm)
 Load in the counterpoise data, which is easy; the file consists of floating point numbers separated by newlines. More...
 
def get (self, mvals, AGrad=False, AHess=False)
 Gets the objective function for fitting the counterpoise correction. More...
 

Public Attributes

 loop_over_snapshots
 Number of snapshots. More...
 
 xyzs
 XYZ elements and coordinates. More...
 
 cpqm
 Counterpoise correction data. More...
 
 na
 Number of atoms. More...
 
 ns
 

Detailed Description

Target subclass for matching the counterpoise correction.

Definition at line 36 of file counterpoise.py.

Constructor & Destructor Documentation

◆ __init__()

def src.counterpoise.Counterpoise.__init__ (   self,
  options,
  tgt_opts,
  forcefield 
)

To instantiate Counterpoise, we read the coordinates and counterpoise data.

Definition at line 40 of file counterpoise.py.

Here is the call graph for this function:

Member Function Documentation

◆ get()

def src.counterpoise.Counterpoise.get (   self,
  mvals,
  AGrad = False,
  AHess = False 
)

Gets the objective function for fitting the counterpoise correction.

As opposed to AbInitio_GMXX2, which calls an external program, this script actually computes the empirical interaction given the force field parameters.

It loops through the snapshots and atom pairs, and computes pairwise contributions to an energy term according to hard-coded functional forms.

One potential issue is that we go through all atom pairs instead of looking only at atom pairs between different fragments. This means that even for two infinitely separated fragments it will predict a finite CP correction. While it might be okay to apply such a potential in practice, there will be some issues for the fitting. Thus, we assume the last snapshot to be CP-free and subtract that value of the potential back out.

Note that forces and parametric derivatives are not implemented.

Parameters
[in]mvalsMathematical parameter values
[in]AGradSwitch to turn on analytic gradient (not implemented)
[in]AHessSwitch to turn on analytic Hessian (not implemented)
Returns
Answer Contribution to the objective function

Definition at line 130 of file counterpoise.py.

Here is the call graph for this function:

◆ load_cp()

def src.counterpoise.Counterpoise.load_cp (   self,
  fnm 
)

Load in the counterpoise data, which is easy; the file consists of floating point numbers separated by newlines.

Definition at line 101 of file counterpoise.py.

◆ loadxyz()

def src.counterpoise.Counterpoise.loadxyz (   self,
  fnm 
)

Parse an XYZ file which contains several xyz coordinates, and return their elements.

Parameters
[in]fnmThe input XYZ file name
Returns
elem A list of chemical elements in the XYZ file
xyzs A list of XYZ coordinates (number of snapshots times number of atoms)
Todo:
I should probably put this into a more general library for reading coordinates.

Definition at line 69 of file counterpoise.py.

Member Data Documentation

◆ cpqm

src.counterpoise.Counterpoise.cpqm

Counterpoise correction data.

Definition at line 59 of file counterpoise.py.

◆ loop_over_snapshots

src.counterpoise.Counterpoise.loop_over_snapshots

Number of snapshots.

LPW 2018-02-11: This is set to True if the target calculates a single-point property over several existing snapshots.

Definition at line 55 of file counterpoise.py.

◆ na

src.counterpoise.Counterpoise.na

Number of atoms.

Definition at line 82 of file counterpoise.py.

◆ ns

src.counterpoise.Counterpoise.ns

Definition at line 95 of file counterpoise.py.

◆ xyzs

src.counterpoise.Counterpoise.xyzs

XYZ elements and coordinates.

Definition at line 57 of file counterpoise.py.


The documentation for this class was generated from the following file: