예제 #1
0
  pl.plot(alpha_min, f_alpha_min, 'o', color='red')
  pl.show()
    

if __name__ == '__main__':
  
  solver = ScipyAndersonOZsolver(port = 0)
  #solver = ScipyNewtonKrylovOZsolver(port = 0)
  #We only work with LJ or Yukawa potential since we want to avoid the trouble
  #related to the 'jump' (discontinuity) at r = sigma
  
  doLennardJonesExample = False
  
  if doLennardJonesExample:
      #LJ possible but with HMSA
      solver.setPotentialByName('LennardJones', 0.1) #epsilon/kT = 0.1 is default in SASfit
      print "Energy scale of Lennard Jones Potential in kT units:", solver.getEpsilonInkTUnits()
      #Initialize HMSA with some (random) start alpha
      solver.doHMSAclosure(1.0)
  
  else:
      #Yukawa possible with RY: With negative K (attractive besides HS) convergence may be reached for exp shift only (real HS-Yukawa)
      #positive (repulsive as HS) K converges for fully shifted potential (1/r included)
      solver.setPotentialByName('Yukawa', 1.0, -1.0, True) #lamda in SASfit is different; K = 0.1 is default in SASfit
      print "Energy scale of Yukawa HS Potential in kT units:", solver.getInteractionStrengthInKTunits()
      print "Length scale of Yukawa HS Potential in sigma units:", solver.getShieldingConstantInSigmaUnits()
      #Initialize RY with some (random) start alpha
      solver.doRYclosure(1.0)

  
  solver.setVolumeDensity(0.3)
예제 #2
0
from andersonOZsolver import AndersonOZsolver
from scipyAndersonOZsolver import ScipyAndersonOZsolver
from scipyNewtonKrylovOZsolver import ScipyNewtonKrylovOZsolver

if __name__ == '__main__':
  
  #Instantiate solver class (Picard iteration, etc.)
  #For star potential, ScipyAndersonOZsolver gives best result
  #s = PicardOZsolver(port = 0)
  #s = AndersonOZsolver(port = 0)
  s = ScipyAndersonOZsolver(port = 0)
  #s = ScipyNewtonKrylovOZsolver(port = 0)
  s.printPotentialSetterArguments()
  #s.setPotentialByName('HardSphere')
  #s.setPotentialByName('LennardJones', 0.2)
  s.setPotentialByName('Star', 20)
  
  #Define the density range to scan
  densityRange = np.arange(0.3, 0.4, 0.1)
  #densityRange = np.asarray([0.3])
  #densityRange = np.asarray([0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5])
  

  densityRDFdictionary = {}
  
  #Start loop over densities and measure wall clock time
  t_start = time.time()
  
  for d in densityRange:
      s.setVolumeDensity(float(d))
      s.solve()
예제 #3
0
that a zero start value may be better than the previous.
'''
import numpy as np

#Solver
from scipyAndersonOZsolver import ScipyAndersonOZsolver

#plot
import matplotlib.pyplot as plt
import pylab as pl

if __name__ == '__main__':
  

  solver = ScipyAndersonOZsolver(port = 0)
  solver.setPotentialByName('HardSphere')
  #solver.setNumberOfIterations(10*solver.getNumberOfIterations())
  #Relaxing ConvergenceCriterion by a factor 1000
  solver.setConvergenceCriterion(1.0e3*solver.getConvergenceCriterion())
  #solver.setPotentialByName('LennardJones', 0.5)

  startDensity = 0.58
  targetDensity = 0.63
  totalDeltaDensity = targetDensity - startDensity
  
  density = startDensity
  deltaDensity = totalDeltaDensity
  
  decayFactor = 2.5
  deltaDensity = 0.01
  
예제 #4
0
    pl.plot(alpha_min, f_alpha_min, 'o', color='red')
    pl.show()


if __name__ == '__main__':

    solver = ScipyAndersonOZsolver(port=0)
    #solver = ScipyNewtonKrylovOZsolver(port = 0)
    #We only work with LJ or Yukawa potential since we want to avoid the trouble
    #related to the 'jump' (discontinuity) at r = sigma

    doLennardJonesExample = False

    if doLennardJonesExample:
        #LJ possible but with HMSA
        solver.setPotentialByName('LennardJones',
                                  0.1)  #epsilon/kT = 0.1 is default in SASfit
        print "Energy scale of Lennard Jones Potential in kT units:", solver.getEpsilonInkTUnits(
        )
        #Initialize HMSA with some (random) start alpha
        solver.doHMSAclosure(1.0)

    else:
        #Yukawa possible with RY: With negative K (attractive besides HS) convergence may be reached for exp shift only (real HS-Yukawa)
        #positive (repulsive as HS) K converges for fully shifted potential (1/r included)
        solver.setPotentialByName(
            'Yukawa', 1.0, -1.0,
            True)  #lamda in SASfit is different; K = 0.1 is default in SASfit
        print "Energy scale of Yukawa HS Potential in kT units:", solver.getInteractionStrengthInKTunits(
        )
        print "Length scale of Yukawa HS Potential in sigma units:", solver.getShieldingConstantInSigmaUnits(
        )