How to use the pyxtal.operations.project_point function in pyxtal

To help you get started, we’ve selected a few pyxtal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qzhu2017 / PyXtal / pyxtal / crystal.py View on Github external
cycle3 = 0
        while cycle3 < wyckoff_attempts:

            self.cycle3 = cycle3
            # Choose a random WP for given multiplicity: 2a, 2b
            if sites_list is not None:
                site = sites_list[0]
            else: # Selecting the merging 
                site = None
            
            ops = choose_wyckoff(self.group, numIon - numIon_added, site, self.dim)
            if ops is not False:
                # Generate a list of coords from ops
                pt = self.lattice.generate_point()
                proj_pt = project_point(pt, ops[0], cell_matrix, self.PBC)
                coords = apply_ops(proj_pt, ops)


                # Merge coordinates if the atoms are close
                coords_toadd, wp_index, pt = merge_coordinate(
                    coords, cell_matrix, self.group, tol
                )
                if site is not None and len(coords_toadd) < len(coords):
                    continue # break the cycle if the merge happens
                #print(coords)
                #print(coords_toadd, wp_index, pt)
                #import sys
                #sys.exit()

                if wp_index is not False:
                    # Use a Wyckoff_site object for the current site
github qzhu2017 / PyXtal / pyxtal / crystal.py View on Github external
if passed_distance_check is False:
            mult1 = group[index].multiplicity
            # Find possible wp's to merge into
            possible = []
            for i, wp in enumerate(group):
                mult2 = wp.multiplicity
                # factor = mult2 / mult1
                if (mult2 < mult1) and (mult1 % mult2 == 0):
                    possible.append(i)
            if possible == []:
                return coor, False, None
            # Calculate minimum separation for each WP
            distances = []
            for i in possible:
                wp = group[i]
                projected_point = project_point(point, wp[0], lattice=lattice, PBC=PBC)
                # NOTE Comprhys: new_coor note used?
                new_coor = apply_ops(projected_point, wp)
                d = distance(point - projected_point, lattice, PBC=PBC)
                distances.append(np.min(d))
            # Choose wp with shortest translation for generating point
            tmpindex = np.argmin(distances)
            index = possible[tmpindex]
            newwp = group[index]
            projected_point = project_point(point, newwp[0], lattice=lattice, PBC=PBC)
            coor = apply_ops(projected_point, newwp)
            point = coor[0]
            index = newwp.index
        # Distances were not too small; return True
        else:
            return coor, index, point
github qzhu2017 / PyXtal / pyxtal / molecular_crystal.py View on Github external
for i, wp in enumerate(group):
                mult2 = wp.multiplicity
                # Check that a valid orientation exists
                j, k = jk_from_i(i, orientations)
                if orientations[j][k] == []:
                    continue
                # Only allow smaller WP's that are an integer factor of the current one
                if (mult2 < mult1) and (mult1 % mult2 == 0):
                    possible.append(i)
            if possible == []:
                return coor, False, None
            # Calculate minimum separation for each WP
            distances = []
            for i in possible:
                wp = group[i]
                projected_point = project_point(point, wp[0], lattice=lattice, PBC=PBC)
                # NOTE new coor never used?
                new_coor = apply_ops(projected_point, wp)
                d = distance(point - projected_point, lattice, PBC=PBC)
                distances.append(np.min(d))
            # Choose wp with shortest translation for generating point
            tmpindex = np.argmin(distances)
            index = possible[tmpindex]
            newwp = group[index]
            projected_point = project_point(point, newwp[0], lattice=lattice, PBC=PBC)
            coor = apply_ops(projected_point, newwp)
            point = coor[0]
            index = newwp.index
        # Distances were not too small; return True
        else:
            return coor, index, point
github qzhu2017 / PyXtal / pyxtal / crystal.py View on Github external
if possible == []:
                return coor, False, None
            # Calculate minimum separation for each WP
            distances = []
            for i in possible:
                wp = group[i]
                projected_point = project_point(point, wp[0], lattice=lattice, PBC=PBC)
                # NOTE Comprhys: new_coor note used?
                new_coor = apply_ops(projected_point, wp)
                d = distance(point - projected_point, lattice, PBC=PBC)
                distances.append(np.min(d))
            # Choose wp with shortest translation for generating point
            tmpindex = np.argmin(distances)
            index = possible[tmpindex]
            newwp = group[index]
            projected_point = project_point(point, newwp[0], lattice=lattice, PBC=PBC)
            coor = apply_ops(projected_point, newwp)
            point = coor[0]
            index = newwp.index
        # Distances were not too small; return True
        else:
            return coor, index, point