$darkmode
|
DENOPTIM
|
Sends the request to produce a socket server running the RingClosingMM service. More...
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... | |
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.
|
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().
|
staticprivate |
Converts a List of 0-based int arrays to a JsonArray containing 1-based ints.
| intArrayList | The list of int arrays to convert |
Definition at line 398 of file RCOSocketServerClient.java.
Referenced by denoptim.integration.rcoserver.RCOSocketServerClient.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
| zmat | the zMatrix representation |
| rcpTerms | The list of ring-closing potential energy terms (RCP terms) (0-based) |
| rotatableBonds | The list of bonds that can be twisted. Each bond is defined by the two 0-based indexes of the bonded atoms. |
| allBonds | The list of all bonds. Each bond is defined by the two 0-based indexes of the bonded atoms. |
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().
| String denoptim.integration.rcoserver.RCOSocketServerClient.getHostname | ( | ) |
Gets the currently configured hostname.
Definition at line 160 of file RCOSocketServerClient.java.
References denoptim.integration.rcoserver.RCOSocketServerClient.hostname.
|
static |
Gets the singleton instance of RCOSocketServerClient if it has been initialized.
| IllegalStateException | if the instance has not been initialized yet. |
Definition at line 123 of file RCOSocketServerClient.java.
References denoptim.integration.rcoserver.RCOSocketServerClient.instance.
|
static |
Gets the singleton instance of RCOSocketServerClient.
| hostname | The hostname or IP address of the socket server |
| port | The port number of the socket server |
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().
| Integer denoptim.integration.rcoserver.RCOSocketServerClient.getPort | ( | ) |
Gets the currently configured port.
Definition at line 170 of file RCOSocketServerClient.java.
References denoptim.integration.rcoserver.RCOSocketServerClient.port.
|
static |
Gets a JsonArray representation of the Z-matrix.
Note that this is meant to produce 1-based indices for the atoms.
| zmat | The TinkerMolecule object to be processed. |
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().
| 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.
| chemObj | the definition of the chemical system to work with. |
| logger | logging tool |
| 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().
| 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.
| chemObj | the definition of the chemical system to work with. |
| rcaCombination | if not null and not empty, biases the conformational search towards conformations closing the rings defined by each given pair of RingClosingAttractors. |
| logger | logging tool |
| 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().
| 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.
| requestAsJSONString | the request as a JSON string. |
| IOException | if 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().
| void denoptim.integration.rcoserver.RCOSocketServerClient.setHostname | ( | String | hostname | ) |
Sets the hostname for the socket server connection.
| hostname | The hostname or IP address |
Definition at line 139 of file RCOSocketServerClient.java.
References denoptim.integration.rcoserver.RCOSocketServerClient.hostname.
| void denoptim.integration.rcoserver.RCOSocketServerClient.setPort | ( | Integer | port | ) |
Sets the port for the socket server connection.
| port | The port number |
Definition at line 150 of file RCOSocketServerClient.java.
References denoptim.integration.rcoserver.RCOSocketServerClient.port.
|
private |
The name of the host or ID address used to communicate with the socket server.
Definition at line 75 of file RCOSocketServerClient.java.
Referenced by denoptim.integration.rcoserver.RCOSocketServerClient.getHostname(), denoptim.integration.rcoserver.RCOSocketServerClient.getInstance(), denoptim.integration.rcoserver.RCOSocketServerClient.RCOSocketServerClient(), denoptim.integration.rcoserver.RCOSocketServerClient.sendRequest(), and denoptim.integration.rcoserver.RCOSocketServerClient.setHostname().
|
staticprivate |
Singleton instance.
Definition at line 64 of file RCOSocketServerClient.java.
Referenced by denoptim.integration.rcoserver.RCOSocketServerClient.getInstance().
|
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().
|
private |
The identifier of the port used to communicate with the socket server.
Definition at line 80 of file RCOSocketServerClient.java.
Referenced by denoptim.integration.rcoserver.RCOSocketServerClient.getInstance(), denoptim.integration.rcoserver.RCOSocketServerClient.getPort(), denoptim.integration.rcoserver.RCOSocketServerClient.RCOSocketServerClient(), denoptim.integration.rcoserver.RCOSocketServerClient.sendRequest(), and denoptim.integration.rcoserver.RCOSocketServerClient.setPort().
|
private |
Version identifier.
Definition at line 69 of file RCOSocketServerClient.java.
Referenced by denoptim.integration.rcoserver.RCOSocketServerClient.formulateRequest().