geometric/tests/test_batch_opt.py
def _initOptimizer(self, schemas):
        """ initilize all OptObjects for the schmas passed.
        
        Arguements
        ----------
        schemas: list of schemas for qcengine
        
        return
        ------
        list of OptOject's for each schema
        """
        
        #=========================================#
        #| Set up the internal coordinate system |#
        #=========================================#
        # First item in tuple: The class to be initialized
        # Second item in tuple: Whether to connect non-bonded fragments
        # Third item in tuple: Whether to throw in all Cartesian (no effect if second item is True)
        CoordSysDict = {'cart':(CartesianCoordinates, False, False),
                        'prim':(PrimitiveInternalCoordinates, True, False),
                        'dlc':(DelocalizedInternalCoordinates, True, False),
                        'hdlc':(DelocalizedInternalCoordinates, False, True),
                        'tric':(DelocalizedInternalCoordinates, False, False)}
        coordsys = self.kwargs.get('coordsys', 'tric')
        CoordClass, connect, addcart = CoordSysDict[coordsys.lower()]

        optimizers = []
        for schema in schemas:
            M, engine = gt.get_molecule_engine(engine='qcengine', qcschema=schema, **self.kwargs)
            coords = M.xyzs[0].flatten() * ang2bohr
    
            # Read in the constraints
            constraints = self.kwargs.get('constraints', None) #Constraint input file (optional)
            if constraints is not None:
                Cons, CVals = gt.ParseConstraints(M, open(constraints).read())
            else:
                Cons = None
                CVals = None
            
            IC = CoordClass(M, build=True, connect=connect, addcart=addcart, constraints=Cons, 
                            cvals=CVals[0] if CVals is not None else None)
            tmpDir = tempfile.mkdtemp(".tmp", "batchOpt")

            optimizer = gt.Optimizer(coords, M, IC, engine, tmpDir, self.params)
            optimizer.calcEnergyForce()
            optimizer.prepareFirstStep()
            logger.debug("[AU]: e=%.5f bl=%.5f,%.5f g=%.4f" % (
                    optimizer.E, optimizer.X[0],optimizer.X[3], optimizer.gradx[0]))
            optimizers.append(optimizer)
            
        return optimizers
 initilize all OptObjects for the schmas passed.
        
        Arguements
        ----------
        schemas: list of schemas for qcengine
        
        return
        ------
        list of OptOject's for each schema
        
initilize all OptObjects for the schmas passed.
Arguements

list of schemas for qcengine

return

list of OptOject's for each schema
initilize all OptObjects for the schmas passed . Arguements list of schemas for qcengine return list of OptOject ' s for each schema
def _initOptimizer(self, schemas):
        CoordSysDict = {'cart':(CartesianCoordinates, False, False),
                        'prim':(PrimitiveInternalCoordinates, True, False),
                        'dlc':(DelocalizedInternalCoordinates, True, False),
                        'hdlc':(DelocalizedInternalCoordinates, False, True),
                        'tric':(DelocalizedInternalCoordinates, False, False)}
        coordsys = self.kwargs.get('coordsys', 'tric')
        CoordClass, connect, addcart = CoordSysDict[coordsys.lower()]
        optimizers = []
        for schema in schemas:
            M, engine = gt.get_molecule_engine(engine='qcengine', qcschema=schema, **self.kwargs)
            coords = M.xyzs[0].flatten() * ang2bohr
            constraints = self.kwargs.get('constraints', None) 
            if constraints is not None:
                Cons, CVals = gt.ParseConstraints(M, open(constraints).read())
            else:
                Cons = None
                CVals = None
            IC = CoordClass(M, build=True, connect=connect, addcart=addcart, constraints=Cons, 
                            cvals=CVals[0] if CVals is not None else None)
            tmpDir = tempfile.mkdtemp(".tmp", "batchOpt")
            optimizer = gt.Optimizer(coords, M, IC, engine, tmpDir, self.params)
            optimizer.calcEnergyForce()
            optimizer.prepareFirstStep()
            logger.debug("[AU]: e=%.5f bl=%.5f,%.5f g=%.4f" % (
                    optimizer.E, optimizer.X[0],optimizer.X[3], optimizer.gradx[0]))
            optimizers.append(optimizer)
        return optimizers
def _initOptimizer ( self , schemas ) : CoordSysDict = { 'cart' : ( CartesianCoordinates , False , False ) , 'prim' : ( PrimitiveInternalCoordinates , True , False ) , 'dlc' : ( DelocalizedInternalCoordinates , True , False ) , 'hdlc' : ( DelocalizedInternalCoordinates , False , True ) , 'tric' : ( DelocalizedInternalCoordinates , False , False ) } coordsys = self . kwargs . get ( 'coordsys' , 'tric' ) CoordClass , connect , addcart = CoordSysDict [ coordsys . lower ( ) ] optimizers = [ ] for schema in schemas : M , engine = gt . get_molecule_engine ( engine = 'qcengine' , qcschema = schema , ** self . kwargs ) coords = M . xyzs [ 0 ] . flatten ( ) * ang2bohr constraints = self . kwargs . get ( 'constraints' , None ) if constraints is not None : Cons , CVals = gt . ParseConstraints ( M , open ( constraints ) . read ( ) ) else : Cons = None CVals = None IC = CoordClass ( M , build = True , connect = connect , addcart = addcart , constraints = Cons , cvals = CVals [ 0 ] if CVals is not None else None ) tmpDir = tempfile . mkdtemp ( ".tmp" , "batchOpt" ) optimizer = gt . Optimizer ( coords , M , IC , engine , tmpDir , self . params ) optimizer . calcEnergyForce ( ) optimizer . prepareFirstStep ( ) logger . debug ( "[AU]: e=%.5f bl=%.5f,%.5f g=%.4f" % ( optimizer . E , optimizer . X [ 0 ] , optimizer . X [ 3 ] , optimizer . gradx [ 0 ] ) ) optimizers . append ( optimizer ) return optimizers
initilize all OptObjects for the schmas passed.
initilize all OptObjects for the schmas passed .
""" initilize all OptObjects for the schmas passed.
        
        Arguements
        ----------
        schemas: list of schemas for qcengine
        
        return
        ------
        list of OptOject's for each schema
        """ #=========================================# #| Set up the internal coordinate system |# #=========================================# # First item in tuple: The class to be initialized # Second item in tuple: Whether to connect non-bonded fragments # Third item in tuple: Whether to throw in all Cartesian (no effect if second item is True) # Read in the constraints #Constraint input file (optional)
self
schemas