Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow tinkerio to read TINKERPATH variable from environment #206

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

misterbrandonwalker
Copy link

No description provided.

@leeping
Copy link
Owner

leeping commented Mar 12, 2021

Thanks for making this PR. Is TINKERPATH the recommended environment variable name from the TINKER distribution or is it a custom name? Is your intention that the environment variable should override what is in the input file?

@misterbrandonwalker
Copy link
Author

misterbrandonwalker commented Mar 12, 2021 via email

@misterbrandonwalker
Copy link
Author

misterbrandonwalker commented Mar 12, 2021 via email

@leeping
Copy link
Owner

leeping commented Mar 13, 2021

I think that typically, the environment variable is more "invisible" whereas command line / input file options are more explicitly set by the user. Could you switch the priority order so that the input file will override the environment variable? You can still get the behavior you want by leaving tinkerpath blank in the input file.

bdw2292 added 2 commits March 15, 2021 13:28
…ker openmm on GPU), and gas is not in keyfile name, then switch dynamic to dynamicomm (gpu dynamic program).

2)	If OPENMM_CUDA_COMPILER is detected in environment, for NPT dynamics, then add N to dynamic command string (program asks for output info from GPU).
3)	MUTAL and THOLE keywords are added to lines that include Polarization in them (latest analyze version), so these are excluded from parsing Polarization energy.
4)	Temperature is not printed out in latest version (or gpu version), but since it is constant in NPT/NVT, just append the constant temperature instead of parsing.
5)	Switch priority of original commit, if tinkerpath keyword is specified, this supersedes any TINKERPATH detected in environment.
…oment and tinkerpath is defined, the tinkerpath variable will supersedes TINKERPATH. If tinkerpath variable is None and TINKERPATH in environment, then this is used instead.
def setopts(self, **kwargs):

""" Called by __init__ ; Set TINKER-specific options. """

## The directory containing TINKER executables (e.g. dynamic)
if 'tinkerpath' in kwargs:
self.tinkerpath = kwargs['tinkerpath']
if not os.path.exists(os.path.join(self.tinkerpath,"dynamic")):
if not os.path.exists(os.path.join(self.tinkerpath,"dynamic")) and 'dynamic' not in os.environ.keys():
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you comment on this? Is "dynamic" supposed to be an environment variable too?

@@ -910,13 +919,13 @@ def molecular_dynamics(self, nsteps, timestep, temperature=None, pressure=None,
if temperature is not None:
md_defs["integrator"] = "stochastic"
else:
md_defs["integrator"] = "beeman"
md_defs["integrator"] = "respa"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default parameters are what's used if the user doesn't specify the option in the key file, so it doesn't need to be the most efficient, it only needs to be fail-safe.

Does the use of respa require any additional options in the key file, i.e. specifying the long and short timestep, or the subdivision of the long timestep to make the short timestep?

md_opts["thermostat"] = None
# Periodic boundary conditions.
if self.pbc:
md_opts["vdw-correction"] = ''
if temperature is not None and pressure is not None:
md_defs["integrator"] = "beeman"
md_defs["integrator"] = "respa"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above comment.

@@ -933,7 +942,7 @@ def molecular_dynamics(self, nsteps, timestep, temperature=None, pressure=None,

eq_opts = deepcopy(md_opts)
if self.pbc and temperature is not None and pressure is not None:
eq_opts["integrator"] = "beeman"
eq_opts["integrator"] = "respa"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above comment.

src/tinkerio.py Outdated
self.calltinker("dynamic %s -k %s-eq %i %f %f 4 %f %f" % (self.name, self.name, nequil, timestep, float(nsave*timestep)/1000,
temperature, pressure), print_to_screen=verbose)
if 'OPENMM_CUDA_COMPILER' in os.environ.keys():
self.calltinker(dynamickeyword+" %s -k %s-eq %i %f %f 4 %f %f N" % (self.name, self.name, nequil, timestep, float(nsave*timestep)/1000,temperature, pressure), print_to_screen=verbose)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment regarding the extra "N" command line argument

src/tinkerio.py Outdated
os.system("rm -f %s.arc" % (self.name))

# Run production.
if verbose: printcool("Running production dynamics", color=0)
write_key("%s-md.key" % self.name, md_opts, "%s.key" % self.name, md_defs)
if 'OPENMM_CUDA_COMPILER' in os.environ.keys() and 'gas' not in self.name:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to duplicate line 956, could the determination of dynamickeyword be moved "above" the "if nequil>0" block, so it doesn't need to be duplicated?

src/tinkerio.py Outdated
if self.pbc and pressure is not None:
odyn = self.calltinker("dynamic %s -k %s-md %i %f %f 4 %f %f" % (self.name, self.name, nsteps, timestep, float(nsave*timestep/1000),
temperature, pressure), print_to_screen=verbose)
if 'OPENMM_CUDA_COMPILER' in os.environ.keys():
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some way to simplify this so that it doesn't check for OPENMM_CUDA_COMPILER twice (once when it determines dynamickeyword and again when it decides how to call TINKER?) Maybe you could make the N into a variable "dynamicsuffix" or something like that?

@@ -996,6 +1019,10 @@ def molecular_dynamics(self, nsteps, timestep, temperature=None, pressure=None,
havekeys = set()
first_shot = True
for ln, line in enumerate(oanl):
if 'Polarization' in line:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please comment on why you want to skip parsing these lines out of analyze?

@misterbrandonwalker
Copy link
Author

misterbrandonwalker commented Mar 23, 2021 via email

bdw2292 added 21 commits May 6, 2021 14:01
…or tinker GPU dynamics

2) Need to overide masterhost TINKERPATH input with enviorment of node since OS /libraries for installation can be different for worker node and master host.
…s not longer used. Set gpu dynamics to dynamic_gpu and search for GPUDYNAMICS keyword in envioronment to switch to GPU dynamics.
…e temp/pressure points. Read input csv example with experimental data.
…han two poltype jobs as input for force balance.
…eady has), then make sure to not add to input file for ForceBalance.
…ile, just turn off liquid sim for those points and dont add to forcebalance input file.
Bug fix, changing xyz type numbers for multiple molecules.
Make sure no absolute paths go into WorkQueue, it will throw fatal error.
@leeping
Copy link
Owner

leeping commented Feb 4, 2023

@bdw2292 I'm reviewing all the open PRs and this one is looking pretty huge at this point, and it contains lots of code. I do want to include your features into the master branch, but I'm not sure I can understand all your modifications on my own. Could we schedule a meeting sometime to go over what you wrote? You may feel free to ask your PI to join as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants