65 lines
1.9 KiB
Python
65 lines
1.9 KiB
Python
#!/usr/bin/python3
|
|
|
|
import spintrum
|
|
import math
|
|
import matplotlib.pyplot as plt
|
|
import numpy as np
|
|
import time
|
|
|
|
gammas = [1070.8e4,4257.7e4,4257.7e4,4257.7e4,4257.7e4,4257.7e4,4257.7e4,4257.7e4,4257.7e4]
|
|
multips = [2,2,2,2,2,2,2,2,2]
|
|
jCouplings = \
|
|
[
|
|
[0,125.99,125.99,125.99,4.53,0.63,0.56,0.63,4.53],
|
|
[0,0,0,0,-0.69,0.3,-0.52,0.3,-0.69],
|
|
[0,0,0,0,-0.69,0.3,-0.52,0.3,-0.69],
|
|
[0,0,0,0,-0.69,0.3,-0.52,0.3,-0.69],
|
|
[0,0,0,0,0,7.655,1.273,0.61,1.902],
|
|
[0,0,0,0,0,0,7.417,1.442,0.61],
|
|
[0,0,0,0,0,0,0,7.417,1.273],
|
|
[0,0,0,0,0,0,0,0,7.655],
|
|
[0,0,0,0,0,0,0,0,0],
|
|
]
|
|
|
|
BThermal = 1.8e0
|
|
T2 = 10
|
|
sampleRate = 2e3
|
|
T= 1/sampleRate
|
|
points = 80000
|
|
|
|
gammah = 2*math.pi*4257.7
|
|
|
|
|
|
spinOp = spintrum.SpinOperations()
|
|
spinOp.add_operation(spintrum.SpinOperations.OPERATION__THERMAL_POPULATE,
|
|
{'Bx': 0, 'By': 0, 'Bz': BThermal, 'T': 293.778})
|
|
spinOp.add_operation(spintrum.SpinOperations.OPERATION__TIP_SPINS,
|
|
{'direction': 'y', 'BVsTArea': 4*math.pi/gammah})
|
|
spinOp.add_operation(spintrum.SpinOperations.OPERATION__SET_HAMILTONIAN,
|
|
{'Bx': 0, 'By': 0, 'Bz': 0})
|
|
spinOp.add_operation(spintrum.SpinOperations.OPERATION__INIT_TIME_INDEPENDENT_EVOLUTION,
|
|
{'samplingRate': sampleRate, 'measurementDirection': 'z'})
|
|
spinOp.add_operation(spintrum.SpinOperations.OPERATION__EVOLVE_TIME_INDEPENDENT,
|
|
{'points': points, 'threads': 4})
|
|
|
|
|
|
start_time = time.time()
|
|
|
|
signal = spintrum.simulate(gyromagneticRatios=gammas,
|
|
jCouplings=jCouplings,
|
|
spinMultiplicities=multips,
|
|
spinOperations=spinOp)
|
|
|
|
signal = signal - np.mean(signal)
|
|
signal = [signal[i]*math.exp(-i/sampleRate/T2) for i in range(len(signal))]
|
|
|
|
print("Simulation lastet: " + repr(time.time()-start_time) + "s")
|
|
|
|
#plt.plot(signal)
|
|
#plt.show()
|
|
|
|
fft = spintrum.FFTSpectralDensity(signal, sampleRate)
|
|
|
|
#plt.plot(fft['x'], fft['y'])
|
|
#plt.show()
|