What is the minimum required file to generate a .yaml from a .nw in newchem? - q#

I am using nwchem (with powershell as described in https://learn.microsoft.com/en-us/quantum/libraries/chemistry/installation) to generate .yamls so that I can do resource estimation using q#.
I successfully converted a provided example .nw file into a yaml with this method, and I've included the .nw below
start n2_0_75Re_sto3g
echo
geometry units bohr
symmetry c1
n 0 0 -0.7755
n 0 0 0.7755
end
basis
* library sto-3g
end
scf
thresh 1.0e-10
tol2e 1.0e-10
singlet
rhf
end
tce
2eorb
2emet 13
tilesize 1
ccsd
thresh 1.0e-6
nroots 1
end
set tce:print_integrals T
set tce:qorb 10
set tce:qela 7
set tce:qelb 7
task tce energy
mcscf
active 10
actelec 14
multiplicity 1
end
task mcscf
I'd like to better understand how to make my own for a different molecule. Using the code provided in the nwchem tutorial - https://github.com/nwchemgit/nwchem/wiki/Getting-Started#simple-input-file----scf-geometry-optimization - where they provide the supposed minimal information to run something on nwchem:
title "Nitrogen cc-pvdz SCF geometry optimization"
geometry
n 0 0 0
n 0 0 1.08
end
basis
n library cc-pvdz
end
task scf optimize
This seems to run through nwchem successfully but errors before generating the yaml:
File "/opt/nwchem/contrib/quasar/export_chem_library_yaml.py", line 298, in <module>
main()
File "/opt/nwchem/contrib/quasar/export_chem_library_yaml.py", line 291, in main
emitter_yaml_func()
File "/opt/nwchem/contrib/quasar/export_chem_library_yaml.py", line 283, in emitter_yaml_func
data = extract_fields()
File "/opt/nwchem/contrib/quasar/export_chem_library_yaml.py", line 142, in extract_fields
if geometry is None:
I want to use http://www.cheminfo.org/Chemistry/Cheminformatics/FormatConverter/index.html to generate the geometry coordinates of a molecule, and have a bare bones .nw file which I can insert the geometry into. After playing around I often run into errors like the one above, which seems specific to the final stage of converting the output into a yaml.
Any help would be appreciated!

The Tensor Contraction Engine (TCE) component of NWChem needs to be configured to output Broombridge files (the quasar component of NWChem, documented at contrib/quasar/README.md in the NWChem repository).
Using the example at https://learn.microsoft.com/quantum/libraries/chemistry/samples/end-to-end:
set tce:print_integrals T
set tce:qorb 18
set tce:qela 9
set tce:qelb 9
Adding those instructions to your input deck should enable outputting Broombridge. For more details, see Listing 7 of arXiv:1904.01131.

Related

How do I store YOLOv5 Outputs to one csv file rather than many .txt files per detection

Hi all I have been researching this challenge for some time now and all my efforts are futile. What I am trying to do?
I am running YOLOV5 and this is working fine in the training stage and the detection stages. The operations is outputting multiple .txt files per video for each detection per frame. This is the command I am using:
python3 detect.py --weights /Users/YOLO2ClassOnly/yolov5/runs/train/exp11/weights/best.pt --source /Users/YOLO2ClassOnly/yolov5/data/videos --conf 0.1 --line-thickness 1 --save-txt SAVE_TXT --save-conf
This command produces multiple text files, for example vid0_walking.txt, vid1_walking.txt, vid2_walking.txt...n/ etc.
This is depleting my storage resources and I am trying to avoid this.
What I would like to do?
Store the files in one .csv file in this format, please.
# xmin ymin xmax ymax confidence class name
# 0 749.50 43.50 1148.0 704.5 0.874023 0 person
# 2 114.75 195.75 1095.0 708.0 0.624512 0 person
# 3 986.00 304.00 1028.0 420.0 0.286865 27 tie
I have been following Glen Jorcher Links Here:
https://github.com/ultralytics/yolov5/issues/7499
But this is futile, this function print(results.pandas().xyxy[0])
is not working to generate the output for video as per above.
Please help, this is challenging me due to my lack of understanding.
Thanx in advance for acknowledging my digital presence and I am grateful for your guidance!

How to use size() function to get number of cars in a train agent

I'm using the railyard library and after a train source block I have a select output that loops back to another flowchart block if the train is greater than 25 cars. For the code of this select output I've tried agent.size() > 25; train.size() > 25; and int size() > 25 but everything comes up with errors. Am I using the wrong naming convention for my agent (and if so where do I find my agent name), or how do I tweak this code to use this function correctly?
Use agent.size()>25 but without the semicolon
This is a condition, not a normal line of code.

tensorflow checkpoint missing input tensor node

( please pardon my long post, dearly appreciate your help )
I am training the squeezeDet model for the pascal VOC style custom data as per the training code from the repository HERE
train.py
model_definition and HERE
the saved model checkpoint performs well as I can see acceptable performance.
Now i am trying to freeze the model for deployment using coreML to see how the performance is in a mobile platform. The authors of the script only report performance in a GPU environment in their research paper.
I follow the recommended steps as per tensorflow, my commands are as below
First,
I write the graph out from the checkpoint meta file
path_to_ckpt_meta = rootdir + "model.ckpt-355000.meta"
path_to_ckpt_data = rootdir + "model.ckpt-355000"
sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True))
saver = tf.train.import_meta_graph(path_to_ckpt_meta)
saver.restore(sess, path_to_ckpt_data)
tf.train.write_graph(tf.get_default_graph().as_graph_def(), rootdir, "model_ckpt_355000_graph_V2.pb", False)
Now
I check the graph summary as see all the tensors in the model . The output summary file is HERE.
However, when I check the checkpoint file using the inspect_checkpoint.py function from tensorflow I see no image_input nodes. The output of inspection is HERE.
Second
I freeze the graph using the tensorflow freeze_graph.py function
python ./tensorflow/python/tools/freeze_graph.py \
--input_graph=path-to-dir/train/model_ckpt_355000_graph.pb \
--input_checkpoint=path-to-dir/train/model.ckpt-355000 \
--output_graph=path-to-dir/train/frozen_sqdt_ckpt_355000.pb \
--output_node_names=bbox/trimming/bbox,probability/score,probability/class_idx
the freeze_graph call completes without error and results in the frozen graph as per the command above.
Now,
when I check the frozen graph using the summarize_graph function call
bazel-bin/tensorflow/tools/graph_transforms/summarize_graph --in_graph=/tmp/logs/squeezeDet_NewDataset_test01_March02/train/frozen_sqdt_ckpt_355000.pb
I get the following
No inputs spotted.
No variables spotted.
Found 3 possible outputs: (name=bbox/trimming/bbox, op=Transpose) (name=probability/score, op=Max) (name=probability/class_idx, op=ArgMax)
Found 2703452 (2.70M) const parameters, 0 (0) variable parameters, and 0 control_edges
Op types used: 130 Const, 68 Identity, 32 BiasAdd, 32 Conv2D, 31 Relu, 15 Mul, 14 Add, 10 ConcatV2, 9 Sub, 5 RealDiv, 5 Reshape, 4 Maximum, 4 Minimum, 3 StridedSlice, 3 MaxPool, 2 Exp, 2 Greater, 2 Cast, 2 Select, 1 Transpose, 1 Softmax, 1 Sigmoid, 1 Unpack, 1 RandomUniform, 1 QueueDequeueManyV2, 1 Pack, 1 Max, 1 Floor, 1 FIFOQueueV2, 1 ArgMax
To use with tensorflow/tools/benchmark:benchmark_model try these arguments:
bazel run tensorflow/tools/benchmark:benchmark_model -- --graph=/tmp/logs/squeezeDet_NewDataset_test01_March02/train/frozen_sqdt_ckpt_355000.pb --show_flops --input_layer= --input_layer_type= --input_layer_shape= --output_layer=bbox/trimming/bbox,probability/score,probability/class_idx
this output above suggests that there is no input detected from the frozen graph. I check the summary of the frozen graph and find no image_input tensor. HERE
When I check my original graph ( written in step 1 ) with summarize graph, It does show inputs.
My troubleshooting
Suggests there is some mixup in the original authors code where the image_input is not provided as an input tensor. Though, the confusing part is that I can see the input image tensor in the summary of the output graph from the checkpoint meta file.
My question is,
-- why is the frozen graph removing the input nodes, when the original graph has the inputs ?
-- And, what can I do to change this and be able to successfully freeze_graph correctly.
Is there a transformation that need to perform in order to make this freeze model compatible with the coreML format.?
All your help is much appreciated.
Best
Aman

NEAT with multiple output

I'm currently implementing a program classifier for my coursework.
My lecturer ask me to use "Evolving ANN" algorithm.
So I found a package called NEAT (Neuro Evolution of Augmenting Topologies).
I have 10 inputs and 7 outputs, then I just modify the source from its documentation.
def eval_fitness(genomes):
for g in genomes:
net = nn.create_feed_forward_phenotype(g)
mse = 0
for inputs, expected in zip(alldata, label):
output = net.serial_activate(inputs)
output = np.clip(output, -1, 1)
mse += (output - expected) ** 2
g.fitness = 1 - (mse/44000) #44000 is the number of samples
print(g.fitness)
I had changed the config file too, so the program has 10 inputs and 7 outputs.
But when I try to run the code, it gives me error
Traceback (most recent call last):
File "/home/ilhammaziz/PycharmProjects/tuproSC2/eANN.py", line 40, in <module>
pop.run(eval_fitness, 10)
File "/home/ilhammaziz/.local/lib/python3.5/site-packages/neat/population.py", line 190, in run
best = max(population)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
What I supposed to do?
Thanks
As far as I can tell the error is not in your code but in the library it self. Just use a different one.
This one looks promising to me.

Moses machine translation - using Moses with Anymalign

Does anyone know how to replace GIZA++ in Moses with Anymalign which is obtained from here
In fact, there is 9 steps to using Moses, I want to start the step 4 without passing the step 2 and 3, but it seems to be impossible not to use GIZA++. Anyone has a clue?
In the moses manual
on page 351 in the section 8.3 Reference: All Training Parameters there is described parameter --first-step -- first step in the training process (default 1), so you can use train-model.perl ... --first-step 4 to start training from step 4