$darkmode
DENOPTIM
denoptim.integration.rcoserver.RCOSocketServerClient Class Reference

Sends the request to produce a socket server running the RingClosingMM service. More...

Collaboration diagram for denoptim.integration.rcoserver.RCOSocketServerClient:
[legend]

Public Member Functions

void setHostname (String hostname)
 Sets the hostname for the socket server connection. More...
 
void setPort (Integer port)
 Sets the port for the socket server connection. More...
 
String getHostname ()
 Gets the currently configured hostname. More...
 
Integer getPort ()
 Gets the currently configured port. More...
 
void runConformationalOptimization (ChemicalObjectModel chemObj, Logger logger) throws IOException, JsonSyntaxException, DENOPTIMException
 Runs a conformational optimization using the services provided by the socket server configured for this instance. More...
 
void runConformationalOptimization (ChemicalObjectModel chemObj, Set< ObjectPair > rcaCombination, Logger logger) throws IOException, JsonSyntaxException, DENOPTIMException
 Runs a conformational optimization using the services provided by the socket server configured for this instance. More...
 
String formulateRequest (ZMatrix zmat, List< int[]> rcpTerms, List< int[]> rotatableBonds, List< int[]> allBonds) throws IOException
 Formulates the request to be sent to the socket server. More...
 
JsonObject sendRequest (String requestAsJSONString) throws IOException, JsonSyntaxException
 Sends the given request to the socket server and waits for the answer, which is then processed and returned. More...
 

Static Public Member Functions

static synchronized RCOSocketServerClient getInstance (String hostname, Integer port)
 Gets the singleton instance of RCOSocketServerClient. More...
 
static RCOSocketServerClient getInstance ()
 Gets the singleton instance of RCOSocketServerClient if it has been initialized. More...
 
static JsonArray getZMatrixAsJsonArray (ZMatrix zmat)
 Gets a JsonArray representation of the Z-matrix. More...
 

Private Member Functions

 RCOSocketServerClient (String hostname, Integer port)
 Private constructor for singleton pattern. More...
 

Static Private Member Functions

static JsonArray convertIntArrayListToJsonArray (List< int[]> intArrayList)
 Converts a List of 0-based int arrays to a JsonArray containing 1-based ints. More...
 

Private Attributes

final int version = 1
 Version identifier. More...
 
String hostname
 The name of the host or ID address used to communicate with the socket server. More...
 
Integer port
 The identifier of the port used to communicate with the socket server. More...
 
Gson jsonConverter = new GsonBuilder().create()
 Converter to and from JSON/Java objects. More...
 

Static Private Attributes

static RCOSocketServerClient instance = null
 Singleton instance. More...
 

Detailed Description

Sends the request to produce a socket server running the RingClosingMM service.

This performs conformational search, possibly biased to induce ring-closing conformations. The service is provided by the RingClosingMM socket server, which we assume to be running. This class follows the singleton pattern.

Definition at line 59 of file RCOSocketServerClient.java.

Constructor & Destructor Documentation

◆ RCOSocketServerClient()

denoptim.integration.rcoserver.RCOSocketServerClient.RCOSocketServerClient ( String  hostname,
Integer  port 
)
private

Private constructor for singleton pattern.

Definition at line 92 of file RCOSocketServerClient.java.

References denoptim.integration.rcoserver.RCOSocketServerClient.hostname, and denoptim.integration.rcoserver.RCOSocketServerClient.port.

Referenced by denoptim.integration.rcoserver.RCOSocketServerClient.getInstance().

Here is the caller graph for this function:

Member Function Documentation

◆ convertIntArrayListToJsonArray()

static JsonArray denoptim.integration.rcoserver.RCOSocketServerClient.convertIntArrayListToJsonArray ( List< int[]>  intArrayList)
staticprivate

Converts a List of 0-based int arrays to a JsonArray containing 1-based ints.

Parameters
intArrayListThe list of int arrays to convert
Returns
A JsonArray where each element is a JsonArray of integers

Definition at line 398 of file RCOSocketServerClient.java.

Referenced by denoptim.integration.rcoserver.RCOSocketServerClient.formulateRequest().

Here is the caller graph for this function:

◆ formulateRequest()

String denoptim.integration.rcoserver.RCOSocketServerClient.formulateRequest ( ZMatrix  zmat,
List< int[]>  rcpTerms,
List< int[]>  rotatableBonds,
List< int[]>  allBonds 
) throws IOException

Formulates the request to be sent to the socket server.

Since the socket works with chemical conventions, not with Java or Python conventions, the request has to be formulated with 1-based indexing. This method takes care of

Parameters
zmatthe zMatrix representation
rcpTermsThe list of ring-closing potential energy terms (RCP terms) (0-based)
rotatableBondsThe list of bonds that can be twisted. Each bond is defined by the two 0-based indexes of the bonded atoms.
allBondsThe list of all bonds. Each bond is defined by the two 0-based indexes of the bonded atoms.
Returns
The request as a JSON string.

Definition at line 327 of file RCOSocketServerClient.java.

References denoptim.integration.rcoserver.RCOSocketServerClient.convertIntArrayListToJsonArray(), denoptim.integration.rcoserver.RCOSocketServerClient.getZMatrixAsJsonArray(), denoptim.integration.rcoserver.RCOSocketServerClient.jsonConverter, and denoptim.integration.rcoserver.RCOSocketServerClient.version.

Referenced by denoptim.integration.rcoserver.RCOSocketServerClient.runConformationalOptimization().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHostname()

String denoptim.integration.rcoserver.RCOSocketServerClient.getHostname ( )

Gets the currently configured hostname.

Returns
The hostname

Definition at line 160 of file RCOSocketServerClient.java.

References denoptim.integration.rcoserver.RCOSocketServerClient.hostname.

◆ getInstance() [1/2]

static RCOSocketServerClient denoptim.integration.rcoserver.RCOSocketServerClient.getInstance ( )
static

Gets the singleton instance of RCOSocketServerClient if it has been initialized.

Returns
The singleton instance
Exceptions
IllegalStateExceptionif the instance has not been initialized yet.

Definition at line 123 of file RCOSocketServerClient.java.

References denoptim.integration.rcoserver.RCOSocketServerClient.instance.

◆ getInstance() [2/2]

static synchronized RCOSocketServerClient denoptim.integration.rcoserver.RCOSocketServerClient.getInstance ( String  hostname,
Integer  port 
)
static

Gets the singleton instance of RCOSocketServerClient.

Parameters
hostnameThe hostname or IP address of the socket server
portThe port number of the socket server
Returns
The singleton instance

Definition at line 105 of file RCOSocketServerClient.java.

References denoptim.integration.rcoserver.RCOSocketServerClient.hostname, denoptim.integration.rcoserver.RCOSocketServerClient.instance, denoptim.integration.rcoserver.RCOSocketServerClient.port, and denoptim.integration.rcoserver.RCOSocketServerClient.RCOSocketServerClient().

Referenced by denoptim.molecularmodeling.RingClosureTool.attemptRingClosureWithRCOServer(), and denoptim.molecularmodeling.MultiMolecularModelBuilder.buildMulti3DStructure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPort()

Integer denoptim.integration.rcoserver.RCOSocketServerClient.getPort ( )

Gets the currently configured port.

Returns
The port number

Definition at line 170 of file RCOSocketServerClient.java.

References denoptim.integration.rcoserver.RCOSocketServerClient.port.

◆ getZMatrixAsJsonArray()

static JsonArray denoptim.integration.rcoserver.RCOSocketServerClient.getZMatrixAsJsonArray ( ZMatrix  zmat)
static

Gets a JsonArray representation of the Z-matrix.

Note that this is meant to produce 1-based indices for the atoms.

Parameters
zmatThe TinkerMolecule object to be processed.
Returns
the Z-matrix as a JsonArray.

Definition at line 348 of file RCOSocketServerClient.java.

References denoptim.molecularmodeling.zmatrix.ZMatrix.getAngle2RefAtomIndex(), denoptim.molecularmodeling.zmatrix.ZMatrix.getAngle2Value(), denoptim.molecularmodeling.zmatrix.ZMatrix.getAngleRefAtomIndex(), denoptim.molecularmodeling.zmatrix.ZMatrix.getAngleValue(), denoptim.molecularmodeling.zmatrix.ZMatrix.getAtom(), denoptim.molecularmodeling.zmatrix.ZMatrix.getAtomCount(), denoptim.molecularmodeling.zmatrix.ZMatrix.getBondLength(), denoptim.molecularmodeling.zmatrix.ZMatrix.getBondRefAtomIndex(), denoptim.molecularmodeling.zmatrix.ZMatrix.getChiralFlag(), denoptim.molecularmodeling.zmatrix.ZMatrixAtom.getId(), and denoptim.molecularmodeling.zmatrix.ZMatrixAtom.getSymbol().

Referenced by denoptim.integration.rcoserver.RCOSocketServerClient.formulateRequest(), and denoptim.integration.rcoserver.RCOSocketServerClientTest.testGetZMatrixAsJsonArray().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ runConformationalOptimization() [1/2]

void denoptim.integration.rcoserver.RCOSocketServerClient.runConformationalOptimization ( ChemicalObjectModel  chemObj,
Logger  logger 
) throws IOException, JsonSyntaxException, DENOPTIMException

Runs a conformational optimization using the services provided by the socket server configured for this instance.

This wrapper does not consider the possibility to close rings defined by RingClosingAttractor combinations.

Parameters
chemObjthe definition of the chemical system to work with.
loggerlogging tool
Exceptions
IOException
JsonSyntaxException
DENOPTIMException

Definition at line 187 of file RCOSocketServerClient.java.

References denoptim.integration.rcoserver.RCOSocketServerClient.runConformationalOptimization().

Referenced by denoptim.molecularmodeling.RingClosureTool.attemptRingClosureWithRCOServer(), denoptim.molecularmodeling.MultiMolecularModelBuilder.buildMulti3DStructure(), and denoptim.integration.rcoserver.RCOSocketServerClient.runConformationalOptimization().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ runConformationalOptimization() [2/2]

void denoptim.integration.rcoserver.RCOSocketServerClient.runConformationalOptimization ( ChemicalObjectModel  chemObj,
Set< ObjectPair rcaCombination,
Logger  logger 
) throws IOException, JsonSyntaxException, DENOPTIMException

Runs a conformational optimization using the services provided by the socket server configured for this instance.

Parameters
chemObjthe definition of the chemical system to work with.
rcaCombinationif not null and not empty, biases the conformational search towards conformations closing the rings defined by each given pair of RingClosingAttractors.
loggerlogging tool
Exceptions
IOException
JsonSyntaxException
DENOPTIMException

Definition at line 208 of file RCOSocketServerClient.java.

References denoptim.integration.rcoserver.RCOSocketServerClient.formulateRequest(), denoptim.integration.rcoserver.RCOSocketServerClient.sendRequest(), denoptim.molecularmodeling.zmatrix.ZMatrixAtom.setAngle2Value(), denoptim.molecularmodeling.zmatrix.ZMatrixAtom.setAngleValue(), denoptim.molecularmodeling.zmatrix.ZMatrixAtom.setBondLength(), and denoptim.molecularmodeling.zmatrix.ZMatrixAtom.setChiralFlag().

Here is the call graph for this function:

◆ sendRequest()

JsonObject denoptim.integration.rcoserver.RCOSocketServerClient.sendRequest ( String  requestAsJSONString) throws IOException, JsonSyntaxException

Sends the given request to the socket server and waits for the answer, which is then processed and returned.

Parameters
requestAsJSONStringthe request as a JSON string.
Returns
the answer from the socket server as a JSON object.
Exceptions
IOExceptionif an I/O error occurs

Definition at line 422 of file RCOSocketServerClient.java.

References denoptim.integration.rcoserver.RCOSocketServerClient.hostname, denoptim.integration.rcoserver.RCOSocketServerClient.jsonConverter, and denoptim.integration.rcoserver.RCOSocketServerClient.port.

Referenced by denoptim.integration.rcoserver.RCOSocketServerClient.runConformationalOptimization().

Here is the caller graph for this function:

◆ setHostname()

void denoptim.integration.rcoserver.RCOSocketServerClient.setHostname ( String  hostname)

Sets the hostname for the socket server connection.

Parameters
hostnameThe hostname or IP address

Definition at line 139 of file RCOSocketServerClient.java.

References denoptim.integration.rcoserver.RCOSocketServerClient.hostname.

◆ setPort()

void denoptim.integration.rcoserver.RCOSocketServerClient.setPort ( Integer  port)

Sets the port for the socket server connection.

Parameters
portThe port number

Definition at line 150 of file RCOSocketServerClient.java.

References denoptim.integration.rcoserver.RCOSocketServerClient.port.

Member Data Documentation

◆ hostname

◆ instance

RCOSocketServerClient denoptim.integration.rcoserver.RCOSocketServerClient.instance = null
staticprivate

Singleton instance.

Definition at line 64 of file RCOSocketServerClient.java.

Referenced by denoptim.integration.rcoserver.RCOSocketServerClient.getInstance().

◆ jsonConverter

Gson denoptim.integration.rcoserver.RCOSocketServerClient.jsonConverter = new GsonBuilder().create()
private

Converter to and from JSON/Java objects.

We use a singleton pattern.

Definition at line 85 of file RCOSocketServerClient.java.

Referenced by denoptim.integration.rcoserver.RCOSocketServerClient.formulateRequest(), and denoptim.integration.rcoserver.RCOSocketServerClient.sendRequest().

◆ port

◆ version

final int denoptim.integration.rcoserver.RCOSocketServerClient.version = 1
private

Version identifier.

Definition at line 69 of file RCOSocketServerClient.java.

Referenced by denoptim.integration.rcoserver.RCOSocketServerClient.formulateRequest().


The documentation for this class was generated from the following file: