ZhouHUB / pyIID

Monte Carlo Based Diffraction Simulation
Other
1 stars 0 forks source link

ENH: Make energy constraints #55

Open CJ-Wright opened 8 years ago

CJ-Wright commented 8 years ago

Energy constraints of interest include:

Note that these constraints are different then PES components as they lack a gradient and thus can't be put into the HMC dynamics. However, these are tune able in their hardness; one could have a very high energy cost associated with violating any of these and they would essentially act as hard reject constraints or given them a low energy cost and the would be fairly soft.

CJ-Wright commented 8 years ago

BVS proposed args/doc

class BVS(object):
    def __init(self, energy_costs, ideal_bond_valence=None):
        """
        Setup the bond valence sum constraints
        Parameters
        ------------------
        energy_costs: float or function
            The cost for being anything other than the ideal bond valence. 
            If float then additional energy = np.sum(np.abs(ideal_bond_valence - 
            actual_bond_valence) * energy_cost). 
            If function, energy per atom  = np.sum(energy_costs(atoms, ideal_bond_valence)). 
            The function allows you to have functions other than linear for the cost, they could be quadratic or even asymmetrical biasing the system to over/under coordination.  Also by allowing the atoms through we can allow the valence to depend on all sorts of things, and even have the ideal BV change if for instance the atom moves to the surface.
        ideal_bond_valence: int or 1darray of ints
            The desired bond valence. If int then all atoms get same ideal BV, 
             else each atom gets it's own BV