Beispiel #1
0
 def __init__(self, struc, min_domain_size=1, max_domain_size=100):
     """
     Args:
         struc: structure to simulate augmented xrd spectra from
         min_domain_size: smallest domain size (in nm) to be sampled,
             leading to the broadest peaks
         max_domain_size: largest domain size (in nm) to be sampled,
             leading to the most narrow peaks
     """
     self.calculator = xrd.XRDCalculator()
     self.struc = struc
     self.pattern = self.calculator.get_pattern(struc, two_theta_range=(0,80))
     self.possible_domains = np.linspace(min_domain_size, max_domain_size, 100)
 def __init__(self, struc, max_texture=0.6):
     """
     Args:
         struc: pymatgen structure object from which xrd
             spectra are simulated
         max_texture: maximum strength of texture applied.
             For example, max_texture=0.6 implies peaks will be
             scaled by as much as +/- 60% of their original
             intensities.
     """
     self.calculator = xrd.XRDCalculator()
     self.struc = struc
     self.max_texture = max_texture
    def __init__(self,
                 spectra_dir,
                 spectrum_fname,
                 predicted_phases,
                 reference_dir='References'):
        """
        Args:
            spectrum_fname: name of file containing the
                xrd spectrum (in xy format)
            reference_dir: path to directory containing the
                reference phases (CIF files)
        """

        self.spectra_dir = spectra_dir
        self.spectrum_fname = spectrum_fname
        self.pred_phases = predicted_phases
        self.ref_dir = reference_dir
        self.calculator = xrd.XRDCalculator()
    def __init__(self,
                 spectra_dir,
                 spectrum_fname,
                 max_phases,
                 cutoff_intensity,
                 wavelen='CuKa',
                 reference_dir='References'):
        """
        Args:
            spectrum_fname: name of file containing the
                xrd spectrum (in xy format)
            reference_dir: path to directory containing the
                reference phases (CIF files)
            wavelen: wavelength used for diffraction (angstroms).
                Defaults to Cu K-alpha radiation (1.5406 angstroms).
        """

        self.spectra_dir = spectra_dir
        self.spectrum_fname = spectrum_fname
        self.ref_dir = reference_dir
        self.calculator = xrd.XRDCalculator()
        self.max_phases = max_phases
        self.cutoff = cutoff_intensity
        self.wavelen = wavelen
Beispiel #5
0
# energy of per atom used to calcualte the binding enegy
E_Sn = -3.980911
E_S = -2.696603
E_Ca = -1.250692
E_O = -0.867783
###########################################################

############################################################
#parameter in the GCN

#about torch
torch.set_default_dtype(torch.float64)
torch.set_printoptions(precision=8)

#about pymatgen
patt_xrd = xrd.XRDCalculator('CuKa')

#about inputs of NN layers in GCN
global sample_num, rmat_num, series_num
sample_num = 1  #output of G
rmat_num = 28  #row nums of the matrix for the input of CNN


########################################################
#get energy from the OUTCAR
def get_total_energy(folder):
    energy_string = os.popen('grep TOTEN ' + folder +
                             '/OUTCAR | tail -1').read().split(' ')[-2]
    energy_slab = round(np.float64(float(energy_string)), 5)
    return energy_slab
Beispiel #6
0
A_pos = [0, 16, 26, 36, 52, 62]
B_pos = [2, 12, 28, 38, 48, 64]
#C_pos = [4, 14, 24, 40, 50, 60] #reference only, not actually used
#poly_dict = {'A':A_pos, 'B':B_pos, 'C':C_pos}
#laer_z = {0:4, 1:12, 2:20}
ra = np.random.randint
expt = np.array([[11.6093069, 0.33422539],
                 [20.2156104, 0.45120426],
                 [23.3406177, 0.42613735],
                 [35.472999, 0.3342209],
                 [36.1080272, 0.2172465],
                 [40.5365135, 0.434493],
                 [47.7724929, 0.52640495],
                 [63.1969942, 0.3175141],
                 [64.4336281, 0.4679155]])
xrds = xrd.XRDCalculator()
generation = 0
dna_index = {}
fitdex = pd.DataFrame(columns=['matchfit', 'matchtot', 'fitsum'])

#Define DNA as nested namedtuples
DNA = namedtuple('DNA', 'Polytope L1 L2 L3 Lattice')
POL = namedtuple('POL', 'Layers Symmetry')
LAY = namedtuple('LAY', 'N Mineral') #Mineral is b or g, might affect certain things about M+ layer
SYM = namedtuple('SYM', 'Cn, Sz, Sxy, Tx, Ty') #Sym elements affect M+ layer stacking
LN = namedtuple('LN', 'C W1 W2') 
M = namedtuple('M', 'pos phi theta')
#Sym contents: 
#Cn = number indicating n subscript, note a C2 = sx + sy
#Sz = 0 or 1, an xy plane running through metal atoms
#Sxy = (-1:1); -1 indicates a zx plane at b = 0.5; 1 for zy plane, 0 means no plane, both is a C2