예제 #1
0
    def test_check(self):
        '''Can we validate a system object?'''
        types = ['A', 'B', 'C']
        sys = pyPRISM.System(types)
        self.assertRaises(ValueError, sys.check)

        # These values make no sense but their sufficient
        # for this 'check'
        sys.domain = pyPRISM.Domain(dr=0.1, length=1024)
        sys.density[sys.types] = 1.0
        sys.diameter[sys.types] = 1.0
        sys.potential.setUnset(1.0)
        sys.closure.setUnset(1.0)
        sys.omega.setUnset(1.0)

        #test should fail if this raises
        try:
            sys.check()
        except ValueError:
            self.fail('Check failed when it should have passed...')
예제 #2
0
    def test_createPRISM(self):
        '''Can we construct a simple but fully specified PRISM problem?'''

        sys = pyPRISM.System(['A', 'B'])

        sys.domain = pyPRISM.Domain(dr=0.1, length=1024)

        sys.density['A'] = 0.45
        sys.density['B'] = 0.35

        sys.diameter[sys.types] = 1.0

        sys.closure.setUnset(pyPRISM.closure.PercusYevick())

        sys.potential.setUnset(pyPRISM.potential.HardSphere(sigma=1.0))

        sys.omega['A', 'A'] = pyPRISM.omega.SingleSite()
        sys.omega['A', 'B'] = pyPRISM.omega.NoIntra()
        sys.omega['B', 'B'] = pyPRISM.omega.Gaussian(sigma=1.0, length=100)

        PRISM = sys.createPRISM()

        self.assertIsInstance(PRISM, pyPRISM.core.PRISM.PRISM)
예제 #3
0
    def setup(self):
        '''Construct a simple but fully specified PRISM problem'''

        sys = pyPRISM.System(['A', 'B'])

        sys.domain = pyPRISM.Domain(dr=0.1, length=1024)

        sys.density['A'] = 0.1
        sys.density['B'] = 0.75

        sys.diameter[sys.types] = 1.0

        sys.closure.setUnset(pyPRISM.closure.PercusYevick())

        sys.potential.setUnset(pyPRISM.potential.HardSphere(sigma=1.0))

        sys.omega['A', 'A'] = pyPRISM.omega.SingleSite()
        sys.omega['A', 'B'] = pyPRISM.omega.NoIntra()
        sys.omega['B', 'B'] = pyPRISM.omega.Gaussian(sigma=1.0, length=10000)

        PRISM = sys.createPRISM()

        return PRISM
예제 #4
0
파일: AB.py 프로젝트: nsherck/PRISM
#sys.path.append(os.path.join(cwd,'pyPRISMpackage/pyPRISM'))
import pyPRISM
import pyPRISM
print(pyPRISM.__file__)

import numpy as np
import matplotlib.pyplot as plt
import scipy as sp

sigma = 1.
scale = 1
kbT = 1.
dr = 0.003
power = 14  # 2**power == # grid points; therefore length = dr*2**power

sys = pyPRISM.System(['A'], kT=kbT)
sys.domain = pyPRISM.Domain(dr=dr, length=2**power)
print('r =', sys.domain.r)
print('k = ', sys.domain.k)

sys.diameter['A'] = dr
sys.omega['A', 'A'] = pyPRISM.omega.SingleSite()


def cust_norm(_GammaIn, _GammaOut):
    _diff = np.subtract(_GammaOut, _GammaIn)
    _diff = np.sum(_diff**2)
    _diff = np.divide(_diff, np.sum(_GammaOut**2))
    return _diff

예제 #5
0
 def test_create(self):
     '''Can we create a system?'''
     types = ['A', 'B', 'C']
     sys = pyPRISM.System(types)