10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-22 20:34:58 +01:00

Deterministic PT2 for < 1000 dets

This commit is contained in:
Anthony Scemama 2019-05-27 10:46:01 +02:00
parent c376dec776
commit 7ddc21ee5b
3 changed files with 73 additions and 2 deletions

71
bin/qp_tunnel Executable file
View File

@ -0,0 +1,71 @@
#!/usr/bin/env python2
"""
Creates an ssh tunnel for using slaves on another network.
Launch a server on the front-end node of the cluster on which the master
process runs. Then start a client ont the front-end node of the distant
cluster.
Usage:
qp_tunnel server EZFIO_DIR
qp_tunnel client <address> EZFIO_DIR
Options:
-h --help
"""
import os
import sys
import zmq
try:
import qp_path
except ImportError:
print "source .quantum_package.rc"
raise
from docopt import docopt
from ezfio import ezfio
def get_address(filename):
with open(os.path.join(filename,'work','qp_run_address'),'r') as f:
a = f.readlines()[0].strip()
return a
def set_address(filename,address):
with open(os.path.join(filename,'work','qp_run_address'),'r') as f:
backup = f.readlines()
with open(os.path.join(filename,'work','qp_run_address'),'w') as f:
f.write('\n'.join([address]+backup))
def main_server(arguments,filename):
destination = get_address(filename)
print destination
def main_client(arguments,filename):
destination = arguments["<address>"]
print destination
def main(arguments):
"""Main function"""
print arguments
filename = arguments["EZFIO_DIR"]
if arguments["server"]:
return main_server(arguments, filename)
if arguments["client"]:
return main_client(arguments, filename)
if __name__ == '__main__':
ARGUMENTS = docopt(__doc__)
main(ARGUMENTS)

View File

@ -135,7 +135,7 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in)
PROVIDE psi_occ_pattern_hii det_to_occ_pattern PROVIDE psi_occ_pattern_hii det_to_occ_pattern
endif endif
if (N_det < max(10,N_states)) then if (N_det < max(1000,N_states)) then
pt2=0.d0 pt2=0.d0
variance=0.d0 variance=0.d0
norm=0.d0 norm=0.d0

View File

@ -38,7 +38,7 @@ default: 1
type: Threshold type: Threshold
doc: Thresholds on generators (fraction of the square of the norm) doc: Thresholds on generators (fraction of the square of the norm)
interface: ezfio,provider,ocaml interface: ezfio,provider,ocaml
default: 0.99 default: 0.999
[n_int] [n_int]
interface: ezfio interface: ezfio