ForceBalance API  1.3
Automated optimization of force fields and empirical potentials
List of all members | Public Member Functions | Public Attributes
src.target.RemoteTarget Class Reference
Inheritance diagram for src.target.RemoteTarget:
[legend]
Collaboration diagram for src.target.RemoteTarget:
[legend]

Public Member Functions

def __init__ (self, options, tgt_opts, forcefield)
 
def submit_jobs (self, mvals, AGrad=False, AHess=False)
 
def read (self, mvals, AGrad=False, AHess=False)
 
def get (self, mvals, AGrad=False, AHess=False)
 
def indicate (self)
 
def get_X (self, mvals=None, customdir=None)
 Computes the objective function contribution without any parametric derivatives. More...
 
def read_0grads (self)
 Read a file from the target directory containing names of parameters that don't contribute to the gradient. More...
 
def write_0grads (self, Ans)
 Write a file to the target directory containing names of parameters that don't contribute to the gradient. More...
 
def get_G (self, mvals=None, customdir=None)
 Computes the objective function contribution and its gradient. More...
 
def get_H (self, mvals=None, customdir=None)
 Computes the objective function contribution and its gradient / Hessian. More...
 
def link_from_tempdir (self, absdestdir)
 
def refresh_temp_directory (self)
 Back up the temporary directory if desired, delete it and then create a new one. More...
 
def check_files (self, there)
 Check this directory for the presence of readable files when the 'read' option is set. More...
 
def absrd (self, inum=None)
 Supply the correct directory specified by user's "read" option. More...
 
def maxrd (self)
 Supply the latest existing temp-directory containing valid data. More...
 
def maxid (self)
 Supply the latest existing temp-directory. More...
 
def meta_indicate (self, customdir=None)
 Wrap around the indicate function, so it can print to screen and also to a file. More...
 
def meta_get (self, mvals, AGrad=False, AHess=False, customdir=None)
 Wrapper around the get function. More...
 
def stage (self, mvals, AGrad=False, AHess=False, customdir=None, firstIteration=False)
 Stages the directory for the target, and then launches Work Queue processes if any. More...
 
def wq_complete (self)
 This method determines whether the Work Queue tasks for the current target have completed. More...
 
def printcool_table (self, data=OrderedDict([]), headings=[], banner=None, footnote=None, color=0)
 Print target information in an organized table format. More...
 
def serialize_ff (self, mvals, outside=None)
 This code writes a force field pickle file to an folder in "job.tmp/dnm/forcebalance.p", because it takes time to compress and most targets can simply reuse this file. More...
 

Public Attributes

 r_options
 
 r_tgt_opts
 
 remote_indicate
 
 read_indicate
 
 write_indicate
 
 write_objective
 
 rd
 Root directory of the whole project. More...
 
 pgrad
 Iteration where we turn on zero-gradient skipping. More...
 
 tempbase
 Relative directory of target. More...
 
 tempdir
 
 rundir
 self.tempdir = os.path.join('temp',self.name) The directory in which the simulation is running - this can be updated. More...
 
 FF
 Need the forcefield (here for now) More...
 
 xct
 mol2 files that are stored in the forcefield folder need to be included in the list of mol2 files for the target More...
 
 gct
 Counts how often the gradient was computed. More...
 
 hct
 Counts how often the Hessian was computed. More...
 
 read_objective
 Whether to read objective.p from file when restarting an aborted run. More...
 
 evaluated
 Create a new temp directory. More...
 
 goodstep
 This flag specifies whether the previous optimization step was good. More...
 
 ffpd
 

Detailed Description

Definition at line 778 of file target.py.

Constructor & Destructor Documentation

◆ __init__()

def src.target.RemoteTarget.__init__ (   self,
  options,
  tgt_opts,
  forcefield 
)

Definition at line 779 of file target.py.

Member Function Documentation

◆ absrd()

def src.target.Target.absrd (   self,
  inum = None 
)
inherited

Supply the correct directory specified by user's "read" option.

Definition at line 434 of file target.py.

Here is the call graph for this function:

◆ check_files()

def src.target.Target.check_files (   self,
  there 
)
inherited

Check this directory for the presence of readable files when the 'read' option is set.

Definition at line 406 of file target.py.

◆ get()

def src.target.RemoteTarget.get (   self,
  mvals,
  AGrad = False,
  AHess = False 
)

Definition at line 842 of file target.py.

Here is the call graph for this function:

◆ get_G()

def src.target.Target.get_G (   self,
  mvals = None,
  customdir = None 
)
inherited

Computes the objective function contribution and its gradient.

First the low-level 'get' method is called with the analytic gradient switch turned on. Then we loop through the fd1_pids and compute the corresponding elements of the gradient by finite difference, if the 'fdgrad' switch is turned on. Alternately we can compute the gradient elements and diagonal Hessian elements at the same time using central difference if 'fdhessdiag' is turned on.

In this function we also record which parameters cause a nonzero change in the objective function contribution. Parameters which do not change the objective function will not be differentiated in subsequent calculations. This is recorded in a text file in the targets directory.

Definition at line 301 of file target.py.

Here is the call graph for this function:

◆ get_H()

def src.target.Target.get_H (   self,
  mvals = None,
  customdir = None 
)
inherited

Computes the objective function contribution and its gradient / Hessian.

First the low-level 'get' method is called with the analytic gradient and Hessian both turned on. Then we loop through the fd1_pids and compute the corresponding elements of the gradient by finite difference, if the 'fdgrad' switch is turned on.

This is followed by looping through the fd2_pids and computing the corresponding Hessian elements by finite difference. Forward finite difference is used throughout for the sake of speed.

Definition at line 326 of file target.py.

Here is the call graph for this function:

◆ get_X()

def src.target.Target.get_X (   self,
  mvals = None,
  customdir = None 
)
inherited

Computes the objective function contribution without any parametric derivatives.

Definition at line 203 of file target.py.

Here is the call graph for this function:

◆ indicate()

def src.target.RemoteTarget.indicate (   self)

Definition at line 849 of file target.py.

◆ link_from_tempdir()

def src.target.Target.link_from_tempdir (   self,
  absdestdir 
)
inherited

Definition at line 346 of file target.py.

Here is the call graph for this function:

◆ maxid()

def src.target.Target.maxid (   self)
inherited

Supply the latest existing temp-directory.

Definition at line 509 of file target.py.

◆ maxrd()

def src.target.Target.maxrd (   self)
inherited

Supply the latest existing temp-directory containing valid data.

Definition at line 494 of file target.py.

Here is the call graph for this function:

◆ meta_get()

def src.target.Target.meta_get (   self,
  mvals,
  AGrad = False,
  AHess = False,
  customdir = None 
)
inherited

Wrapper around the get function.

Create the directory for the target, and then calls 'get'. If we are reading existing data, go into the appropriate read directory and call read() instead. The 'get' method should not worry about the directory that it's running in.

Definition at line 570 of file target.py.

Here is the call graph for this function:

◆ meta_indicate()

def src.target.Target.meta_indicate (   self,
  customdir = None 
)
inherited

Wrap around the indicate function, so it can print to screen and also to a file.

If reading from checkpoint file, don't call the indicate() function, instead just print the file contents to the screen.

Definition at line 526 of file target.py.

Here is the call graph for this function:

◆ printcool_table()

def src.target.Target.printcool_table (   self,
  data = OrderedDict([]),
  headings = [],
  banner = None,
  footnote = None,
  color = 0 
)
inherited

Print target information in an organized table format.

Implemented 6/30 because multiple targets are already printing out tabulated information in very similar ways. This method is a simple wrapper around printcool_dictionary.

The input should be something like:

Parameters
dataColumn contents in the form of an OrderedDict, with string keys and list vals. The key is printed in the leftmost column and the vals are printed in the other columns. If non-strings are passed, they will be converted to strings (not recommended).
headingsColumn headings in the form of a list. It must be equal to the number to the list length for each of the "vals" in OrderedDict, plus one. Use "\n" characters to specify long column names that may take up more than one line.
bannerOptional heading line, which will be printed at the top in the title.
footnoteOptional footnote line, which will be printed at the bottom.

Definition at line 701 of file target.py.

Here is the call graph for this function:

◆ read()

def src.target.RemoteTarget.read (   self,
  mvals,
  AGrad = False,
  AHess = False 
)

Definition at line 839 of file target.py.

Here is the call graph for this function:

◆ read_0grads()

def src.target.Target.read_0grads (   self)
inherited

Read a file from the target directory containing names of parameters that don't contribute to the gradient.

Note that we are checking the derivatives of the objective function, and not the derivatives of the quantities that go into building the objective function. However, it is the quantities that we actually differentiate. Since there is a simple chain rule relationship, the parameters that do/don't contribute to the objective function/quantities are the same.

However, property gradients do contribute to objective function Hessian elements, so we cannot use the same mechanism for excluding the calculation of property Hessians. This is mostly fine since we rarely if ever calculate an explicit property Hessian.

Definition at line 226 of file target.py.

◆ refresh_temp_directory()

def src.target.Target.refresh_temp_directory (   self)
inherited

Back up the temporary directory if desired, delete it and then create a new one.

Definition at line 352 of file target.py.

Here is the call graph for this function:

◆ serialize_ff()

def src.target.Target.serialize_ff (   self,
  mvals,
  outside = None 
)
inherited

This code writes a force field pickle file to an folder in "job.tmp/dnm/forcebalance.p", because it takes time to compress and most targets can simply reuse this file.

Inputs: mvals = Mathematical parameter values outside = Write this file outside the targets directory

Definition at line 755 of file target.py.

◆ stage()

def src.target.Target.stage (   self,
  mvals,
  AGrad = False,
  AHess = False,
  customdir = None,
  firstIteration = False 
)
inherited

Stages the directory for the target, and then launches Work Queue processes if any.

The 'get' method should not worry about the directory that it's running in.

Definition at line 625 of file target.py.

Here is the call graph for this function:

◆ submit_jobs()

def src.target.RemoteTarget.submit_jobs (   self,
  mvals,
  AGrad = False,
  AHess = False 
)

Definition at line 806 of file target.py.

Here is the call graph for this function:

◆ wq_complete()

def src.target.Target.wq_complete (   self)
inherited

This method determines whether the Work Queue tasks for the current target have completed.

Definition at line 665 of file target.py.

Here is the call graph for this function:

◆ write_0grads()

def src.target.Target.write_0grads (   self,
  Ans 
)
inherited

Write a file to the target directory containing names of parameters that don't contribute to the gradient.

Definition at line 254 of file target.py.

Member Data Documentation

◆ evaluated

src.target.Target.evaluated
inherited

Create a new temp directory.

This flag specifies whether the target has been evaluated yet.

Definition at line 197 of file target.py.

◆ FF

src.target.Target.FF
inherited

Need the forcefield (here for now)

Definition at line 168 of file target.py.

◆ ffpd

src.target.Target.ffpd
inherited

Definition at line 758 of file target.py.

◆ gct

src.target.Target.gct
inherited

Counts how often the gradient was computed.

Definition at line 179 of file target.py.

◆ goodstep

src.target.Target.goodstep
inherited

This flag specifies whether the previous optimization step was good.

Definition at line 199 of file target.py.

◆ hct

src.target.Target.hct
inherited

Counts how often the Hessian was computed.

Definition at line 181 of file target.py.

◆ pgrad

src.target.Target.pgrad
inherited

Iteration where we turn on zero-gradient skipping.

Gradient norm below which we skip. Dictionary of whether to call the derivatives.

Definition at line 134 of file target.py.

◆ r_options

src.target.RemoteTarget.r_options

Definition at line 782 of file target.py.

◆ r_tgt_opts

src.target.RemoteTarget.r_tgt_opts

Definition at line 787 of file target.py.

◆ rd

src.target.Target.rd
inherited

Root directory of the whole project.

Name of the target Type of target Relative weight of the target Switch for finite difference gradients Switch for finite difference Hessians Switch for FD gradients + Hessian diagonals How many seconds to sleep (if any) Parameter types that trigger FD gradient elements Parameter types that trigger FD Hessian elements Finite difference step size Whether to make backup files Directory to read data from.

Definition at line 128 of file target.py.

◆ read_indicate

src.target.RemoteTarget.read_indicate

Definition at line 802 of file target.py.

◆ read_objective

src.target.Target.read_objective
inherited

Whether to read objective.p from file when restarting an aborted run.

Definition at line 187 of file target.py.

◆ remote_indicate

src.target.RemoteTarget.remote_indicate

Definition at line 794 of file target.py.

◆ rundir

src.target.Target.rundir
inherited

self.tempdir = os.path.join('temp',self.name) The directory in which the simulation is running - this can be updated.

Directory of the current iteration; if not None, then the simulation runs under temp/target_name/iteration_number The 'customdir' is customizable and can go below anything.

Not expecting more than ten thousand iterations Go into the directory where get() will be executed. Write mathematical parameters to file; will be used to checkpoint calculation. Read in file that specifies which derivatives may be skipped.

Definition at line 166 of file target.py.

◆ tempbase

src.target.Target.tempbase
inherited

Relative directory of target.

Temporary (working) directory; it is temp/(target_name) Used for storing temporary variables that don't change through the course of the optimization

Definition at line 160 of file target.py.

◆ tempdir

src.target.Target.tempdir
inherited

Definition at line 163 of file target.py.

◆ write_indicate

src.target.RemoteTarget.write_indicate

Definition at line 803 of file target.py.

◆ write_objective

src.target.RemoteTarget.write_objective

Definition at line 804 of file target.py.

◆ xct

src.target.Target.xct
inherited

mol2 files that are stored in the forcefield folder need to be included in the list of mol2 files for the target

Counts how often the objective function was computed

Definition at line 177 of file target.py.


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