Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
DurhamDecLab committed Apr 15, 2019
1 parent 117d7a9 commit a540b49
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 0 deletions.
48 changes: 48 additions & 0 deletions 3D_ARBInterpExample.py
@@ -0,0 +1,48 @@
from __future__ import division
import numpy as np
from ARBTools.ARBInterp import tricubic

######################################################################

if __name__ == '__main__':
fieldname = "Example3DScalarField"

print ("--- Loading field ---")
field = np.genfromtxt(fieldname+'.csv', delimiter=',')

Run = tricubic(field) # mode kword arg will be ignored if a scalar (Nx4) input is detected

coords=np.zeros((20,3))
coords[:,0]=np.linspace(-2e-3,2e-3,20)
coords[:,1]=np.linspace(-2e-3,2e-3,20)
coords[:,2]=np.linspace(-2e-3,2e-3,20)

output = Run.Query((coords[3]))
print ('\n')
print ('Single point query, scalar field:')
print (output)
print ('\n')

Comps = Run.Query(coords)
print ('\n')
print ('Multi point query, scalar field:')
print (Comps)


fieldname = "Example3DVectorField"

print ("--- Loading field ---")
field = np.genfromtxt(fieldname+'.csv', delimiter=',')

Run = tricubic(field, mode='both') # mode options are 'both', 'vector' or 'norm', defaults to 'vector'. Pass arg 'quiet' to suppress setup text

output = Run.Query((coords[3]))
print ('Single point query, vector field:')
print ('\n')
print (output)
print ('\n')

Comps = Run.Query(coords)
print ('Multi point query, vector field:')
print ('\n')
print (Comps)
49 changes: 49 additions & 0 deletions 4D_ARBInterpExample.py
@@ -0,0 +1,49 @@
from __future__ import division
import numpy as np
from ARBTools.ARBInterp import quadcubic

######################################################################

if __name__ == '__main__':
fieldname = "Example4DScalarField"

print ("--- Loading field ---")
field = np.genfromtxt(fieldname+'.csv', delimiter=',')

Run = quadcubic(field) # mode kword arg will be ignored if a scalar (Nx5) input is detected

coords=np.zeros((20,4))
coords[:,0]=np.linspace(-2e-3,2e-3,20)
coords[:,1]=np.linspace(-2e-3,2e-3,20)
coords[:,2]=np.linspace(-2e-3,2e-3,20)
coords[:,3]=np.linspace(-3e-6,3e-6,20)

output = Run.Query((coords[3]))
print ('\n')
print ('Single point query, scalar field:')
print (output)
print ('\n')

Comps = Run.Query(coords)
print ('\n')
print ('Multi point query, scalar field:')
print (Comps)


fieldname = "Example4DVectorField"

print ("--- Loading field ---")
field = np.genfromtxt(fieldname+'.csv', delimiter=',')

Run = quadcubic(field, mode='both') # mode options are 'both', 'vector' or 'norm', defaults to 'vector'. Pass arg 'quiet' to suppress setup text

output = Run.Query((coords[3]))
print ('Single point query, vector field:')
print ('\n')
print (output)
print ('\n')

Comps = Run.Query(coords)
print ('Multi point query, vector field:')
print ('\n')
print (Comps)
29 changes: 29 additions & 0 deletions ARBTrajecExample.py
@@ -0,0 +1,29 @@
from __future__ import division
import numpy as np
from ARBTools.ARBInterp import tricubic
#from ARBTools.ARBTrajec
from A5_03032019 import trajectories

############################### Skookum ###############################

if __name__ == '__main__':
mAr = 39.948 # Mass Ar
N = 100 # number of atoms
T = 0.01 # temperature in K

moment = 3 # magnetic moment in Bohr magnetons - mJ x g-factor (neglecting nuclear spin, use mF if I!=0)
# testing with Ar in 3P2 state: mJ = 2, low-field-seeking

tmax = 0.01 # end time of simulation
timestep = 1e-6 # acceptable timestep depends on shape of potential!

fieldname = "ExampleVectorField"
field = np.genfromtxt(fieldname+'.csv', delimiter=',') # field to be interpolated

ArTest = trajectories(field) # creates class to iterate particle trajectories
ArSample = ArTest.atoms(T,N, mAr) # creates random sample of Ar atoms
np.savetxt('Rand_In.csv', ArSample, delimiter=',') # Save initial sample to file

ArTest.Iterate(ArSample, tmax, timestep, mAr, moment) # tracks motion of particles through field for some time

np.savetxt('Rand_Out.csv', ArSample, delimiter=',') # Save final sample to file

0 comments on commit a540b49

Please sign in to comment.