示例#1
0
  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)
  print "Volume density of liquid:", solver.getVolumeDensity()
示例#2
0

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)