Exemplo n.º 1
0
 def __init__(self, functions, name, map2atoms=None, map2bonds=None):
     A2MDBaseClass.__init__(self, name='ensamble of support functions', verbose=False)
     if isinstance(functions, list):
         self.fun = functions
     else:
         raise IOError("must provide at least an empty list, and fill it using append")
     self.name = name
     self.map2atoms = map2atoms
     self.map2bonds = map2bonds
Exemplo n.º 2
0
    def __init__(self,
                 coordinates: np.ndarray,
                 atomic_numbers: Union[List[int], np.ndarray],
                 charge: Union[List[int], np.ndarray],
                 topology: List[List[int]],
                 parameters=None,
                 verbose=False,
                 atom_labels=None,
                 segments=None):
        """
        A2MD,models.molecule

        This object stores the information and the methods to generate models of electron density
        based on the linear combination of exponential-family functions.

        :param coordinates: nuclei coordinates
        :param charge: charge of each of the atoms
        :param topology: list of atoms joined to each atom
        :param parameters: electron density model parameters
        :param verbose:
        :param atomic_numbers: atomic number of each atom (integer)
        :param segments: to use in polymers
        :type coordinates: np.ndarray
        :type charge: np.ndarray
        :type topology: list
        :type parameters: list
        :type verbose: bool
        :type atomic_numbers: np.ndarray

        """
        A2MDBaseClass.__init__(self, name='A2MD', verbose=verbose)
        self.natoms = coordinates.shape[0]
        self.coordinates = coordinates.copy()
        self.atom_charges = charge
        self.topology = topology
        self.parameters = parameters
        self.atomic_numbers = atomic_numbers
        self.map_function2center = None
        self.map_frozenfunctions = None
        self.functions = None
        self.opt_params = None
        self.nfunctions = None
        self.atom_labels = atom_labels
        self.function_names = []
        self.function_types = []
        self.regularization = 0.0001
        self.is_clusterized = False
        self.is_optimized = False
        self.segments = segments  # segments allows to perform semi-restricted optimizations, in which
        # a part of the molecule corresponding to a given segment must match the sum of charges of that
        # fragment. It's an intermediate step between fully atom-charge restriction and molecule-wide single
        # restriction.
        if segments is not None:
            self.nsegments = np.unique(np.array(self.segments)).size

        if parameters is not None:
            self.read(parameters)
Exemplo n.º 3
0
    def __init__(self,
                 coordinates,
                 atomic_numbers,
                 charge,
                 topology,
                 parameters=None,
                 verbose=False,
                 atom_labels=None,
                 segments=None):
        """

        :param coordinates: nuclei coordinates
        :param charge: atoms in molecule charges
        :param topology: list of linked nuclei
        :param parameters: parameters for bonding
        :param verbose:
        :param atomic_numbers
        :param segments
        :type coordinates: np.ndarray
        :type charge: np.ndarray
        :type topology: list
        :type parameters: list
        :type verbose: bool
        :type atomic_numbers: np.ndarray

        """
        A2MDBaseClass.__init__(self, name='A2MD', verbose=verbose)
        self.natoms = coordinates.shape[0]
        self.coordinates = coordinates.copy()
        self.atom_charges = charge
        self.topology = topology
        self.parameters = parameters
        self.atomic_numbers = atomic_numbers
        self.map_function2center = None
        self.map_frozenfunctions = None
        self.functions = None
        self.opt_params = None
        self.nfunctions = None
        self.atom_labels = atom_labels
        self.function_names = []
        self.function_types = []
        self.regularization = 0.0001
        self.is_clusterized = False
        self.is_optimized = False
        self.segments = segments  # segments allows to perform semi-restricted optimizations, in which
        # a part of the molecule corresponding to a given segment must match the sum of charges of that
        # fragment. It's an intermediate step between fully atom-charge restriction and molecule-wide single
        # restriction.
        if segments is not None:
            self.nsegments = np.unique(np.array(self.segments)).size

        if parameters is not None:
            self.read(parameters)
Exemplo n.º 4
0
    def __init__(self, file=None):
        """

        :param file:
        """
        from a2mdio.molecules import Mol2
        A2MDBaseClass.__init__(self, name='symfeats', verbose=False)
        if file is not None:
            self.__mol = Mol2(file=file, verbose=False)
            self.__mol.change_units('au')
        else:
            self.__mol = None
        self.__x = None
        self.__l = None
Exemplo n.º 5
0
    def __init__(self, m, input_format='json'):
        """

        :param m:
        :param input_format:
        """
        A2MDBaseClass.__init__(self, name='model parser', verbose=False)
        if input_format == 'json':
            self.model_contents = self.read_json(m)
        elif input_format == 'dict':
            self.model_contents = m
        else:
            raise IOError("not allowed format. Please, use: {:s}".format(
                ' '.join(self.allowed_formats)))
Exemplo n.º 6
0
    def __init__(self, file=None, input_format=None, verbose=True):
        """
        preprocessor eases the parametrization of aAMD.
        - aAMD uses a list of individual atom features
        - parameters are specified as a dictionary in which entries appear as functions of element name
        - so aAMD makes a new list by reading the molecular coordinates and then it uses them to feed aAMD
        :param verbose:
        """
        from a2md import AMD_PARAMS_19
        A2MDBaseClass.__init__(self, name='aAMD preprocessor', verbose=verbose)
        self.__params = copy.copy(AMD_PARAMS_19)
        self.__molecule_coordinates = None
        self.__molecule_elements = None
        self.__molecule_topo = None
        self.__molecule_charge = None

        if file is not None:
            self.read_molecule(file=file, input_format=input_format)
Exemplo n.º 7
0
    def __init__(self, **kwargs):
        r"""
        Support functions. It requires:
        - coordinates : where function is centered
        - radial function type : 0 - sum of exp, 1 - exp, 2 - xexp
        - angular function type : 0 - isotropic, 1 - expansion of size 1, 2- expansion of size 2...
        :param \**kwargs['coordinates']:
            See below
        :keyword Arguments:
        * *coordinates* *(``np.ndarray``)
        * *radial_function_type* *(``int``)
        * *angular_function_type* *(``int``)

        """
        A2MDBaseClass.__init__(self, name ='support function ', verbose=False)
        self.coordinates = kwargs['coordinates']
        self.coordinate_system = None
        self.eval_method = None
        self.eval_ep_method = None
        self.integral_method = None
        self.support_type = None
        self.params_kw = None
        self.anisotropic = False
Exemplo n.º 8
0
Arquivo: utils.py Projeto: cisert/a2md
 def __init__(self, name, verbose=False):
     A2MDBaseClass.__init__(self, name="cluter tool / {:s}".format(name), verbose=verbose)
     self.cluster_method = None