Exemple #1
0
It will print the state of the system, and make several figures.

"""

import numpy as np
import matplotlib.pyplot as plt
import pykbi

# first generate a range of values, we use excessively many points
range_data = np.linspace(0.001, 250, 10000)

# then we generate the function, based on the input
gr = pykbi.odf(range_data, chi=2.0)

rdf = pykbi.RDF(range_data, gr, name="ODF, chi=2.0")

# we integrate the function using the open integration method.
rdf.Integrate()

## and we read out the value of the integral. if no argument is given, this is done
# in the last point in the integral
rdf.FindValues(position=(None, 0.10))

# Then print the values
print("Value of KBI at end of integral for '{}': {}".format(
    rdf.name, rdf.ReturnKBI()))

# We then print the state of the system
rdf.PrintState()
Exemple #2
0
 def test_wrong_input(self):
     self.assertRaises(TypeError, lambda: pykbi.RDF(np.array([]), 1.0))
     self.assertRaises(TypeError, lambda: pykbi.RDF(1.0, np.array([])))
Exemple #3
0
 def setUp(self):
     n = 10
     self.rdf = pykbi.RDF(np.linspace(0.1, 1.1, n),
                          np.ones(n),
                          closed=False)
     self.rdf.Integrate()
Exemple #4
0
It will print the state of the system, and make several figures.

"""

import numpy as np
import matplotlib.pyplot as plt
import pykbi

# first generate a range of values, we use excessively many points
range_data = np.linspace(0.001, 250, 10000)

# then we generate the function, based on the input
gr = pykbi.odf(range_data, chi=2.0)

rdf = pykbi.RDF(range_data, gr, closed=False, name="ODF, chi=2.0")

# we integrate the function using the open integration method.
rdf.Integrate()

## and we read out the value of the integral. if no argument is given, this is done
# in the last point in the integral
rdf.FindValues()

# Then print the values
print("Value of KBI at end of integral for '{}': {}".format(
    rdf.name, rdf.ReturnKBI()))

# We then print the state of the system
rdf.PrintState()
Exemple #5
0
"""

import numpy as np
import matplotlib.pyplot as plt
import pykbi

# read data from file

lt = 14.8245984505

data = np.loadtxt("rdf1.txt")

rdf11 = pykbi.RDF(data[:, 0],
                  data[:, 1],
                  closed=False,
                  npart=1200,
                  box_size=lt,
                  eqint=True,
                  name="rdf_11")
rdf22 = pykbi.RDF(data[:, 0],
                  data[:, 2],
                  closed=False,
                  npart=600,
                  box_size=lt,
                  eqint=True,
                  name="rdf_22")
rdf33 = pykbi.RDF(data[:, 0],
                  data[:, 3],
                  closed=False,
                  npart=600,
                  box_size=lt,
Exemple #6
0
Will work with the integral of a rdf


"""

import numpy as np
import matplotlib.pyplot as plt
import pykbi


# read data from file

data = np.loadtxt("rdf1.txt")


rdf11 = pykbi.RDF(data[:,0],data[:,1], closed=True, name="rdf_11")
rdf22 = pykbi.RDF(data[:,0],data[:,2], closed=True, name="rdf_22")
rdf33 = pykbi.RDF(data[:,0],data[:,3], closed=True, name="rdf_33")


# we integrate them using the closed integration methods
rdf11.Integrate()
rdf22.Integrate()
rdf33.Integrate()

## and we read out the value of the integral. if no argument is given, this is done
# in the last point in the integral
rdf11.FindValues(position=(0.35,0.45))
rdf22.FindValues(position=(0.35,0.45))
rdf33.FindValues(position=(0.35,0.45))