Package src :: Package factories :: Module ForceFactory :: Class ForceFactory
[hide private]
[frames] | no frames]

Class ForceFactory

source code

Instance Methods [hide private]
 
__init__(self)
Initializes mappings from boundary conditions (for bonded forces) and boundary conditions, algorithms and switching functions (for nonbonded forces) to SWIG-wrapped force object constructors (not instances, saving memory).
source code
Force
createBondForce(self, bc)
Return a bond force object.
source code
Force
createAngleForce(self, bc)
Return an angle force object.
source code
Force
createDihedralForce(self, bc)
Return a dihedral force object.
source code
Force
createImproperForce(self, bc)
Return an improper force object.
source code
Force
createHarmDihedralForce(self, bc, params)
Return a harmonic dihedral force object.
source code
Force
createLennardJonesForce(self, bc, params)
Return a van der Waals force object.
source code
Force
createCoulombDiElecForce(self, bc, params)
Return an coulomb dielectric force object (for implicit solvation).
source code
Force
createCoulombForce(self, bc, params)
Return an electrostatic force object.
source code
Force
createBornForce(self, bc, params)
Return an electrostatic force object.
source code
Force
createLennardJonesCoulombForce(self, bc, params)
Return a coupled van der Waals - electrostatic force evaluation object.
source code
 
switchingFunctions(self, params, number)
Little helper function, to take a set of parameters and obtain a specific number of switching functions, setting defaults as necessary (i.e.
source code
 
lookup(self, table, forcename, bc, alg, switch)
Helper function, looks up the passed boundary conditions, algorithm and switching function in the passed table.
source code
 
getParameter(self, params, name, defaultval=0)
Return a parameter value if it exists, otherwise return the passed default value.
source code
Force
applyParameters(self, newforce, bc, alg, switch, params, fastelectro=None)
Depending on the algorithm used, set parameter values for the passed force object.
source code
Instance Variables [hide private]
  bondForces
Mapping from boundary conditions to two-atom bond force object constructors
  angleForces
Mapping from boundary conditions to three-atom angle force object constructors
  dihedralForces
Mapping from boundary conditions to four-atom dihedral force object constructors
  improperForces
Mapping from boundary conditions to four-atom improper force object constructors
  harmDihedralForces
Mapping from boundary conditions to harmonic dihedral force object constructors
  hd
Number of harmonic dihedral forces
  ljForces
Maps boundary conditions, algorithm and switching function to van der Waals force object constructor
  cdeForces
Maps boundary conditions, algorithm and switching function to coulomb dielectric force object constructor - used for implicit solvation
  coulombForces
Maps boundary conditions, algorithm and switching function to electrostatic force object constructor.
  ljCoulombForces
Maps boundary conditions, algorithm and switching function pair to a unifed van der Waals and electrostatic force object constructor.
Method Details [hide private]

createBondForce(self, bc)

source code 

Return a bond force object.

Parameters:
  • bc (string) - Boundary conditions (Periodic or Vacuum)
Returns: Force
SWIG-wrapped bond force object.

createAngleForce(self, bc)

source code 

Return an angle force object.

Parameters:
  • bc (string) - Boundary conditions (Periodic or Vacuum)
Returns: Force
SWIG-wrapped angle force object.

createDihedralForce(self, bc)

source code 

Return a dihedral force object.

Parameters:
  • bc (string) - Boundary conditions (Periodic or Vacuum)
Returns: Force
SWIG-wrapped dihedral force object.

createImproperForce(self, bc)

source code 

Return an improper force object.

Parameters:
  • bc (string) - Boundary conditions (Periodic or Vacuum)
Returns: Force
SWIG-wrapped improper force object.

createHarmDihedralForce(self, bc, params)

source code 

Return a harmonic dihedral force object.

Parameters:
  • bc (string) - Boundary conditions (Periodic or Vacuum)
  • params (dict) - Mapping from parameter names to corresponding values.
Returns: Force
SWIG-wrapped harmonic dihedral force object.

createLennardJonesForce(self, bc, params)

source code 

Return a van der Waals force object.

Parameters:
  • bc (string) - Boundary conditions (Periodic or Vacuum)
  • params (dict) - Mapping from parameter names to corresponding values.
Returns: Force
SWIG-wrapped van der Waals force object.

createCoulombDiElecForce(self, bc, params)

source code 

Return an coulomb dielectric force object (for implicit solvation).

Parameters:
  • bc (string) - Boundary conditions (Periodic or Vacuum)
  • params (dict) - Mapping from parameter names to corresponding values.
Returns: Force
SWIG-wrapped coulomb dielectric force object.

createCoulombForce(self, bc, params)

source code 

Return an electrostatic force object.

Parameters:
  • bc (string) - Boundary conditions (Periodic or Vacuum)
  • params (dict) - Mapping from parameter names to corresponding values.
Returns: Force
SWIG-wrapped electrostatic force object.

createBornForce(self, bc, params)

source code 

Return an electrostatic force object.

Parameters:
  • bc (string) - Boundary conditions (Periodic or Vacuum)
  • params (dict) - Mapping from parameter names to corresponding values.
Returns: Force
SWIG-wrapped force object which computes Born Radii.

createLennardJonesCoulombForce(self, bc, params)

source code 

Return a coupled van der Waals - electrostatic force evaluation object. Saves performance by calculating atom pairs only once for both type of forces.

Parameters:
  • bc (string) - Boundary conditions (Periodic or Vacuum)
  • params (dict) - Mapping from parameter names to corresponding values.
Returns: Force
SWIG-wrapped coupled van der Waals and electrostatic force object.

switchingFunctions(self, params, number)

source code 

Little helper function, to take a set of parameters and obtain a specific number of switching functions, setting defaults as necessary (i.e. if no switching functions are provided, Universal is assumed)

Parameters:
  • params (dict) - Mapping from parameter names to values
  • number (int) - Number of switching functions to obtain

lookup(self, table, forcename, bc, alg, switch)

source code 

Helper function, looks up the passed boundary conditions, algorithm and switching function in the passed table. If it exists, return the corresponding force object instance. Otherwise, output a helpful error message for the user.

Parameters:
  • table (dict) - Mapping from parameters to force constructor.
  • forcename (string) - Name of force
  • bc (string) - Boundary conditions
  • alg (string) - Nonbonded calculation algorithm.
  • switch (string or tuple of strings) - Switching function(s).

getParameter(self, params, name, defaultval=0)

source code 

Return a parameter value if it exists, otherwise return the passed default value.

Parameters:
  • params (dict) - Mapping from parameter names to values
  • name (string) - Name of the parameter
  • defaultval ((any type)) - Default value for the parameter if it is not found

applyParameters(self, newforce, bc, alg, switch, params, fastelectro=None)

source code 

Depending on the algorithm used, set parameter values for the passed force object.

Parameters:
  • newforce (Force) - Pairwise force object
  • bc (string) - Boundary conditions (Periodic or Vacuum)
  • alg (string) - Algorithm for pairwise evaluation
  • switch (string) - Switching function
  • params (dict) - Mapping from parameter names to values
  • fastelectro (dict) - Mapping from fast electrostatic parameter names to values
Returns: Force
Pairwise force object with instantiated parameters.

Instance Variable Details [hide private]

ljCoulombForces

Maps boundary conditions, algorithm and switching function pair to a unifed van der Waals and electrostatic force object constructor. This saves performance by determining atom pairs just once for both types of pairwise forces.