Skip to content

Commit

Permalink
add simple js version of qffbuddy
Browse files Browse the repository at this point in the history
  • Loading branch information
ntBre committed Sep 15, 2024
1 parent 4caaa22 commit fbff8a3
Show file tree
Hide file tree
Showing 4 changed files with 254 additions and 0 deletions.
102 changes: 102 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
width:60%;
margin-left: auto;
margin-right: auto;
margin-bottom: 20%;
}
pre {
word-wrap: normal;
Expand Down Expand Up @@ -54,6 +55,7 @@
text-decoration: underline;
}
</style>
<script src=qffbuddy.js></script>
</head>
<body>
<h1>pbqff</h1>
Expand Down Expand Up @@ -132,6 +134,7 @@ <h2>Table of Contents</h2>
<li><a href="#resuming-normal-coordinate-qffs">Resuming Normal Coordinate QFFs</a></li>
</ul>
<li><a href="#command-line-options">Command Line Options</a></li>
<li><a href="#qffbuddy">qffbuddy</a></li>
</ul>


Expand Down Expand Up @@ -1656,5 +1659,104 @@ <h2 id=command-line-options><a href="#command-line-options">Command Line Options
documented here in case it proves useful for other interfaces to pbqff.
</p>

<h2 id=qffbuddy><a href="#qffbuddy">qffbuddy</a></h2>

<p>
You may know qffbuddy as a Python GUI for writing and even running pbqff
jobs. This section contains a reimplementation of qffbuddy as an HTML
form. While you can't use it to run pbqff directly, submitting the form
will copy the generated TOML file to your clipboard for pasting into an
actual TOML file.
</p>

<form onsubmit="return qffbuddy(this);" class="qffbuddy">
<label for="geometry">Geometry in Å:</label>
<textarea id="geometry" name="geometry" rows="10" cols="72"> </textarea>

<br>
<label for="optimize">Does it need to be optimized?</label>
<input type="checkbox" id="optimize" name="optimize" value="true"/>

<br>
<label for="charge">Charge</label>
<input type="number" id="charge" name="charge" value="0"/>

<br>
<label for="step_size">Step Size in Å</label>
<input type="number" id="step_size" name="step_size" min="0"
value="0.005" step="0.001"/>

<br>
<label for="sleep_int">Sleep interval in sec</label>
<input type="number" id="sleep_int" name="sleep_int" min="1" value="60" step="1"/>

<br>
<label for="job_limit">Max jobs to submit at once</label>
<input type="number" id="job_limit" name="job_limit" min="1" value="1024" step="1"/>

<br>
<label for="chunk_size">Jobs per chunk</label>
<input type="number" id="chunk_size" name="chunk_size" min="1" value="1" step="1"/>

<br>
<label for="check_int">Checkpoint interval (0 to disable)</label>
<input type="number" id="check_int" name="check_int" min="0" value="100" step="1"/>

<br>
<fieldset>
<legend>Coordinate type</legend>
<input type="radio" id="SIC" name="coord_type" value="sic"/>
<label for="SIC">SIC</label>
<input type="radio" id="Cartesian" name="coord_type" value="cart"/>
<label for="Cartesian">Cartesian</label>
<input type="radio" id="Normal" name="coord_type" value="norm" checked/>
<label for="Normal">Normal</label>
</fieldset>

<br>
<label for="findiff">Finite differences? (Normal coordinates only)</label>
<input type="checkbox" id="findiff" name="findiff" value="true"/>
<br>

<br>
<fieldset>
<legend>Chemistry Program</legend>
<input type="radio" id="molpro" name="program" value="molpro" checked/>
<label for="molpro">Molpro</label>
<input type="radio" id="mopac" name="program" value="mopac"/>
<label for="mopac">Mopac</label>
<input type="radio" id="dftb+" name="program" value="dftb+"/>
<label for="dftb+">DFTB+</label>
<input type="radio" id="cfour" name="program" value="cfour"/>
<label for="cfour">CFOUR</label>
</fieldset>

<br>
<fieldset>
<legend>Queuing System</legend>
<input type="radio" id="pbs" name="queue" value="pbs" checked/>
<label for="pbs">PBS</label>
<input type="radio" id="slurm" name="queue" value="slurm"/>
<label for="slurm">Slurm</label>
<input type="radio" id="local" name="queue" value="local"/>
<label for="local">Local</label>
</fieldset>

<br>
<label for="template">Template input file</label>
<textarea id="template" name="template" rows="10" cols="72"></textarea>

<br>
<label for="queue_template">Queue template (optional)</label>
<textarea id="queue_template" name="queue_template" rows="10" cols="72"></textarea>

<br>
<label for="hybrid_template">Hybrid template (optional)</label>
<textarea id="hybrid_template" name="hybrid_template" rows="10" cols="72"></textarea>

<br>
<input type="submit" value="Submit">
</form>

</body>
</html>
50 changes: 50 additions & 0 deletions docs/qffbuddy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
async function qffbuddy(self) {
console.log(self.geometry.value)
let optimize = document.querySelector("[name=optimize]").checked;
let findiff = document.querySelector("[name=findiff]").checked;
console.log(optimize);

let queue_template;
if (self.queue_template.value) {
queue_template = `queue_template = """
${self.queue_template.value}
"""`;
} else {
queue_template = "";
}
let hybrid_template;
if (self.hybrid_template.value) {
hybrid_template = `hybrid_template = """
${self.hybrid_template.value}
"""`;
} else {
hybrid_template = "";
}
let template = `\
geometry = """
${self.geometry.value}
"""
optimize = ${optimize}
charge = ${self.charge.value}
step_size = ${self.step_size.value}
sleep_int = ${self.sleep_int.value}
job_limit = ${self.job_limit.value}
chunk_size = ${self.chunk_size.value}
check_int = ${self.check_int.value}
coord_type = "${self.coord_type.value}"
findiff = ${findiff}
program = "${self.program.value}"
queue = "${self.queue.value}"
template = """
${self.template.value}
"""
${queue_template}
${hybrid_template}
`;
try {
await navigator.clipboard.writeText(template);
} catch (error) {
console.error(error.message);
}
return false;
}
101 changes: 101 additions & 0 deletions docs/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
width:60%;
margin-left: auto;
margin-right: auto;
margin-bottom: 20%;
}
pre {
word-wrap: normal;
Expand Down Expand Up @@ -59,6 +60,7 @@
text-decoration: underline;
}
</style>
<script src=qffbuddy.js></script>
</head>
<body>
<h1>pbqff</h1>
Expand Down Expand Up @@ -1159,5 +1161,104 @@ <h2>Table of Contents</h2>
documented here in case it proves useful for other interfaces to pbqff.
</p>

head2(qffbuddy)

<p>
You may know qffbuddy as a Python GUI for writing and even running pbqff
jobs. This section contains a reimplementation of qffbuddy as an HTML
form. While you can't use it to run pbqff directly, submitting the form
will copy the generated TOML file to your clipboard for pasting into an
actual TOML file.
</p>

<form onsubmit="return qffbuddy(this);" class="qffbuddy">
<label for="geometry">Geometry in Å:</label>
<textarea id="geometry" name="geometry" rows="10" cols="72"> </textarea>

<br>
<label for="optimize">Does it need to be optimized?</label>
<input type="checkbox" id="optimize" name="optimize" value="true"/>

<br>
<label for="charge">Charge</label>
<input type="number" id="charge" name="charge" value="0"/>

<br>
<label for="step_size">Step Size in Å</label>
<input type="number" id="step_size" name="step_size" min="0"
value="0.005" step="0.001"/>

<br>
<label for="sleep_int">Sleep interval in sec</label>
<input type="number" id="sleep_int" name="sleep_int" min="1" value="60" step="1"/>

<br>
<label for="job_limit">Max jobs to submit at once</label>
<input type="number" id="job_limit" name="job_limit" min="1" value="1024" step="1"/>

<br>
<label for="chunk_size">Jobs per chunk</label>
<input type="number" id="chunk_size" name="chunk_size" min="1" value="1" step="1"/>

<br>
<label for="check_int">Checkpoint interval (0 to disable)</label>
<input type="number" id="check_int" name="check_int" min="0" value="100" step="1"/>

<br>
<fieldset>
<legend>Coordinate type</legend>
<input type="radio" id="SIC" name="coord_type" value="sic"/>
<label for="SIC">SIC</label>
<input type="radio" id="Cartesian" name="coord_type" value="cart"/>
<label for="Cartesian">Cartesian</label>
<input type="radio" id="Normal" name="coord_type" value="norm" checked/>
<label for="Normal">Normal</label>
</fieldset>

<br>
<label for="findiff">Finite differences? (Normal coordinates only)</label>
<input type="checkbox" id="findiff" name="findiff" value="true"/>
<br>

<br>
<fieldset>
<legend>Chemistry Program</legend>
<input type="radio" id="molpro" name="program" value="molpro" checked/>
<label for="molpro">Molpro</label>
<input type="radio" id="mopac" name="program" value="mopac"/>
<label for="mopac">Mopac</label>
<input type="radio" id="dftb+" name="program" value="dftb+"/>
<label for="dftb+">DFTB+</label>
<input type="radio" id="cfour" name="program" value="cfour"/>
<label for="cfour">CFOUR</label>
</fieldset>

<br>
<fieldset>
<legend>Queuing System</legend>
<input type="radio" id="pbs" name="queue" value="pbs" checked/>
<label for="pbs">PBS</label>
<input type="radio" id="slurm" name="queue" value="slurm"/>
<label for="slurm">Slurm</label>
<input type="radio" id="local" name="queue" value="local"/>
<label for="local">Local</label>
</fieldset>

<br>
<label for="template">Template input file</label>
<textarea id="template" name="template" rows="10" cols="72"></textarea>

<br>
<label for="queue_template">Queue template (optional)</label>
<textarea id="queue_template" name="queue_template" rows="10" cols="72"></textarea>

<br>
<label for="hybrid_template">Hybrid template (optional)</label>
<textarea id="hybrid_template" name="hybrid_template" rows="10" cols="72"></textarea>

<br>
<input type="submit" value="Submit">
</form>

</body>
</html>
1 change: 1 addition & 0 deletions docs/toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,5 @@
<li><a href="#resuming-normal-coordinate-qffs">Resuming Normal Coordinate QFFs</a></li>
</ul>
<li><a href="#command-line-options">Command Line Options</a></li>
<li><a href="#qffbuddy">qffbuddy</a></li>
</ul>

0 comments on commit fbff8a3

Please sign in to comment.